diff --git a/example/30-infrastructure.yaml b/example/30-infrastructure.yaml
index 3b26da1..ae7cfda 100644
--- a/example/30-infrastructure.yaml
+++ b/example/30-infrastructure.yaml
@@ -51,8 +51,3 @@ spec:
providerConfig:
apiVersion: metal.provider.extensions.gardener.cloud/v1alpha1
kind: InfrastructureConfig
- worker:
- WORKER_POOL_NAME:
- extraIgnition:
- raw: "the-ignition"
- # override: true
diff --git a/example/30-worker.yaml b/example/30-worker.yaml
index 83ae40f..eaafde7 100644
--- a/example/30-worker.yaml
+++ b/example/30-worker.yaml
@@ -93,3 +93,11 @@ spec:
zones:
- my-machine-pool-a
- my-machine-pool-b
+ providerConfig:
+ apiVersion: metal.provider.extensions.gardener.cloud/v1alpha1
+ kind: WorkerConfig
+ extraIgnition:
+ raw: "the-ignition"
+ # override: true
+ serverLabels:
+ foo: bar
diff --git a/hack/api-reference/api.md b/hack/api-reference/api.md
index 7039e87..0718ca4 100644
--- a/hack/api-reference/api.md
+++ b/hack/api-reference/api.md
@@ -13,8 +13,6 @@ Resource Types:
CloudProfileConfig
ControlPlaneConfig
-
-IgnitionConfig
@@ -148,67 +146,6 @@ LoadBalancerConfig
-
-
-(Appears on:
-WorkerConfig)
-
-
-
IgnitionConfig contains ignition settings.
-
-
-
-
-Field |
-Description |
-
-
-
-
-
-apiVersion
-string |
-
-
-metal.provider.extensions.gardener.cloud/v1alpha1
-
- |
-
-
-
-kind
-string
- |
-IgnitionConfig |
-
-
-
-raw
-
-string
-
- |
-
-(Optional)
- Raw contains an inline ignition config, which is merged with the config from the os extension.
- |
-
-
-
-override
-
-bool
-
- |
-
-(Optional)
- Override configures, if ignition keys set by the os-extension are overridden
-by extra ignition.
- |
-
-
-
@@ -373,10 +310,14 @@ map[string]bool
-
-
InfrastructureConfig infrastructure configuration resource
+(Appears on:
+WorkerConfig)
+
+
+
IgnitionConfig contains ignition settings.
@@ -388,20 +329,46 @@ map[string]bool
-worker
+raw
-
-map[string]./pkg/apis/metal/v1alpha1.WorkerConfig
-
+string
|
(Optional)
- Worker contains settings per worker pool specific to the metal-operator
+Raw contains an inline ignition config, which is merged with the config from the os extension.
+ |
+
+
+
+override
+
+bool
+
+ |
+
+(Optional)
+ Override configures, if ignition keys set by the os-extension are overridden
+by extra ignition.
|
+InfrastructureConfig
+
+
+
InfrastructureConfig infrastructure configuration resource
+
+
+
+
+Field |
+Description |
+
+
+
+
+
InfrastructureStatus
@@ -772,11 +739,7 @@ string
WorkerConfig
-(Appears on:
-InfrastructureConfig)
-
-
-
WorkerConfig contains settings per pool, which are specific to the metal-operator.
+WorkerConfig contains configuration settings for the worker nodes.
@@ -797,7 +760,19 @@ IgnitionConfig
(Optional)
- ExtraIgnition contains additional ignition configuration.
+ExtraIgnition contains additional Ignition for Worker nodes.
+ |
+
+
+
+extraServerLabels
+
+map[string]string
+
+ |
+
+(Optional)
+ ExtraServerLabels is a map of additional labels that are applied to the ServerClaim for Server selection.
|
diff --git a/pkg/apis/metal/register.go b/pkg/apis/metal/register.go
index ccefc8c..97b8436 100644
--- a/pkg/apis/metal/register.go
+++ b/pkg/apis/metal/register.go
@@ -38,6 +38,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&InfrastructureConfig{},
&InfrastructureStatus{},
&ControlPlaneConfig{},
+ &WorkerConfig{},
&WorkerStatus{},
)
return nil
diff --git a/pkg/apis/metal/types_infrastructure.go b/pkg/apis/metal/types_infrastructure.go
index d068e03..b19e1ac 100644
--- a/pkg/apis/metal/types_infrastructure.go
+++ b/pkg/apis/metal/types_infrastructure.go
@@ -8,24 +8,11 @@ import (
)
// +genclient
-
-// IgnitionConfig contains ignition settings.
-type IgnitionConfig struct {
- Raw string
- Override bool
-}
-
-// WorkerConfig contains settings per pool, which are specific to the metal-operator.
-type WorkerConfig struct {
- ExtraIgnition *IgnitionConfig
-}
-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// InfrastructureConfig infrastructure configuration resource
type InfrastructureConfig struct {
metav1.TypeMeta
- Worker map[string]WorkerConfig
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/pkg/apis/metal/types_worker.go b/pkg/apis/metal/types_worker.go
index 86d6df4..d3bd919 100644
--- a/pkg/apis/metal/types_worker.go
+++ b/pkg/apis/metal/types_worker.go
@@ -10,6 +10,17 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// WorkerConfig contains configuration settings for the worker nodes.
+type WorkerConfig struct {
+ metav1.TypeMeta
+ // ExtraIgnition contains additional Ignition for Worker nodes.
+ ExtraIgnition *IgnitionConfig
+ // ExtraServerLabels is a map of extra labels that are applied to the ServerClaim for Server selection.
+ ExtraServerLabels map[string]string
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
// WorkerStatus contains information about created worker resources.
type WorkerStatus struct {
metav1.TypeMeta
@@ -33,3 +44,9 @@ type MachineImage struct {
// Architecture is the CPU architecture of the machine image.
Architecture *string
}
+
+// IgnitionConfig contains ignition settings.
+type IgnitionConfig struct {
+ Raw string
+ Override bool
+}
diff --git a/pkg/apis/metal/v1alpha1/register.go b/pkg/apis/metal/v1alpha1/register.go
index 270d3cc..f1ad0bf 100644
--- a/pkg/apis/metal/v1alpha1/register.go
+++ b/pkg/apis/metal/v1alpha1/register.go
@@ -32,6 +32,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&InfrastructureConfig{},
&InfrastructureStatus{},
&ControlPlaneConfig{},
+ &WorkerConfig{},
&WorkerStatus{},
)
return nil
diff --git a/pkg/apis/metal/v1alpha1/types_infrastructure.go b/pkg/apis/metal/v1alpha1/types_infrastructure.go
index a97247b..65f87fb 100644
--- a/pkg/apis/metal/v1alpha1/types_infrastructure.go
+++ b/pkg/apis/metal/v1alpha1/types_infrastructure.go
@@ -9,34 +9,11 @@ import (
// +genclient
-// IgnitionConfig contains ignition settings.
-type IgnitionConfig struct {
- // Raw contains an inline ignition config, which is merged with the config from the os extension.
- // +optional
- Raw string `json:"raw,omitempty"`
-
- // Override configures, if ignition keys set by the os-extension are overridden
- // by extra ignition.
- // +optional
- Override bool `json:"override,omitempty"`
-}
-
-// WorkerConfig contains settings per pool, which are specific to the metal-operator.
-type WorkerConfig struct {
- // ExtraIgnition contains additional ignition configuration.
- // +optional
- ExtraIgnition *IgnitionConfig `json:"extraIgnition,omitempty"`
-}
-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// InfrastructureConfig infrastructure configuration resource
type InfrastructureConfig struct {
metav1.TypeMeta `json:",inline"`
-
- // Worker contains settings per worker pool specific to the metal-operator
- // +optional
- Worker map[string]WorkerConfig `json:"worker,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/pkg/apis/metal/v1alpha1/types_worker.go b/pkg/apis/metal/v1alpha1/types_worker.go
index 577aa68..b7711b3 100644
--- a/pkg/apis/metal/v1alpha1/types_worker.go
+++ b/pkg/apis/metal/v1alpha1/types_worker.go
@@ -9,6 +9,19 @@ import (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// WorkerConfig contains configuration settings for the worker nodes.
+type WorkerConfig struct {
+ metav1.TypeMeta
+ // ExtraIgnition contains additional Ignition for Worker nodes.
+ // +optional
+ ExtraIgnition *IgnitionConfig `json:"extraIgnition,omitempty"`
+ // ExtraServerLabels is a map of additional labels that are applied to the ServerClaim for Server selection.
+ // +optional
+ ExtraServerLabels map[string]string `json:"extraServerLabels,omitempty"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
// WorkerStatus contains information about created worker resources.
type WorkerStatus struct {
metav1.TypeMeta `json:",inline"`
@@ -34,3 +47,15 @@ type MachineImage struct {
// +optional
Architecture *string `json:"architecture,omitempty"`
}
+
+// IgnitionConfig contains ignition settings.
+type IgnitionConfig struct {
+ // Raw contains an inline ignition config, which is merged with the config from the os extension.
+ // +optional
+ Raw string `json:"raw,omitempty"`
+
+ // Override configures, if ignition keys set by the os-extension are overridden
+ // by extra ignition.
+ // +optional
+ Override bool `json:"override,omitempty"`
+}
diff --git a/pkg/apis/metal/v1alpha1/zz_generated.conversion.go b/pkg/apis/metal/v1alpha1/zz_generated.conversion.go
index 25e8d4e..f5b56c3 100644
--- a/pkg/apis/metal/v1alpha1/zz_generated.conversion.go
+++ b/pkg/apis/metal/v1alpha1/zz_generated.conversion.go
@@ -337,7 +337,6 @@ func Convert_metal_IgnitionConfig_To_v1alpha1_IgnitionConfig(in *metal.IgnitionC
}
func autoConvert_v1alpha1_InfrastructureConfig_To_metal_InfrastructureConfig(in *InfrastructureConfig, out *metal.InfrastructureConfig, s conversion.Scope) error {
- out.Worker = *(*map[string]metal.WorkerConfig)(unsafe.Pointer(&in.Worker))
return nil
}
@@ -347,7 +346,6 @@ func Convert_v1alpha1_InfrastructureConfig_To_metal_InfrastructureConfig(in *Inf
}
func autoConvert_metal_InfrastructureConfig_To_v1alpha1_InfrastructureConfig(in *metal.InfrastructureConfig, out *InfrastructureConfig, s conversion.Scope) error {
- out.Worker = *(*map[string]WorkerConfig)(unsafe.Pointer(&in.Worker))
return nil
}
@@ -540,6 +538,7 @@ func Convert_metal_RegionConfig_To_v1alpha1_RegionConfig(in *metal.RegionConfig,
func autoConvert_v1alpha1_WorkerConfig_To_metal_WorkerConfig(in *WorkerConfig, out *metal.WorkerConfig, s conversion.Scope) error {
out.ExtraIgnition = (*metal.IgnitionConfig)(unsafe.Pointer(in.ExtraIgnition))
+ out.ExtraServerLabels = *(*map[string]string)(unsafe.Pointer(&in.ExtraServerLabels))
return nil
}
@@ -550,6 +549,7 @@ func Convert_v1alpha1_WorkerConfig_To_metal_WorkerConfig(in *WorkerConfig, out *
func autoConvert_metal_WorkerConfig_To_v1alpha1_WorkerConfig(in *metal.WorkerConfig, out *WorkerConfig, s conversion.Scope) error {
out.ExtraIgnition = (*IgnitionConfig)(unsafe.Pointer(in.ExtraIgnition))
+ out.ExtraServerLabels = *(*map[string]string)(unsafe.Pointer(&in.ExtraServerLabels))
return nil
}
diff --git a/pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go
index 03fd4ee..63e5e01 100644
--- a/pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go
@@ -188,13 +188,6 @@ func (in *IgnitionConfig) DeepCopy() *IgnitionConfig {
func (in *InfrastructureConfig) DeepCopyInto(out *InfrastructureConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
- if in.Worker != nil {
- in, out := &in.Worker, &out.Worker
- *out = make(map[string]WorkerConfig, len(*in))
- for key, val := range *in {
- (*out)[key] = *val.DeepCopy()
- }
- }
return
}
@@ -400,11 +393,19 @@ func (in *RegionConfig) DeepCopy() *RegionConfig {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkerConfig) DeepCopyInto(out *WorkerConfig) {
*out = *in
+ out.TypeMeta = in.TypeMeta
if in.ExtraIgnition != nil {
in, out := &in.ExtraIgnition, &out.ExtraIgnition
*out = new(IgnitionConfig)
**out = **in
}
+ if in.ExtraServerLabels != nil {
+ in, out := &in.ExtraServerLabels, &out.ExtraServerLabels
+ *out = make(map[string]string, len(*in))
+ for key, val := range *in {
+ (*out)[key] = val
+ }
+ }
return
}
@@ -418,6 +419,14 @@ func (in *WorkerConfig) DeepCopy() *WorkerConfig {
return out
}
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *WorkerConfig) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkerStatus) DeepCopyInto(out *WorkerStatus) {
*out = *in
diff --git a/pkg/apis/metal/zz_generated.deepcopy.go b/pkg/apis/metal/zz_generated.deepcopy.go
index bed9c79..4798ad3 100644
--- a/pkg/apis/metal/zz_generated.deepcopy.go
+++ b/pkg/apis/metal/zz_generated.deepcopy.go
@@ -188,13 +188,6 @@ func (in *IgnitionConfig) DeepCopy() *IgnitionConfig {
func (in *InfrastructureConfig) DeepCopyInto(out *InfrastructureConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
- if in.Worker != nil {
- in, out := &in.Worker, &out.Worker
- *out = make(map[string]WorkerConfig, len(*in))
- for key, val := range *in {
- (*out)[key] = *val.DeepCopy()
- }
- }
return
}
@@ -400,11 +393,19 @@ func (in *RegionConfig) DeepCopy() *RegionConfig {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkerConfig) DeepCopyInto(out *WorkerConfig) {
*out = *in
+ out.TypeMeta = in.TypeMeta
if in.ExtraIgnition != nil {
in, out := &in.ExtraIgnition, &out.ExtraIgnition
*out = new(IgnitionConfig)
**out = **in
}
+ if in.ExtraServerLabels != nil {
+ in, out := &in.ExtraServerLabels, &out.ExtraServerLabels
+ *out = make(map[string]string, len(*in))
+ for key, val := range *in {
+ (*out)[key] = val
+ }
+ }
return
}
@@ -418,6 +419,14 @@ func (in *WorkerConfig) DeepCopy() *WorkerConfig {
return out
}
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *WorkerConfig) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkerStatus) DeepCopyInto(out *WorkerStatus) {
*out = *in
diff --git a/pkg/controller/worker/actuator.go b/pkg/controller/worker/actuator.go
index 7a54b5e..37a96ef 100644
--- a/pkg/controller/worker/actuator.go
+++ b/pkg/controller/worker/actuator.go
@@ -5,7 +5,6 @@ package worker
import (
"context"
- "fmt"
extensionscontroller "github.com/gardener/gardener/extensions/pkg/controller"
"github.com/gardener/gardener/extensions/pkg/controller/worker"
@@ -84,15 +83,6 @@ type workerDelegate struct {
worker *extensionsv1alpha1.Worker
}
-func (w *workerDelegate) getServerLabelsForMachineType(machineType string) (map[string]string, error) {
- for _, t := range w.cloudProfileConfig.MachineTypes {
- if t.Name == machineType {
- return t.ServerLabels, nil
- }
- }
- return nil, fmt.Errorf("no machine type %s found", machineType)
-}
-
// NewWorkerDelegate creates a new context for a worker reconciliation.
func NewWorkerDelegate(
client client.Client,
diff --git a/pkg/controller/worker/machines.go b/pkg/controller/worker/machines.go
index 86c9672..d9f77ff 100644
--- a/pkg/controller/worker/machines.go
+++ b/pkg/controller/worker/machines.go
@@ -85,16 +85,19 @@ func (w *workerDelegate) GenerateMachineDeployments(ctx context.Context) (worker
func (w *workerDelegate) generateMachineClassAndSecrets(ctx context.Context) ([]*machinecontrollerv1alpha1.MachineClass, []*corev1.Secret, error) {
var (
- machineClasses []*machinecontrollerv1alpha1.MachineClass
- machineClassSecrets []*corev1.Secret
- infrastructureConfig metalv1alpha1.InfrastructureConfig
+ machineClasses []*machinecontrollerv1alpha1.MachineClass
+ machineClassSecrets []*corev1.Secret
)
- err := json.Unmarshal(w.cluster.Shoot.Spec.Provider.InfrastructureConfig.Raw, &infrastructureConfig)
- if err != nil {
- return nil, nil, fmt.Errorf("failed to unmarshal infrastructure config: %w", err)
- }
for _, pool := range w.worker.Spec.Pools {
+
+ workerConfig := &metalv1alpha1.WorkerConfig{}
+ if pool.ProviderConfig != nil && pool.ProviderConfig.Raw != nil {
+ if _, _, err := w.decoder.Decode(pool.ProviderConfig.Raw, nil, workerConfig); err != nil {
+ return nil, nil, fmt.Errorf("could not decode provider config: %+v", err)
+ }
+ }
+
workerPoolHash, err := w.generateHashForWorkerPool(pool)
if err != nil {
return nil, nil, fmt.Errorf("failed to generate hash for worker pool %s: %w", pool.Name, err)
@@ -106,7 +109,7 @@ func (w *workerDelegate) generateMachineClassAndSecrets(ctx context.Context) ([]
return nil, nil, err
}
- serverLabels, err := w.getServerLabelsForMachineType(pool.MachineType)
+ serverLabels, err := w.getServerLabelsForMachine(pool.MachineType, workerConfig)
if err != nil {
return nil, nil, err
}
@@ -115,10 +118,9 @@ func (w *workerDelegate) generateMachineClassAndSecrets(ctx context.Context) ([]
metal.ImageFieldName: machineImage,
metal.ServerLabelsFieldName: serverLabels,
}
- metalConfig, ok := infrastructureConfig.Worker[pool.Name]
- if ok && metalConfig.ExtraIgnition != nil {
- machineClassProviderSpec[metal.IgnitionFieldName] = metalConfig.ExtraIgnition.Raw
- machineClassProviderSpec[metal.IgnitionOverrideFieldName] = metalConfig.ExtraIgnition.Override
+ if workerConfig.ExtraIgnition != nil {
+ machineClassProviderSpec[metal.IgnitionFieldName] = workerConfig.ExtraIgnition.Raw
+ machineClassProviderSpec[metal.IgnitionOverrideFieldName] = workerConfig.ExtraIgnition.Override
}
for zoneIndex, zone := range pool.Zones {
@@ -206,3 +208,22 @@ func (w *workerDelegate) generateHashForWorkerPool(pool v1alpha1.WorkerPool) (st
// Generate the worker pool hash.
return worker.WorkerPoolHash(pool, w.cluster, nil, nil)
}
+
+func (w *workerDelegate) getServerLabelsForMachine(machineType string, workerConfig *metalv1alpha1.WorkerConfig) (map[string]string, error) {
+ combinedLabels := make(map[string]string)
+ for _, t := range w.cloudProfileConfig.MachineTypes {
+ if t.Name == machineType {
+ for key, value := range t.ServerLabels {
+ combinedLabels[key] = value
+ }
+ break
+ }
+ }
+ for key, value := range workerConfig.ExtraServerLabels {
+ combinedLabels[key] = value
+ }
+ if len(combinedLabels) == 0 {
+ return nil, fmt.Errorf("no server labels found for machine type %s or worker config", machineType)
+ }
+ return combinedLabels, nil
+}
diff --git a/pkg/controller/worker/machines_test.go b/pkg/controller/worker/machines_test.go
index ac9d09f..894ea7b 100644
--- a/pkg/controller/worker/machines_test.go
+++ b/pkg/controller/worker/machines_test.go
@@ -19,7 +19,6 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer"
. "sigs.k8s.io/controller-runtime/pkg/envtest/komega"
- metalv1alpha1 "github.com/ironcore-dev/gardener-extension-provider-metal/pkg/apis/metal/v1alpha1"
"github.com/ironcore-dev/gardener-extension-provider-metal/pkg/metal"
)
@@ -54,7 +53,6 @@ var _ = Describe("Machines", func() {
Name: className,
},
}
-
By("deploying the machine class for a given multi zone cluster")
decoder := serializer.NewCodecFactory(k8sClient.Scheme(), serializer.EnableStrict).UniversalDecoder()
workerDelegate, err = NewWorkerDelegate(k8sClient, decoder, k8sClient.Scheme(), "", w, testCluster)
@@ -68,63 +66,6 @@ var _ = Describe("Machines", func() {
It("should create the expected machine class for a multi zone cluster", func(ctx SpecContext) {
Expect(workerDelegate.DeployMachineClasses(ctx)).To(Succeed())
-
- By("ensuring that the machine class for each pool has been deployed")
- machineClassProviderSpec := map[string]any{
- "image": "registry/my-os",
- "labels": map[string]any{
- metal.ClusterNameLabel: testCluster.ObjectMeta.Name,
- },
- "serverLabels": map[string]string{
- "foo": "bar",
- },
- }
-
- Eventually(Object(machineClass)).Should(SatisfyAll(
- HaveField("CredentialsSecretRef", &corev1.SecretReference{
- Namespace: w.Spec.SecretRef.Namespace,
- Name: w.Spec.SecretRef.Name,
- }),
- HaveField("SecretRef", &corev1.SecretReference{
- Namespace: ns.Name,
- Name: className,
- }),
- HaveField("Provider", "metal"),
- HaveField("NodeTemplate", &machinecontrollerv1alpha1.NodeTemplate{
- Capacity: pool.NodeTemplate.Capacity,
- InstanceType: pool.MachineType,
- Region: w.Spec.Region,
- Zone: "zone1",
- }),
- HaveField("ProviderSpec", runtime.RawExtension{
- Raw: encodeMap(machineClassProviderSpec),
- }),
- ))
-
- By("ensuring that the machine class secret have been applied")
-
- Eventually(Object(machineClassSecret)).Should(SatisfyAll(
- HaveField("ObjectMeta.Labels", HaveKeyWithValue(v1beta1constants.GardenerPurpose, v1beta1constants.GardenPurposeMachineClass)),
- HaveField("Data", HaveKeyWithValue("userData", []byte("some-data"))),
- ))
- })
-
- It("should forward ignition configuration", func(ctx SpecContext) {
- infrastructureConfig := metalv1alpha1.InfrastructureConfig{
- Worker: map[string]metalv1alpha1.WorkerConfig{
- pool.Name: {
- ExtraIgnition: &metalv1alpha1.IgnitionConfig{
- Raw: "abc",
- Override: true,
- },
- },
- },
- }
- infraJSON, err := json.Marshal(infrastructureConfig)
- Expect(err).To(Succeed())
- testCluster.Shoot.Spec.Provider.InfrastructureConfig.Raw = infraJSON
- Expect(workerDelegate.DeployMachineClasses(ctx)).To(Succeed())
-
By("ensuring that the machine class for each pool has been deployed")
machineClassProviderSpec := map[string]any{
"image": "registry/my-os",
@@ -132,7 +73,8 @@ var _ = Describe("Machines", func() {
metal.ClusterNameLabel: testCluster.ObjectMeta.Name,
},
metal.ServerLabelsFieldName: map[string]string{
- "foo": "bar",
+ "foo": "bar",
+ "foo1": "bar1",
},
metal.IgnitionFieldName: "abc",
metal.IgnitionOverrideFieldName: true,
@@ -166,7 +108,6 @@ var _ = Describe("Machines", func() {
HaveField("Data", HaveKeyWithValue("userData", []byte("some-data"))),
))
})
-
})
It("should generate the machine deployments", func(ctx SpecContext) {
diff --git a/pkg/controller/worker/suite_test.go b/pkg/controller/worker/suite_test.go
index 6d7e0c9..310c842 100644
--- a/pkg/controller/worker/suite_test.go
+++ b/pkg/controller/worker/suite_test.go
@@ -60,6 +60,9 @@ var (
testCluster *extensionscontroller.Cluster
cloudProfileConfigJSON []byte
+ workerConfig *apiv1alpha1.WorkerConfig
+ workerConfigJSON []byte
+
w *gardenerextensionv1alpha1.Worker
)
@@ -129,6 +132,17 @@ func SetupTest() (*corev1.Namespace, *gardener.ChartApplier) {
volumeName := "test-volume"
volumeType := "fast"
+ workerConfig = &apiv1alpha1.WorkerConfig{
+ ExtraServerLabels: map[string]string{
+ "foo1": "bar1",
+ },
+ ExtraIgnition: &apiv1alpha1.IgnitionConfig{
+ Raw: "abc",
+ Override: true,
+ },
+ }
+ workerConfigJSON, _ = json.Marshal(workerConfig)
+
// define test resources
pool = gardenerextensionv1alpha1.WorkerPool{
MachineType: "large",
@@ -156,6 +170,9 @@ func SetupTest() (*corev1.Namespace, *gardener.ChartApplier) {
corev1.ResourceCPU: resource.MustParse("100m"),
},
},
+ ProviderConfig: &runtime.RawExtension{
+ Raw: workerConfigJSON,
+ },
}
cloudProfileConfig = &apiv1alpha1.CloudProfileConfig{
TypeMeta: metav1.TypeMeta{