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

Reflect currently running version from status.version in additionalPrinterColumns #3549

Merged
merged 2 commits into from
Aug 24, 2020

Conversation

sebgl
Copy link
Contributor

@sebgl sebgl commented Jul 28, 2020

When running for example kubectl get elastic, we get the version
displayed from spec.version. It represents the desired version but not
the version currently running.

Now that we have status.version available to represent the version
currently running, let's use it instead!

When running for example `kubectl get elastic`, we get the version
displayed from `spec.version`. It represents the desired version but not
the version currently running.

Now that we have `status.version` available to represent the version
currently running, let's use it!
@sebgl sebgl added >enhancement Enhancement of existing functionality v1.3.0 labels Jul 28, 2020
type: string
- JSONPath: .metadata.creationTimestamp
name: age
type: date
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionalPrinterColumns from v1beta1 does not match additionalPrinterColumns from v1 anymore with this change.
I need to double-check this does not break crd upgrade on some environments... will try the ECK 0.9 -> ECK from this PR upgrade path with Openshift 3.11 (minishift) and report here.

Copy link
Contributor Author

@sebgl sebgl Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applying the new all-in-one on Openshift 3.11:

error: error validating "config/all-in-one.yaml": error validating data: [ValidationError(CustomResourceDefinition.spec.versions[0]): unknown field "additionalPrinterColumns" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionVersion, ValidationError(CustomResourceDefinition.spec.versions[1]): unknown field "additionalPrinterColumns" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionVersion]; if you choose to ignore these errors, turn validation off with --validate=false

😞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some kustomize tweaks to ensure only the newest additionalPrinterColumns is set at the root level would fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3c57b29 sets up the required kustomize patches in order to have a single top-level additionalPrinterColumns .

If this new CRD is used with an operator running an older version (whichis unlikely to happen), or during the first few seconds before a reconciliation happens with ECK 1.3, then the version field in kubectl get elastic has an empty value, which is an OK behaviour IMO.

I can correctly apply the all-in-one manifest on Openshift 1.11 now.

Copy link
Contributor

@david-kow david-kow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mark this as breaking? It does change the behavior of already existing field.

@sebgl
Copy link
Contributor Author

sebgl commented Jul 29, 2020

Should we mark this as breaking? It does change the behavior of already existing field.

Hm that's a good question. We could argue it should have been this way to start with and the previous version value was incorrect (so more like a bugfix/enhancement). @elastic/cloud-k8s any other opinion?

@barkbay
Copy link
Contributor

barkbay commented Jul 29, 2020

Should we mark this as breaking? It does change the behavior of already existing field.

Hm that's a good question. We could argue it should have been this way to start with and the previous version value was incorrect (so more like a bugfix/enhancement). @elastic/cloud-k8s any other opinion?

👍 , sounds like a fix to me

@sebgl sebgl changed the title Reflect version from status.version in additionalPrinterColumns Reflect currently running version from status.version in additionalPrinterColumns Jul 29, 2020
Having additionalPrinterColumns set at the `versions[]` array level in
the CRD is not compatible with k8s 1.11.
This commit patches the generated CRD to move the
additionalPrinterColumns of the v1 version at the top-level.

If this new CRD is used with an operator running an older version (which
is unlikely to happen), or during the first seconds before a
reconciliation happens with ECK 1.3, then the `version` field appears
empty in `kubectl get elastic`.
Copy link
Contributor

@barkbay barkbay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, did a few tests on OCP 3 and 4 with a rebased version, seems to work as expected 👍

@sebgl sebgl merged commit bee3e84 into elastic:master Aug 24, 2020
barkbay pushed a commit to barkbay/cloud-on-k8s that referenced this pull request Sep 2, 2020
…interColumns (elastic#3549)

* Reflect version from status.version in additionalPrinterColumns

When running for example `kubectl get elastic`, we get the version
displayed from `spec.version`. It represents the desired version but not
the version currently running.

Now that we have `status.version` available to represent the version
currently running, let's use it!

* Use a kustomize patch to ensure a top-level additionalPrinterColumns

Having additionalPrinterColumns set at the `versions[]` array level in
the CRD is not compatible with k8s 1.11.
This commit patches the generated CRD to move the
additionalPrinterColumns of the v1 version at the top-level.

If this new CRD is used with an operator running an older version (which
is unlikely to happen), or during the first seconds before a
reconciliation happens with ECK 1.3, then the `version` field appears
empty in `kubectl get elastic`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants