-
Notifications
You must be signed in to change notification settings - Fork 594
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
Add KongIngress types for generated CRDs #1971
Conversation
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 spirit of the change LGTM, but the generated CRDs appear incorrect (spurious apiVersion
and kind
)
config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml
Outdated
Show resolved
Hide resolved
config/crd/bases/configuration.konghq.com_kongclusterplugins.yaml
Outdated
Show resolved
Hide resolved
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.
I don't think we can remove the explicit preseriveUnknownFields
attribute that was previous added, as per https://github.com/Kong/kubernetes-ingress-controller/blob/main/hack/generators/manifests/main.go#L30 has something changed that would make the upgrade succeed?
Nope, didn't know CRD upgrades were weird like that, thought it was just something we'd added via the generate command but didn't need anymore after 0.7 removed that method of setting it. 19f810bb adds annotations instead. |
We need to test manually upgrading these from the old ones from 1.3.x, I believe I tried with the annotation previously and it didn't work. |
Anything in particular we should be looking for? The newly-added annotation is just substituting for what we used to pass as an argument to controller-gen ( I did a basic test configuring a cluster plugin, confirming it worked, overwriting the CRD, and confirming that the CRD apply didn't complain and that the plugin continued working: But I'm not sure what previous breakage was observed/what else I'd need to check. |
If you've verified that the older Ideally we should have an integration or e2e test that deploys the old CRDs, tests resources on them, upgrades to the |
Returning here now that other test stuff has settled. The new This works, though I've since realized that it will break on new major releases (it will try to deploy
The no-LB failure is expected until we release a version with #2005 unless you override the image. The Istio failure is a mystery, but looks unrelated:
|
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.
I'm very glad to see we're adding proper tests for this. I think testing the previous minor release is good, but given the context and assuming that this patch is going to release in v2.1.0
I think we need to add an additional upgrade step so that we're more properly following current users upgrade path, e.g.:
- deploy
v1.3.x
(v1beta1 CRDs) - upgrade to
v2.0.x
(v1 CRDs, first iter) - upgrade to
current
(v1 CRDs, second iter)
In this way all three of our CRD iterations will be covered by the tests.
Additionally we need to support an upgrade workflow where someone skips the first iteration of the v1 CRDs, e.g.:
- deploy
v1.3.x
(v1beta1 CRDs) - upgrade to
v2.1.x
(v1 CRDs, second iter)
Adding these test paths as well will help us cover all our bases.
At a more granular level of the test process itself, It looks like we're currently covering:
- deploy
v1.3.x
with legacy CRDs and deploy and verifyKongIngress
- upgrade to
v2.0.x
with modern CRDs and deploy and verifyKongIngress
It's occurred to me that we should add the following tests as well:
- after upgrade verify that the previously created
Ingress
andKongIngress
are still functioning - update the previously created
Ingress
andKongIngress
resources after upgrade and verify
This may seem superfluous as we would basically expect that if the CRD is working then this would work but when things go wrong with CRDs in production everything grinds to a halt so any additional double checks we can add we should.
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.
As agreed in Zoom, blocking this on the excess TypeMeta fields in configFrom
.
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.
I've done a full review at this point, and I'm largely 👍 for this change. I also wanted to say I appreciate the extra effort to get the kubebuilder validation done right 🥂
My one remaining blocker is due to some uncertainty I feel about the preserveUnknownFields
hack. I feel strongly that we should be doing one if not both of the following related to the preserveUnknownFields: false
field:
- keeping the
preserveUnknownFields: false
hack in for now so that we can separately reason with that and resolve it in a separate more isolated iteration - develop a comprehensive set of E2E tests which can validate upgrading in a variety of scenarios from older to newer releases
I'm worried that we'll inadvertently put the burden of some unforeseen issue on our end-users when we could spend a bit more time up front to be certain, and if needed provide some automation to resolve the issue (e.g. perhaps our own mutating webhook for v1beta1
to v1
upgrades). I also think there's some general value to be gained by having more tests for upgrade paths. I'm willing to contribute directly to such tests, pairing or just regular.
What do expect to learn further about What additional tests would we add? Adding, say, an upgrade from the previous major version would fail here with |
What this PR does / why we need it:
Two commits are unrelated to the main goal of this PR, but they were annoying the hell out of me during testing:
Which issue this PR fixes:
fixes #1778
fixes #1779
Special notes for your reviewer:
Review individual commits, there's a ton of boilerplate and identical fixes repeated ad nauseum in a few of them.
Missing healthcheck validations
This does not create an alias type for upstream healthchecks, which still use the go-kong type directly. This works since the healthcheck struct doesn't include fields we don't want users to set (name, ID, created at, etc.) like the others. This loses some validation that was present in the original CRD, but those validations seem fairly minor (common sense things like "don't set the interval between checks to a negative number").
It further added some fields we'd added in go-kong but never added to the KongIngress schema (and fixed a typo to boot!), so IMO a net win. I'm okay with leaving those minor validations out to reduce the type maintenance burden.
Upstream certificate mysteries
Edit: per the core team, no functional difference. Upstream certificates exist for users that reuse their upstreams and don't want to reconfigure certificates across a bunch of services. Irrelevant for us, since we generate upstreams automatically and do not reuse them across services.
While implementing KongIngressUpstream, I noted that we technically supported client certificates in the struct, but their actual support seems questionable. go-kong uses a complete certificate object (certificate, key, SNIs) here, but the actual admin API expectation is an ID reference to an existing certificate, so I'm unsure if that'd actually work if tried (maybe deck and dbless can handle it formatted that way and generate the reference on your behalf).
We have no mention of support for upstream client certificates in the schema or docs, so my best guess is that it was just there by virtue of the lazy type inclusion. To even try to use it as-was, you'd need to stick the complete raw certificate and key string directly into those fields, since there was no logic to perform a Secret lookup. On the offchance this did work, it'd be quite inadvisable.
Lastly, Services already support their own client certificate annotation, and it does have proper Secret lookup. I'm unsure whether setting a client cert on a service results in any functional difference versus setting it on an upstream, but I can't see where it would--both control the client certificate presented to the upstream application. Asking core team to see if anyone knows.
Ultimately, based on what I know so far, I recommend that we simply leave client certificates out of the new KongIngressUpstream and instruct users to use the Service client-certificate annotation instead.
PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR