forked from gardener/gardener
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eliminate the
Worker
State Reconciler (gardener#8559)
* Generate `machine.sapcloud.io` CRDs based on vendored MCM version The CRDs will be needed in a subsequent commit when adapting the integration test for the `shoot-state` reconciler (we need to deploy the CRDs in the testenv then so that the reconciler can fetch the machine objects). * Drop `MachineClass{Kind,List}` methods from `WorkerDelegate` interface Since a long time, all MCM providers have been migrated to no longer use their specific machine class types (e.g., `AWSMachineClass`) but the generic `MachineClass` type only. Hence, these interface methods are no longer needed. * Clarify extension library version skew * `ShootState` is only persisted after extension resource were migrated Follow-up of gardener@7cd88ad * Move `extensions/pkg/controller/worker/helper.BuildOwnerToMachine{Set}sMap` functions to `pkg/utils/gardener` package They will be reused from other (to-be-introduced) functions in the `pkg/utils/gardener` packages, and we don't want to import the extensions library from there. Hence, let's better move them. * Move machine state computation logic from state reconciler to `pkg/utils/gardener/shootstate` package * Drop worker state reconciler Now `gardenlet` persists the machine state as part of `shootstate.Deploy`. This function is executed after all extension resources were migrated. * Move `machineclass` purpose constant to `constants` package Will be needed in `botanist/migration.go` in a subsequent commit. * Move machine migration logic from generic `Worker` actuator to botanist * Drop `Worker` state when persisting `ShootState` Now that the `gardenlet` persists the machine state explicitly, we do not need to duplicate it via the `Worker` state. * `Worker` restoration uses machine state stored in `.spec.gardener[]` - For backwards-compatibility, we have to keep this flow since the generic `Worker` actuator's `Restore` function expects to find the state in the `Worker`'s `.status.state` field: https://github.com/gardener/gardener/blob/422e2bbedd23351383154bb733838a416f39f2b6/extensions/pkg/controller/worker/genericactuator/actuator_restore.go#L121C1-L141 - This is somewhat dirty for now, but probably acceptable given that this was the flow for the past years. - A subsequent commit will adapt the generic `Worker` actuator to fetch the state from elsewhere, however we have to wait until all provider extensions have been re-vendored with the new logic before we change this here. * Extensions fetch machine state directly from `ShootState` in garden cluster This is to prevent `gardenlet` from duplicating the machine state into the destination seed cluster. * Clean `Worker`'s `.status.state` field after successful reconcile/restore * Address PR review feedback
- Loading branch information
Showing
81 changed files
with
2,670 additions
and
8,408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
example/seed-crds/10-crd-machine.sapcloud.io_machineclasses.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.13.0 | ||
name: machineclasses.machine.sapcloud.io | ||
spec: | ||
group: machine.sapcloud.io | ||
names: | ||
kind: MachineClass | ||
listKind: MachineClassList | ||
plural: machineclasses | ||
shortNames: | ||
- mcc | ||
singular: machineclass | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: MachineClass can be used to templatize and re-use provider configuration | ||
across multiple Machines / MachineSets / MachineDeployments. | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
credentialsSecretRef: | ||
description: CredentialsSecretRef can optionally store the credentials | ||
(in this case the SecretRef does not need to store them). This might | ||
be useful if multiple machine classes with the same credentials but | ||
different user-datas are used. | ||
properties: | ||
name: | ||
description: name is unique within a namespace to reference a secret | ||
resource. | ||
type: string | ||
namespace: | ||
description: namespace defines the space within which the secret name | ||
must be unique. | ||
type: string | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
nodeTemplate: | ||
description: NodeTemplate contains subfields to track all node resources | ||
and other node info required to scale nodegroup from zero | ||
properties: | ||
capacity: | ||
additionalProperties: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
description: Capacity contains subfields to track all node resources | ||
required to scale nodegroup from zero | ||
type: object | ||
instanceType: | ||
description: Instance type of the node belonging to nodeGroup | ||
type: string | ||
region: | ||
description: Region of the expected node belonging to nodeGroup | ||
type: string | ||
zone: | ||
description: Zone of the expected node belonging to nodeGroup | ||
type: string | ||
required: | ||
- capacity | ||
- instanceType | ||
- region | ||
- zone | ||
type: object | ||
x-kubernetes-preserve-unknown-fields: true | ||
provider: | ||
description: Provider is the combination of name and location of cloud-specific | ||
drivers. | ||
type: string | ||
providerSpec: | ||
description: Provider-specific configuration to use during node creation. | ||
type: object | ||
x-kubernetes-preserve-unknown-fields: true | ||
secretRef: | ||
description: SecretRef stores the necessary secrets such as credentials | ||
or userdata. | ||
properties: | ||
name: | ||
description: name is unique within a namespace to reference a secret | ||
resource. | ||
type: string | ||
namespace: | ||
description: namespace defines the space within which the secret name | ||
must be unique. | ||
type: string | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
required: | ||
- providerSpec | ||
type: object | ||
served: true | ||
storage: true |
Oops, something went wrong.