Skip to content

Bump controller runtime to v0.20.4#9744

Merged
eks-distro-bot merged 1 commit intoaws:mainfrom
rajeshvenkata:controller-runtime-v0.20.4
May 23, 2025
Merged

Bump controller runtime to v0.20.4#9744
eks-distro-bot merged 1 commit intoaws:mainfrom
rajeshvenkata:controller-runtime-v0.20.4

Conversation

@rajeshvenkata
Copy link
Copy Markdown
Member

@rajeshvenkata rajeshvenkata commented May 21, 2025

Issue #, if available:
https://github.com/aws/eks-anywhere-internal/issues/3347
Description of changes:

Upgrading controller-runtime from v0.16.5 to v0.20.4

Summary of changes

  • admission.Defaulter/Validator have been deprecated in favor of admission.CustomDefaulter/CustomValidator. check here
    • Updated all webhooks to use Custom defaulter and validator
    • Added the custom validator and defaulter in the webhook manager setup
    • Replaced directives for etcdadm-bootstrap-provider and etcdadm-controller to github.com/rajeshvenkata/etcdadm-bootstrap-provider v1.0.13 and github.com/rajeshvenkata/etcdadm-controller v1.0.20. This is temporary until etcdadm-bootstrap-provider and etcdadm-controller main is updated to use a newer version of cluster-api and thus a new version of controller-runtime.
  • Upgraded forked CAPI from v1.6.0-eksa.2 to v1.9.0-eksa.1 to accomodate new controller-runtime changes
  • New controller-runtime fake client does strict validations now and as a result client.Update is failing in applier_test.go when we are updating the status. Ideally, this should have been patch similar to how we do in main code. To resolve the update issue, introduced a new interface for Patch in client and used it in the unit test to update status. Only unit tests uses this patch.
  • In new controller-runtime version fake client does not support ApplyPatchType. Changed some unit tests to use envtest
  • nit
    • Cleanup: eliminate unnecessary fmt.Sprintf wrapping in fmt.Errorf

Testing (if applicable):
Created a vsphere cluster successfully

2025-05-21T01:08:12.331-0700    V4      Task start      {"task_name": "write-cluster-config"}
2025-05-21T01:08:12.331-0700    V0      Writing cluster config file
2025-05-21T01:08:12.332-0700    V4      Task finished   {"task_name": "write-cluster-config", "duration": "1.087791ms"}
2025-05-21T01:08:12.332-0700    V4      ----------------------------------
2025-05-21T01:08:12.332-0700    V4      Task start      {"task_name": "delete-kind-cluster"}
2025-05-21T01:08:12.332-0700    V0      Deleting bootstrap cluster
2025-05-21T01:08:12.332-0700    V5      Retrier:        {"timeout": "2562047h47m16.854775807s", "backoffFactor": null}
2025-05-21T01:08:12.332-0700    V6      Executing command       {"cmd": "/usr/local/bin/docker exec -i eksa_1747814167793010000 kind get clusters"}
2025-05-21T01:08:12.416-0700    V5      Executed kind get clusters      {"response": "cr-upgrade-test-eks-a-cluster\n"}
2025-05-21T01:08:12.416-0700    V5      Retry execution successful      {"retries": 1, "duration": "84.221791ms"}
2025-05-21T01:08:12.416-0700    V5      Retrier:        {"timeout": "2562047h47m16.854775807s", "backoffFactor": null}
2025-05-21T01:08:12.416-0700    V6      Executing command       {"cmd": "/usr/local/bin/docker exec -i eksa_1747814167793010000 kubectl get customresourcedefinition clusters.cluster.x-k8s.io --kubeconfig cr-upgrade-test/generated/cr-upgrade-test.kind.kubeconfig"}
2025-05-21T01:08:12.519-0700    V5      Retry execution successful      {"retries": 1, "duration": "102.685542ms"}
2025-05-21T01:08:12.519-0700    V5      Retrier:        {"timeout": "2562047h47m16.854775807s", "backoffFactor": null}
2025-05-21T01:08:12.519-0700    V6      Executing command       {"cmd": "/usr/local/bin/docker exec -i eksa_1747814167793010000 kubectl get clusters.cluster.x-k8s.io -o json --kubeconfig cr-upgrade-test/generated/cr-upgrade-test.kind.kubeconfig --namespace eksa-system"}
2025-05-21T01:08:12.610-0700    V5      Retry execution successful      {"retries": 1, "duration": "91.183458ms"}
2025-05-21T01:08:12.610-0700    V5      Retrier:        {"timeout": "2562047h47m16.854775807s", "backoffFactor": null}
2025-05-21T01:08:12.610-0700    V4      Deleting kind cluster   {"name": "cr-upgrade-test-eks-a-cluster"}
2025-05-21T01:08:12.610-0700    V6      Executing command       {"cmd": "/usr/local/bin/docker exec -i eksa_1747814167793010000 kind delete cluster --name cr-upgrade-test-eks-a-cluster"}
2025-05-21T01:08:13.345-0700    V5      Retry execution successful      {"retries": 1, "duration": "734.648917ms"}
2025-05-21T01:08:13.345-0700    V0      🎉 Cluster created!
2025-05-21T01:08:13.345-0700    V4      Task finished   {"task_name": "delete-kind-cluster", "duration": "1.013004291s"}

verified that eksa controller is using lates changes.

 kubectl logs eksa-controller-manager-78bf56595b-dlkl6 -n eksa-system | grep -i "Starting manager"
{"ts":1747814880649.3506,"logger":"setup","caller":"manager/main.go:158","msg":"Starting manager with new controller-runtime-20.4","v":0}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot eks-distro-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 21, 2025
@rajeshvenkata rajeshvenkata force-pushed the controller-runtime-v0.20.4 branch 3 times, most recently from 0c72868 to 1335173 Compare May 22, 2025 09:05
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2025

Codecov Report

Attention: Patch coverage is 82.31612% with 113 lines in your changes missing coverage. Please review.

Project coverage is 69.88%. Comparing base (a637856) to head (094da32).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...nkerbell/capt/v1beta1/tinkerbellmachine_webhook.go 55.55% 12 Missing ⚠️
...nkerbell/capt/v1beta1/tinkerbellcluster_webhook.go 33.33% 10 Missing ⚠️
pkg/clients/kubernetes/client.go 0.00% 10 Missing ⚠️
pkg/controller/clientutil/kubernetes.go 0.00% 10 Missing ⚠️
.../capt/v1beta1/tinkerbellmachinetemplate_webhook.go 62.50% 9 Missing ⚠️
...kg/api/v1alpha1/tinkerbellmachineconfig_webhook.go 81.81% 6 Missing and 2 partials ⚠️
...api/v1alpha1/cloudstackdatacenterconfig_webhook.go 80.64% 6 Missing ⚠️
...api/v1alpha1/tinkerbelldatacenterconfig_webhook.go 79.31% 4 Missing and 2 partials ⚠️
pkg/api/v1alpha1/vspheremachineconfig_webhook.go 86.95% 5 Missing and 1 partial ⚠️
...kg/api/v1alpha1/vspheredatacenterconfig_webhook.go 87.50% 4 Missing and 1 partial ⚠️
... and 13 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9744      +/-   ##
==========================================
+ Coverage   69.86%   69.88%   +0.02%     
==========================================
  Files         672      672              
  Lines       49831    50165     +334     
==========================================
+ Hits        34812    35058     +246     
- Misses      13236    13327      +91     
+ Partials     1783     1780       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rajeshvenkata
Copy link
Copy Markdown
Member Author

/test eks-anywhere-generate-files-presubmit

@rajeshvenkata
Copy link
Copy Markdown
Member Author

/approve

@eks-distro-bot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rajeshvenkata

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rajeshvenkata rajeshvenkata force-pushed the controller-runtime-v0.20.4 branch from 1335173 to 96cf78e Compare May 22, 2025 09:41
@rajeshvenkata
Copy link
Copy Markdown
Member Author

/test eks-anywhere-presubmit
/test eks-anywhere-generate-files-presubmit

@rajeshvenkata rajeshvenkata force-pushed the controller-runtime-v0.20.4 branch from 96cf78e to 094da32 Compare May 23, 2025 01:04
@2ez4szliu
Copy link
Copy Markdown
Member

/lgtm

@eks-distro-bot eks-distro-bot merged commit 39f6fc5 into aws:main May 23, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants