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

Incorrect CRD version detection #898

Closed
mpereira opened this issue Oct 4, 2019 · 5 comments
Closed

Incorrect CRD version detection #898

mpereira opened this issue Oct 4, 2019 · 5 comments
Labels

Comments

@mpereira
Copy link
Member

mpereira commented Oct 4, 2019

During operator installs it is possible that the existing KUDO CRDs in the cluster are incompatible with the current KUDO CLI (e.g. the CRDs are 0.6.0 and the CLI is 0.7.0).

This can manifest as a marshaling error during kubectl kudo install <...> commands.

Example instance of the error:

$ ${kudo} -v 10 install ./operator \
>         --instance=cassandra \
>         --namespace=kudo-cassandra
repository used &{0xc000617660 {0xc000409b30}}
acquiring kudo client
getting package crds
local operator discovered: ./operator
determining package type of ./operator
./operator is a file package
folder walking skipping directory &{operator 160 2147484141 {487241426 63705205706 0x3456860} {16777220 16877 5 8640942178 501 20 0 [0 0 0 0] {1569862590 207548501} {1569608906 487241426} {1569608906 487241426} {1569608905 663926770} 160 0 4096 0 0 0 [0 0]}}
folder walking skipping directory &{templates 224 2147484141 {863444914 63705449857 0x3456860} {16777220 16877 7 8640942181 501 20 0 [0 0 0 0] {1569862666 426938226} {1569853057 863444914} {1569853057 863444914} {1569608905 664707035} 224 0 4096 0 0 0 [0 0]}}
operator name: cassandra
operator version: 0.1.0
instance name: cassandra
parameters in use: map[]
operator.kudo.dev/cassandra does not exist
Error: installing single Operator: installing cassandra-operator.yaml: installing Operator: Operator.kudo.dev "cassandra" is invalid: []: Invalid value: map[string]interface {}{"apiVersion":"kudo.dev/v1alpha1", "kind":"Operator", "metadata":map[string]interface {}{"creationTimestamp":"2019-09-30T16:57:47Z", "generation":1, "labels":map[string]interface {}{"controller-tools.k8s.io":"1.0"}, "name":"cassandra", "namespace":"kudo-cassandra", "uid":"ab47aeab-fb73-4f75-bc0a-9001b238fd59"}, "spec":map[string]interface {}{"kubernetesVersion":"1.15.0", "kudoVersion":"0.6.0", "maintainers":[]interface {}{map[string]interface {}{"email":"murilo@murilopereira.com", "name":"Murilo Pereira"}}, "url":"http://cassandra.apache.org/"}, "status":map[string]interface {}{}}: validation failure list:
spec.maintainers in body must be of type string: "object"

That happened with KUDO CLI version 0.7.2 and the following existing CRD, that for some reason was not overriden with kubectl kudo init --dry-run -o yaml | kubectl apply -f - a few days back. Notice that the spec for maintainers is an array of strings, not compatible with the 0.7.2 CLI.

kubectl get crds operators.kudo.dev -o yaml

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  creationTimestamp: "2019-09-19T14:07:17Z"
  generation: 1
  labels:
    app: kudo-manager
    controller-tools.k8s.io: "1.0"
  name: operators.kudo.dev
  resourceVersion: "16327"
  selfLink: /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/operators.kudo.dev
  uid: 816335ee-244b-42e8-ae7d-29c32d9d6b37
spec:
  conversion:
    strategy: None
  group: kudo.dev
  names:
    kind: Operator
    listKind: OperatorList
    plural: operators
    singular: operator
  preserveUnknownFields: true
  scope: Namespaced
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        meta:
          type: object
        spec:
          properties:
            description:
              type: string
            kubernetesVersion:
              type: string
            kudoVersion:
              type: string
            maintainers:
              items:
                type: string
              type: array
            url:
              type: string
          type: object
        status:
          type: object
  version: v1alpha1
  versions:
  - name: v1alpha1
    served: true
    storage: true
status:
  acceptedNames:
    kind: Operator
    listKind: OperatorList
    plural: operators
    singular: operator
  conditions:
  - lastTransitionTime: "2019-09-19T14:07:17Z"
    message: 'spec.validation.openAPIV3Schema.type: Required value: must not be empty
      at the root'
    reason: Violations
    status: "True"
    type: NonStructuralSchema
  - lastTransitionTime: "2019-09-19T14:07:17Z"
    message: no conflicts found
    reason: NoConflicts
    status: "True"
    type: NamesAccepted
  - lastTransitionTime: null
    message: the initial names have been accepted
    reason: InitialNamesAccepted
    status: "True"
    type: Established
  storedVersions:
  - v1alpha1

We should also provide instructions for upgrading KUDO in our release notes and announcement posts.

Why is this needed:

It improves the UX of KUDO users that might be upgrading their CLI versions.

@gerred
Copy link
Member

gerred commented Nov 4, 2019

This may not be relevant post 1.0 - we'll be using conversion webhooks then which is the "right" way to solve this.

@gerred gerred added the kind/bug label Nov 4, 2019
@ANeumann82
Copy link
Member

This specific issue might be fixed with #1113
Can you have a look @mpereira and close this one if you think it's enough?

@mpereira
Copy link
Member Author

mpereira commented Dec 3, 2019

Thanks @ANeumann82. Would the validation happen on any kubectl kudo commands, or just kubectl kudo install?

@ANeumann82
Copy link
Member

It should happen on any kubectl kudo command that uses the Kudo-Client, accesses the KUDO CRDs

@mpereira
Copy link
Member Author

mpereira commented Dec 5, 2019

If that's the case, feel free to close this ticket via #1113.

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

No branches or pull requests

3 participants