diff --git a/charts/internal/machineclass/templates/machineclass.yaml b/charts/internal/machineclass/templates/machineclass.yaml index bcd77d3d4..be6e1e46e 100644 --- a/charts/internal/machineclass/templates/machineclass.yaml +++ b/charts/internal/machineclass/templates/machineclass.yaml @@ -24,6 +24,7 @@ metadata: {{- end }} {{- if $machineClass.nodeTemplate }} nodeTemplate: + architecture: {{$machineClass.nodeTemplate.architecture}} capacity: {{ toYaml $machineClass.nodeTemplate.capacity | indent 4 }} instanceType: {{ $machineClass.nodeTemplate.instanceType }} diff --git a/charts/internal/machineclass/values.yaml b/charts/internal/machineclass/values.yaml index 1324cee0d..f14afcea2 100644 --- a/charts/internal/machineclass/values.yaml +++ b/charts/internal/machineclass/values.yaml @@ -6,6 +6,7 @@ machineClasses: region: eu-west-1 machineType: m4.xlarge nodeTemplate: + architecture: amd64 capacity: cpu: 4 gpu: 0 diff --git a/go.mod b/go.mod index 55260f957..14a690f7f 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,8 @@ require ( github.com/coreos/go-systemd/v22 v22.5.0 github.com/gardener/etcd-druid v0.21.0 github.com/gardener/gardener v1.85.1 - github.com/gardener/machine-controller-manager v0.50.0 - github.com/go-logr/logr v1.2.4 + github.com/gardener/machine-controller-manager v0.52.0 + github.com/go-logr/logr v1.3.0 github.com/onsi/ginkgo/v2 v2.13.0 github.com/onsi/gomega v1.29.0 github.com/spf13/cobra v1.7.0 @@ -20,7 +20,7 @@ require ( go.uber.org/mock v0.2.0 golang.org/x/exp v0.0.0-20230321023759-10a507213a29 golang.org/x/time v0.3.0 - golang.org/x/tools v0.13.0 + golang.org/x/tools v0.14.0 k8s.io/api v0.28.3 k8s.io/apiextensions-apiserver v0.28.3 k8s.io/apimachinery v0.28.3 @@ -109,10 +109,10 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/mod v0.12.0 // indirect + golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 874331a23..c078380a0 100644 --- a/go.sum +++ b/go.sum @@ -142,8 +142,8 @@ github.com/gardener/gardener v1.85.1 h1:LIoYXtQc0aZjwEp/chbbVD0Fijjof8fa0VqIiyXE github.com/gardener/gardener v1.85.1/go.mod h1:8eHlXs2EkaghrgQwK8qEiVw3dZGpNJaq+I9IkPpReA4= github.com/gardener/hvpa-controller/api v0.5.0 h1:f4F3O7YUrenwh4S3TgPREPiB287JjjUiUL18OqPLyAA= github.com/gardener/hvpa-controller/api v0.5.0/go.mod h1:QQl3ELkCaki+8RhXl0FZMfvnm0WCGwGJlGmrxJj6lvM= -github.com/gardener/machine-controller-manager v0.50.0 h1:3dcQjzueFU1TGgprV00adjb3OCR99myTBx8DQGxywks= -github.com/gardener/machine-controller-manager v0.50.0/go.mod h1:RySZ40AgbNV/wMq60G/w49kb+okbj5Xs1A6usz5Pm/I= +github.com/gardener/machine-controller-manager v0.52.0 h1:irhpamQ/QXixCXJpNKRL71aM3FAdNO1HxZwA54jvncI= +github.com/gardener/machine-controller-manager v0.52.0/go.mod h1:6g5i/uRGugkRyIABZmDjvaiT8GLL7XRE9ziw4C/9nCo= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -155,8 +155,9 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo= github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA= github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc= @@ -533,8 +534,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -601,8 +602,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -654,8 +655,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -736,8 +737,8 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/controller/worker/machines.go b/pkg/controller/worker/machines.go index 71fd7bd00..818fac71e 100644 --- a/pkg/controller/worker/machines.go +++ b/pkg/controller/worker/machines.go @@ -177,6 +177,7 @@ func (w *workerDelegate) generateMachineConfig() error { InstanceType: pool.MachineType, Region: w.worker.Spec.Region, Zone: zone, + Architecture: &arch, } } else if pool.NodeTemplate != nil { machineClassSpec["nodeTemplate"] = machinev1alpha1.NodeTemplate{ @@ -184,6 +185,7 @@ func (w *workerDelegate) generateMachineConfig() error { InstanceType: pool.MachineType, Region: w.worker.Spec.Region, Zone: zone, + Architecture: &arch, } } diff --git a/pkg/controller/worker/machines_test.go b/pkg/controller/worker/machines_test.go index 8d92ff177..61c9a59ee 100644 --- a/pkg/controller/worker/machines_test.go +++ b/pkg/controller/worker/machines_test.go @@ -92,8 +92,9 @@ var _ = Describe("Machines", func() { securityGroupID string keyName string - archAMD string - archARM string + archAMD string + archARM string + archFAKE string volumeType string volumeSize int @@ -133,9 +134,11 @@ var _ = Describe("Machines", func() { labels map[string]string - nodeCapacity corev1.ResourceList - nodeTemplateZone1 machinev1alpha1.NodeTemplate - nodeTemplateZone2 machinev1alpha1.NodeTemplate + nodeCapacity corev1.ResourceList + nodeTemplatePool1Zone1 machinev1alpha1.NodeTemplate + nodeTemplatePool2Zone1 machinev1alpha1.NodeTemplate + nodeTemplatePool1Zone2 machinev1alpha1.NodeTemplate + nodeTemplatePool2Zone2 machinev1alpha1.NodeTemplate machineConfiguration *machinev1alpha1.MachineConfiguration @@ -171,6 +174,7 @@ var _ = Describe("Machines", func() { archAMD = "amd64" archARM = "arm64" + archFAKE = "fake" volumeType = "normal" volumeSize = 20 @@ -215,18 +219,34 @@ var _ = Describe("Machines", func() { "gpu": resource.MustParse("1"), "memory": resource.MustParse("128Gi"), } - nodeTemplateZone1 = machinev1alpha1.NodeTemplate{ + nodeTemplatePool1Zone1 = machinev1alpha1.NodeTemplate{ Capacity: nodeCapacity, InstanceType: machineType, Region: region, Zone: zone1, + Architecture: &archAMD, + } + nodeTemplatePool1Zone2 = machinev1alpha1.NodeTemplate{ + Capacity: nodeCapacity, + InstanceType: machineType, + Region: region, + Zone: zone2, + Architecture: &archAMD, } - nodeTemplateZone2 = machinev1alpha1.NodeTemplate{ + nodeTemplatePool2Zone1 = machinev1alpha1.NodeTemplate{ + Capacity: nodeCapacity, + InstanceType: machineType, + Region: region, + Zone: zone1, + Architecture: &archARM, + } + nodeTemplatePool2Zone2 = machinev1alpha1.NodeTemplate{ Capacity: nodeCapacity, InstanceType: machineType, Region: region, Zone: zone2, + Architecture: &archARM, } machineConfiguration = &machinev1alpha1.MachineConfiguration{} @@ -265,6 +285,21 @@ var _ = Describe("Machines", func() { }, }, }, + { + Name: machineImageName, + Versions: []apiv1alpha1.MachineImageVersion{ + { + Version: machineImageVersion, + Regions: []apiv1alpha1.RegionAMIMapping{ + { + Name: region, + AMI: machineImageAMI, + Architecture: pointer.String(archARM), + }, + }, + }, + }, + }, }, } cloudProfileConfigJSON, _ := json.Marshal(cloudProfileConfig) @@ -396,6 +431,7 @@ var _ = Describe("Machines", func() { { Name: namePool2, Minimum: minPool2, + Architecture: pointer.String(archARM), Maximum: maxPool2, MaxSurge: maxSurgePool2, MaxUnavailable: maxUnavailablePool2, @@ -560,10 +596,10 @@ var _ = Describe("Machines", func() { addNameAndSecretToMachineClass(machineClassPool2Zone1, machineClassWithHashPool2Zone1, w.Spec.SecretRef) addNameAndSecretToMachineClass(machineClassPool2Zone2, machineClassWithHashPool2Zone2, w.Spec.SecretRef) - addNodeTemplateToMachineClass(machineClassPool1Zone1, nodeTemplateZone1) - addNodeTemplateToMachineClass(machineClassPool1Zone2, nodeTemplateZone2) - addNodeTemplateToMachineClass(machineClassPool2Zone1, nodeTemplateZone1) - addNodeTemplateToMachineClass(machineClassPool2Zone2, nodeTemplateZone2) + addNodeTemplateToMachineClass(machineClassPool1Zone1, nodeTemplatePool1Zone1) + addNodeTemplateToMachineClass(machineClassPool1Zone2, nodeTemplatePool1Zone2) + addNodeTemplateToMachineClass(machineClassPool2Zone1, nodeTemplatePool2Zone1) + addNodeTemplateToMachineClass(machineClassPool2Zone2, nodeTemplatePool2Zone2) machineClasses = map[string]interface{}{"machineClasses": []map[string]interface{}{ machineClassPool1Zone1, @@ -657,6 +693,12 @@ var _ = Describe("Machines", func() { AMI: machineImageAMI, Architecture: pointer.String(archAMD), }, + { + Name: machineImageName, + Version: machineImageVersion, + AMI: machineImageAMI, + Architecture: pointer.String(archARM), + }, }, } @@ -840,7 +882,7 @@ var _ = Describe("Machines", func() { }) It("should fail because the ami for this architecture cannot be found", func() { - w.Spec.Pools[0].Architecture = pointer.String(archARM) + w.Spec.Pools[0].Architecture = pointer.String(archFAKE) workerDelegate, _ = NewWorkerDelegate(c, decoder, scheme, chartApplier, "", w, cluster)