-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update go to v1.22, controller-runtime dependency to v0.18.2, and kubernetes libs to v0.30.0 #3707
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
Conversation
the controller-runtime strips DeletionTimestamp from manifests on Create(). kubernetes-sigs/controller-runtime#2316
Welcome @larntz! |
Hi @larntz. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@aaroniscode and @oliviassss This is related to pr 3675 and issue 3649. I can't push changes to that PR so I created this one. |
/ok-to-test |
/retest |
@larntz, thanks for the contribution! I'm reviewing this PR. but just notice the e2e test is still failing on this test suite
While I'm checking the code changes, can you try to run the failed test suites locally for a quicker debug? you can try to use ginkgo cmd with
|
@oliviassss yes, I will work on that this evening. |
I was able to test this some. I found on this failing test that two ingresses get created in one namespace and one or both are missing the group ingress finalizer metadata. Not sure yet if that's a symptom or cause of the failing test. I will continue troubleshooting, but wanted to provide an update. |
This was causing e2e tests to fail when an ingress did not have the group finalizer. The unit tests ing-1_been_deleted, and ing-6_been_deleted will need reworked due to changes in the controller-runtime that cause them to fail.
controller-runtime >=0.15 does not support creating (or adding the field via Update()) objects with a DeletionTimestamp. To work around this we add an annotation `unit-test/delete` to mark the ingresses that we want to test deletion. We check for this annotation and then call Delete(). This will set the DeletionTimestamp to the current date and time so we use IgnoreOtherFields to skip then comparing want to got. relevant controller-runtime discussion/pr: - kubernetes-sigs/controller-runtime#2184 (comment) - kubernetes-sigs/controller-runtime#2316
@oliviassss I think this is ready for a more in depth review now. If you need anything else from me let me know. Thanks! |
@larntz, thanks! I left some comments |
pkg/config/runtime_config.go
Outdated
HealthProbeBindAddress: rtCfg.HealthProbeBindAddress, | ||
LeaderElection: rtCfg.EnableLeaderElection, | ||
LeaderElectionResourceLock: resourcelock.ConfigMapsLeasesResourceLock, | ||
LeaderElectionResourceLock: resourcelock.LeasesResourceLock, // resourcelock.ConfigMapsLeasesResourceLock, |
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.
this is a behavior change and shall be noted in PR/release note.
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.
Apologies for this. I had intended to remove that comment and explain why this changed. More detail can be found here, but resourcelock.ConfigMapsLeasesResourceLock
is no longer an option -- it was removed in client-go v0.28.
From the link:
Note: before controller-runtime version v0.7, it was set to "configmaps".
And from v0.7 to v0.11, the default was "configmapsleases", which was
used to migrate from configmaps to leases.
Since the default was "configmapsleases" for over a year, spanning five minor releases,
any actively maintained operators are very likely to have a released version that uses
"configmapsleases". Therefore defaulting to "leases" should be safe since v0.12.
LeaderElectionID: rtCfg.LeaderElectionID, | ||
LeaderElectionNamespace: rtCfg.LeaderElectionNamespace, | ||
Namespace: rtCfg.WatchNamespace, |
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.
this broken original functionality. When rtCfg.WatchNamespace
is not empty, it's supposed to only watch Objects(ingress/service/tgb/pods) in specific namespaces.
in this change, i only saw it's passed to pods informer, but not to other the informers.
We need to test and find a alternative in updated controller runtime. it seems to be https://github.com/kubernetes-sigs/controller-runtime/blob/main/pkg/cache/cache.go#L192, but need code reading and tests to find out
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 am going to do some additional research on this, and will answer asap.
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 believe you are correct on this. I have added DefaultNamespaces
to the cache options.
@larntz
|
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: larntz The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I tested this locally last night but now realize I didn't update the image tag. I'll work on fixing this today. Apologies for the noise. |
If WatchNamespace is set to corev1.NamespaceAll we should not set DefaultNamespaces. This code assumes that only one namespace is specified for WatchNamespace. That decision was based on the help text for the flag `watch-namespace`. Related controller-runtime issue: kubernetes-sigs/controller-runtime#2628
/ok-to-test |
Merging this PR right now. We need to conduct thorough tests on it before shipping it to users. |
…ernetes libs to v0.30.0 (kubernetes-sigs#3707) * go version, dep version * refactor for controller-runtime udpate * update tests, fix if statement the controller-runtime strips DeletionTimestamp from manifests on Create(). kubernetes-sigs/controller-runtime#2316 * refactor tests * remove placeholder comments * remove reconciler from WithOptions * remove DefaultNamespace cache option * remote `&& !hasGroupFinalizer` This was causing e2e tests to fail when an ingress did not have the group finalizer. The unit tests ing-1_been_deleted, and ing-6_been_deleted will need reworked due to changes in the controller-runtime that cause them to fail. * update unit tests for ctrl client/fake >0.15 controller-runtime >=0.15 does not support creating (or adding the field via Update()) objects with a DeletionTimestamp. To work around this we add an annotation `unit-test/delete` to mark the ingresses that we want to test deletion. We check for this annotation and then call Delete(). This will set the DeletionTimestamp to the current date and time so we use IgnoreOtherFields to skip then comparing want to got. relevant controller-runtime discussion/pr: - kubernetes-sigs/controller-runtime#2184 (comment) - kubernetes-sigs/controller-runtime#2316 * remove unused contexts * add DefaultNamespaces cache config * set opt.Cache.DefaultNamespaces conditionally If WatchNamespace is set to corev1.NamespaceAll we should not set DefaultNamespaces. This code assumes that only one namespace is specified for WatchNamespace. That decision was based on the help text for the flag `watch-namespace`. Related controller-runtime issue: kubernetes-sigs/controller-runtime#2628 * make crds * set go to v1.22.3
* update the traffic test for ingress (#3725) * update the traffic test for ingress * make crds * prevent controller runtime complaining about SetupLogger() was never called (#3724) * Update go to v1.22, controller-runtime dependency to v0.18.2, and kubernetes libs to v0.30.0 (#3707) * go version, dep version * refactor for controller-runtime udpate * update tests, fix if statement the controller-runtime strips DeletionTimestamp from manifests on Create(). kubernetes-sigs/controller-runtime#2316 * refactor tests * remove placeholder comments * remove reconciler from WithOptions * remove DefaultNamespace cache option * remote `&& !hasGroupFinalizer` This was causing e2e tests to fail when an ingress did not have the group finalizer. The unit tests ing-1_been_deleted, and ing-6_been_deleted will need reworked due to changes in the controller-runtime that cause them to fail. * update unit tests for ctrl client/fake >0.15 controller-runtime >=0.15 does not support creating (or adding the field via Update()) objects with a DeletionTimestamp. To work around this we add an annotation `unit-test/delete` to mark the ingresses that we want to test deletion. We check for this annotation and then call Delete(). This will set the DeletionTimestamp to the current date and time so we use IgnoreOtherFields to skip then comparing want to got. relevant controller-runtime discussion/pr: - kubernetes-sigs/controller-runtime#2184 (comment) - kubernetes-sigs/controller-runtime#2316 * remove unused contexts * add DefaultNamespaces cache config * set opt.Cache.DefaultNamespaces conditionally If WatchNamespace is set to corev1.NamespaceAll we should not set DefaultNamespaces. This code assumes that only one namespace is specified for WatchNamespace. That decision was based on the help text for the flag `watch-namespace`. Related controller-runtime issue: kubernetes-sigs/controller-runtime#2628 * make crds * set go to v1.22.3 * restrict resolve resolveViaVPCENIs to fargate only (#3709) * Added helm envFrom value parameter for cluster-name (#3683) * Added helm envFrom value parameter for cluster-name * Update README.md file * Add envFrom configuration to values.yaml * Remove empty line in values.yaml * feat: disable default helm labels (#3574) * feat: disable helm labels * fix: doc * Update README.md (#3638) Remove extra / in crds --------- Co-authored-by: Luke Arntz <[email protected]> Co-authored-by: Omer Aplatony <[email protected]> Co-authored-by: Rémi BUISSON <[email protected]> Co-authored-by: Mike Wilson <[email protected]>
Issue
#3649
Description
There is a similar pr open for the kubernetes libs, but there haven't been any updates in a few weeks.
In the comments of that pr there is a comment:
This PR is to address the k8s 1.29 dependency updates and refactoring required (the bulk of the changes) to update the controller runtime to v0.15+. Also sets the go version 1.22.
Two tests were removed that were related to decoder injection that is no longer possible in new versions of controller runtime. Two other tests were removed that checked ingresses were deleted there was a deletion timestamp with no finalizer. This is no longer possible because controller-runtime sets the DeletionTimestamp to nil on Create(). Because of this the DeletionTimestamps were also removed from the deleted ingress with finalizer tests.
Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯