ansible / ansible-modules-extras

Ansible extra modules - these modules ship with ansible
947 stars 1.47k forks source link

kubernetes library module doesn't support `apis/extensions/v1beta1/` #3698

Closed ozbillwang closed 7 years ago

ozbillwang commented 7 years ago

@jimi-c & @erjohnso

Any chances to support below kinds under apis/extensions/v1beta1/ in ansible-modules-extras/clustering/kubernetes.py

http://kubernetes.io/docs/api/

http://kubernetes.io/docs/api-reference/extensions/v1beta1/definitions/

https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/extensions.json

Add a new kind in KIND_URL doesn't work directly (https://github.com/ansible/ansible-modules-extras/blob/devel/clustering/kubernetes.py#L203)

KIND_URL = {
    ....
    "daemonset": "/apis/extensions/v1beta1/daemonsets"
}

The kinds in v1beta1

{
  "kind": "APIResourceList",
  "groupVersion": "extensions/v1beta1",
  "resources": [
    {
      "name": "daemonsets",
      "namespaced": true,
      "kind": "DaemonSet"
    },
    {
      "name": "daemonsets/status",
      "namespaced": true,
      "kind": "DaemonSet"
    },
    {
      "name": "deployments",
      "namespaced": true,
      "kind": "Deployment"
    },
    {
      "name": "deployments/rollback",
      "namespaced": true,
      "kind": "DeploymentRollback"
    },
    {
      "name": "deployments/scale",
      "namespaced": true,
      "kind": "Scale"
    },
    {
      "name": "deployments/status",
      "namespaced": true,
      "kind": "Deployment"
    },
    {
      "name": "horizontalpodautoscalers",
      "namespaced": true,
      "kind": "HorizontalPodAutoscaler"
    },
    {
      "name": "horizontalpodautoscalers/status",
      "namespaced": true,
      "kind": "HorizontalPodAutoscaler"
    },
    {
      "name": "ingresses",
      "namespaced": true,
      "kind": "Ingress"
    },
    {
      "name": "ingresses/status",
      "namespaced": true,
      "kind": "Ingress"
    },
    {
      "name": "jobs",
      "namespaced": true,
      "kind": "Job"
    },
    {
      "name": "jobs/status",
      "namespaced": true,
      "kind": "Job"
    },
    {
      "name": "networkpolicies",
      "namespaced": true,
      "kind": "NetworkPolicy"
    },
    {
      "name": "replicasets",
      "namespaced": true,
      "kind": "ReplicaSet"
    },
    {
      "name": "replicasets/scale",
      "namespaced": true,
      "kind": "Scale"
    },
    {
      "name": "replicasets/status",
      "namespaced": true,
      "kind": "ReplicaSet"
    },
    {
      "name": "replicationcontrollers",
      "namespaced": true,
      "kind": "ReplicationControllerDummy"
    },
    {
      "name": "replicationcontrollers/scale",
      "namespaced": true,
      "kind": "Scale"
    },
    {
      "name": "thirdpartyresources",
      "namespaced": false,
      "kind": "ThirdPartyResource"
    }
  ]
}
ozbillwang commented 7 years ago

Maybe my updates work, the problem I have is related with the HTTPS auth. Got same error when create a new namespace.

If set insecure to true, got below error:

raise ValueError(\"No JSON object could be decoded\")\r\nValueError: No JSON object could be decoded\r\n", 

If set insecure to false, got this error:

"msg": "failed to create the resource: HTTP Error 401: Unauthorized

https://docs.ansible.com/ansible/kubernetes_module.html#synopsis

Currently, this module, Only supports HTTP Basic Auth Only supports ‘strategic merge’ for update, http://goo.gl/fCPYxT SSL certs are not working, use ‘validate_certs=off’ to disable

And the goo.gl short url doesn't work now, should be this: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#patch-operations

ansibot commented 7 years ago

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide.