-
Notifications
You must be signed in to change notification settings - Fork 464
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
[controller-manager] Add documentation and integration test for CloudProfile
controller
#6360
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.
/lgtm
test/integration/controllermanager/cloudprofile/cloudprofile_test.go
Outdated
Show resolved
Hide resolved
test/integration/controllermanager/cloudprofile/cloudprofile_test.go
Outdated
Show resolved
Hide resolved
test/integration/controllermanager/cloudprofile/cloudprofile_test.go
Outdated
Show resolved
Hide resolved
/assign |
Specifying a nil config is not a valid thing to do. Otherwise, `AddToManager` would panic. Hence, rather take a zero value config and take care of correctly handling unset fields. This is semantically better, as we can't be sure that the given config struct is a real (i.e. defaulted) object, e.g. in integration tests we don't do defaulting for the config.
// TODO voelzmo - this migration step ensures that all MachineImageVersions in the Cloud Profile contain `docker` in their list of supported Container Runtimes | ||
// This can be removed in a couple of versions. Note that while this is still in here, it is impossible to add an image without `docker` support! | ||
migrationHappened := migrateMachineImageVersionCRISupport(cloudProfile) |
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.
Now that we are removing this defaulting in the controller, we would need to add some validation that the CRI list is not empty (like proposed in #4501), as other controllers like the shoot maintenance controller as expecting the CRI list not to be empty:
gardener/pkg/controllermanager/controller/shoot/shoot_maintenance_control.go
Lines 445 to 450 in a18f881
func findCRIByName(wanted gardencorev1beta1.CRIName, cris []gardencorev1beta1.CRI) (gardencorev1beta1.CRI, bool) { | |
for _, cri := range cris { | |
if cri.Name == wanted { | |
return cri, true | |
} | |
} |
I'm wondering, why this defaulting was not done in API defaulting. I would argue that this was conceptually wrong in the first place.
I think the conceptually correct implementation would be defaulting an empty CRI list to a list that only contains docker
. This was the implicit default before.
However, not specifying docker
in the CRI list is actually not a valid configuration, as gardener still requires docker
to be present on the node, even if containerd
is used, ref #4673.
Hence we should have validation for the CRI list, that docker
is still in there.
This validation can be removed once #4673 is 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.
Long story short, I will drop the cleanup commit from this PR and open an issue with my findings so that we can clean it up in a dedicated PR without mixing up too many things in this PR.
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.
ref #6375
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: timebertt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
CloudProfile
controllerCloudProfile
controller
How to categorize this PR?
/area dev-productivity scalability
/kind enhancement
What this PR does / why we need it:
CloudProfile
controller after it got refactored tocontroller-runtime
with [controller-manager] Introducecontroller-runtime
manager and switchCloudProfile
controller #6333.AddToManager
function into dedicatedadd.go
file (like in [controller-manager] SwitchBastion
controller tocontroller-runtime
and introduce common indexers #6358).Cleanup legacy migration coding from Add migration to Cloud Profile adding docker runtime to all MachineImageVersions #4500➡️ Cleanup CloudProfiledocker
migration #6375Which issue(s) this PR fixes:
Part of #4251
Special notes for your reviewer:
Generally, we want to follow this cookbook while refactoring existing controllers, however we only decided about this after #6333 got merged:
envtest
controller-runtime
Hence, this PR is now adding the left-overs.
Release note: