Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger giving wrong Kubernetes definitions. #2888

Closed
cburbridge opened this issue Apr 29, 2020 · 8 comments · Fixed by #2907
Closed

Swagger giving wrong Kubernetes definitions. #2888

cburbridge opened this issue Apr 29, 2020 · 8 comments · Fixed by #2907
Assignees
Labels
Milestone

Comments

@cburbridge
Copy link

What happened:

The swagger definition for the Argo API includes Kubernetes definitions such as io.k8s.api.core.v1.Volume and ``io.k8s.api.core.v1.Container`. Some definitions don't match those from Kubernetes, e.g:

Argo defines:

    "io.k8s.api.core.v1.SecretKeySelector": {
      "description": "SecretKeySelector selects a key of a Secret.",
      "type": "object",
      "properties": {
        "key": {
          "description": "The key of the secret to select from.  Must be a valid secret key.",
          "type": "string"
        },
        "localObjectReference": {
          "description": "The name of the secret in the pod's namespace to select from.",
          "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference"
        },
        "optional": {
          "type": "boolean",
          "format": "boolean",
          "title": "Specify whether the Secret or its key must be defined\n+optional"
        }
      }
    },

whereas Kubernetes (1.14.9) defines:

  "io.k8s.api.core.v1.SecretKeySelector": {
      "description": "SecretKeySelector selects a key of a Secret.",
      "properties": {
        "key": {
          "description": "The key of the secret to select from.  Must be a valid secret key.",
          "type": "string"
        },
        "name": {
          "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
          "type": "string"
        },
        "optional": {
          "description": "Specify whether the Secret or its key must be defined",
          "type": "boolean"
        }
      },
      "required": [
        "key"
      ],
      "type": "object"
    },

This means that following the Argo supplied definition with the "localObjectReference" field causes workflows submitted via the Argo REST API to fail. Following the Kubernetes 1.14.9 supplied API sepc works fine.

The same for io.k8s.api.core.v1.Volume, where a volumeSource attribute features in the Argo definition but not Kubernetes.

What you expected to happen:

The Kubernetes definitions to be supplied by Kubernetes, not via the Argo spec. This was the case in Argo release 2.3.

Environment:

Argo version:

argo: v2.7.5
  BuildDate: 2020-04-21T00:55:01Z
  GitCommit: ede163e1af83cfce29b519038be8127664421329
  GitTreeState: clean
  GitTag: v2.7.5
  GoVersion: go1.13
  Compiler: gc
  Platform: linux/amd64

Kubernetes version :

clientVersion:
  buildDate: "2020-02-11T18:14:22Z"
  compiler: gc
  gitCommit: 06ad960bfd03b39c8310aaf92d1e7c12ce618213
  gitTreeState: clean
  gitVersion: v1.17.3
  goVersion: go1.13.6
  major: "1"
  minor: "17"
  platform: linux/amd64
serverVersion:
  buildDate: "2020-02-07T01:31:02Z"
  compiler: gc
  gitCommit: 502bfb383169b124d87848f89e17a04b9fc1f6f0
  gitTreeState: clean
  gitVersion: v1.14.9-eks-502bfb
  goVersion: go1.12.12
  major: "1"
  minor: 14+
  platform: linux/amd64

Message from the maintainers:

If you are impacted by this bug please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

@alexec
Copy link
Contributor

alexec commented Apr 29, 2020

The specs changed on master yesterday. See #2837. Can you please check to see if that fixes your problem.

@cburbridge
Copy link
Author

@alexec
Copy link
Contributor

alexec commented Apr 29, 2020

Do you think this could be due to different versions of their API?

@cburbridge
Copy link
Author

I'm really not sure, I couldn't find any version documentation/swagger for Kubernetes that matches the Argo swagger.

@alexec
Copy link
Contributor

alexec commented Apr 29, 2020

Could you please attach a link to the K8S Swagger?

@alexec
Copy link
Contributor

alexec commented Apr 29, 2020

You've highlighted two issues.

  • We have io.k8s.api.core.v1.Volume#volumeSource but we should have -- what?
  • We have io.k8s.api.core.v1.SecretKeySelector#localObjectReference but we should have name.

Additional question - what spec does the API actually match - the K8S one or the Argo one. I.e. ify you submit a request via the API - what happens?

@alexec
Copy link
Contributor

alexec commented Apr 29, 2020

Ah - another example of Golang inline garbage - https://github.com/golang/build/blob/master/kubernetes/api/types.go#L226.

@cburbridge
Copy link
Author

Kubernetes swagger: https://raw.githubusercontent.com/kubernetes/kubernetes/release-1.14/api/openapi-spec/swagger.json

io.k8s.api.core.v1.Volume#volumeSource -> should just have the attributes of the VolumeSource type instead of a 'volumeSource' attribute.

The actual API matches the Kubernetes swagger, i,e if I submit a request based on using the Kubenetes swagger combined with the Argo swagger (with the io.k8s.* removed), then it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants