migrate mcm-provider from openstack to stackit - #272
aniruddha2000 wants to merge 29 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
67e72b1 to
dcf82cb
Compare
b696375 to
25fa93d
Compare
|
/retest-required |
|
/retest |
3 similar comments
|
/retest |
|
/retest |
|
/retest |
|
/test pull-gardener-extension-provider-stackit-dev-artifacts |
|
/test all |
81f51f4 to
af6bcea
Compare
|
/test pull-gardener-extension-provider-stackit-integration-tests |
# Conflicts: # pkg/controller/worker/machines.go
b636923 to
a712745
Compare
stackit-ske-bot
left a comment
There was a problem hiding this comment.
SKE Code Review
Architectural Feedback
- Inverted Migration Transaction Flow & Redundant Patch Overhead: In pkg/controller/worker/machines.go#L456-L499, each machine undergoes three separate Kubernetes API
Patchcalls (shouldMigrateMachineAnnotation+migratedMachineAnnotation, thenSpec.ProviderID, then removingshouldMigrateMachineAnnotation). This transaction complexity and ephemeral annotation were introduced becauseSpec.ProviderIDis updated in Kubernetes before confirming that the STACKIT IaaSUpdateServercall succeeded. Reversing the sequence—executingUpdateServer(an idempotent operation) on STACKIT IaaS first, and then executing a single atomic KubernetesPatchupdating bothSpec.ProviderIDandmigratedMachineAnnotation—eliminates the ephemeralshouldMigrateMachineAnnotation, reduces Kubernetes API patch traffic by 66% during node migrations, and avoids leaving machine resources in a state whereSpec.ProviderIDpoints to STACKIT while the remote server labels were never updated. - Unconditional IaaS Client Initialization in
WorkerDelegate: In pkg/controller/worker/actuator.go#L76-L80,stackitClient.IaaS(ctx, d.seedClient, worker.Spec.SecretRef)is called unconditionally on every Worker reconciliation. Becausew.iaaSClientis exclusively used bymigrateMachines(which only executes whenfeature.MigrateStackitMachineControllerManager(cluster)is enabled and the worker has not yet migrated), Shoot clusters that do not use MCM migration or OpenStack clusters whose secret lacks STACKIT service account credentials (saKeyJSON) will fail secret credential parsing instackit.GetCredentialsFromSecretRef, breaking Worker reconciliation. The IaaS client should only be instantiated whenfeature.MigrateStackitMachineControllerManager(cluster) && worker.Annotations[workerMigratedAnnotation] != "true", or lazily on demand insidemigrateMachines.
Findings & Feedback
All findings and concrete recommendations have been provided as inline code suggestions above.
Verdict
Comment
| // It is okay to skip machine without a provider ID, as there is a fallback to get | ||
| // the server by name in case there is no providerID during deletion by the MCM. | ||
| // Normally this is done with a label containing the machine name and a label selector. | ||
| // In case of a migrated machine with the stackit.cloud/migrated-machine annotation the deletion needs |
There was a problem hiding this comment.
this is wrong, since we have no provider id, we cannot update the labels.
in case the provider id is missing, we will fetch all servers and filter by name
| } | ||
| // This annotation is deleted when the server is updated, otherwise its incomplete migrated machine. | ||
| m.Annotations[shouldMigrateMachineAnnotation] = "true" | ||
| // The MCM needs to get and delete the NICs of the machine, as they were created separately which needs dedicated deletion |
There was a problem hiding this comment.
| // The MCM needs to get and delete the NICs of the machine, as they were created separately which needs dedicated deletion | |
| // The MCM needs to get and delete the NICs of the machine, as they were created separately which needs dedicated deletion. The MCM used this annotation as a marker for the said NIC cleanup. |
How to categorize this PR?
/kind enhancement
What this PR does / why we need it:
This PR replaces mcm provider from openstack to stackit. Replaces openstack provider ID with stackit provider ID and add
stackit.cloud/migrated-machine: trueannotation to machines and puts annotationstackit.cloud/machine-controller-manager-migrated: trueto workers once the migration is done.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Breaking changes: