-
Notifications
You must be signed in to change notification settings - Fork 719
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
Split manifest generation to produce both v1/v1beta1 CRDs #4489
Conversation
fde9062
to
1a493c5
Compare
run full pr build |
Marking this ready for review with the caveat that we have a dependency on #4491 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive work 👍
I only left a few nitpicks, I need some additional time to process and test the PR.
Co-authored-by: Michael Morello <michael.morello@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: there is a reference to the all in one here.
Good catch, there is another one in the operatorhub tooling. Will fix! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! 🚀
run full pr build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👏
I left some minor and cosmetic changes.
@@ -25,3 +25,6 @@ | |||
path: /spec/validation/openAPIV3Schema/properties/spec/properties/deployment/properties/strategy/properties/rollingUpdate/properties/maxUnavailable/x-kubernetes-int-or-string | |||
- op: remove | |||
path: /spec/validation/openAPIV3Schema/properties/spec/properties/daemonSet/properties/updateStrategy/properties/rollingUpdate/properties/maxUnavailable/x-kubernetes-int-or-string | |||
# we need to generate x-kubernetes-preserve-unknown-fields for v1 CRDs but they break v1beta so we have to remove them again here | |||
- op: remove | |||
path: /spec/validation/openAPIV3Schema/properties/spec/properties/config/x-kubernetes-preserve-unknown-fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normal that we don't have the same count of x-kubernetes-preserve-unknown-fields
and // +kubebuilder:pruning:PreserveUnknownFields
?
Agent and Beat do not get:
- op: remove
path: /spec/validation/openAPIV3Schema/properties/spec/properties/daemonSet/properties/podTemplate/x-kubernetes-preserve-unknown-fields
- op: remove
path: /spec/validation/openAPIV3Schema/properties/spec/properties/deployment/properties/podTemplate/x-kubernetes-preserve-unknown-fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because we remove the whole podTemplate
section for the v1beta1
version on the top of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course.
That's not important but just for my understanding, we could do the same for the following patches where we also remove the whole podTemplate
?
v1beta1/patches/apm-kibana-patches.yaml: path: /spec/validation/openAPIV3Schema/properties/spec/properties/podTemplate/properties
v1beta1/patches/apm-kibana-patches.yaml: path: /spec/validation/openAPIV3Schema/properties/spec/properties/podTemplate/x-kubernetes-preserve-unknown-fields
v1beta1/patches/elasticsearch-patches.yaml: path: /spec/validation/openAPIV3Schema/properties/spec/properties/nodeSets/items/properties/podTemplate/properties
v1beta1/patches/elasticsearch-patches.yaml: path: /spec/validation/openAPIV3Schema/properties/spec/properties/nodeSets/items/properties/podTemplate/x-kubernetes-preserve-unknown-fields
v1beta1/patches/ems-patches.yaml: path: /spec/validation/openAPIV3Schema/properties/spec/properties/podTemplate/properties
v1beta1/patches/ems-patches.yaml: path: /spec/validation/openAPIV3Schema/properties/spec/properties/podTemplate/x-kubernetes-preserve-unknown-fields
v1beta1/patches/ent-patches.yaml: path: /spec/validation/openAPIV3Schema/properties/spec/properties/podTemplate/properties
v1beta1/patches/ent-patches.yaml: path: /spec/validation/openAPIV3Schema/properties/spec/properties/podTemplate/x-kubernetes-preserve-unknown-fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way we remove the podTemplate
differs a little bit between Agent and Beats and the other CRDs. Agent and Beats remove the whole podTemplate
tree, while the other CRDs only remove the properties
from the podTemplate
section. This makes the other tweaking necessary. This is nothing this PR introduced but has been in place since the introduction of Beats and Agent. I kept it that way so that the legacy CRDs stay as close to the versions we currently ship as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor suggestions for the text, otherwise LGTM.
Co-authored-by: alaudazzi <46651782+alaudazzi@users.noreply.github.com>
This PR moves all CRDs to
apiVersion: v1
but keepsv1beta1
around for older Kubernetes versions that we still want to support (all the way back to 1.12 and OCP 3.11)Upgrades from
v1beta1
tov1
will be a bit tricky which is why I have marked this PR asbreaking
:all-in-one.yaml
users will have to replace the CRDs and not usekubectl apply
because a meaningful merge ofv1beta1
tov1
is not possible. There is however another gotcha with the webhook for which a replace is an illegal operation as it would remove an already populatedclusterIP
:failed to replace object: Service "elastic-operator-webhook" is invalid: spec.clusterIPs[0]: Invalid value: []string(nil): primary clusterIP can not be unset
. A workaround is to just reapply the manifest. I therefore added a separate manifest with just the CRDs as a download.--force
option to replace withv1
they should be able to follow this with a regularhelm upgrade
of the main chart.v1beta1
tov1
Docs preview
https://cloud-on-k8s_4489.docs-preview.app.elstc.co/diff
Notes on the implementation:
Test scenarios:
helm upgrade
without force