File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,11 @@ func (ad *admissionData) mutateMachines(ar admissionv1.AdmissionRequest) (*admis
8888 common .SetKubeletFlags (& machine , map [common.KubeletFlags ]string {
8989 common .ExternalCloudProviderKubeletFlag : fmt .Sprintf ("%t" , ad .nodeSettings .ExternalCloudProvider ),
9090 })
91+ providerConfig , err := providerconfigtypes .GetConfig (machine .Spec .ProviderSpec )
92+ if err != nil {
93+ return nil , err
94+ }
95+ common .SetOSLabel (& machine , string (providerConfig .OperatingSystem ))
9196 }
9297
9398 return createAdmissionResponse (machineOriginal , & machine )
Original file line number Diff line number Diff line change @@ -193,3 +193,17 @@ func GetKubeletFlags(metaobj metav1.Object) map[KubeletFlags]string {
193193 }
194194 return result
195195}
196+
197+ const OperatingSystemLabelV1 = "v1.machine-controller.kubermatic.io/operating-system"
198+
199+ func SetOSLabel (metaobj metav1.Object , osName string ) {
200+ lbs := metaobj .GetLabels ()
201+
202+ if _ , found := lbs [OperatingSystemLabelV1 ]; ! found {
203+ if lbs == nil {
204+ lbs = map [string ]string {}
205+ }
206+ lbs [OperatingSystemLabelV1 ] = osName
207+ metaobj .SetLabels (lbs )
208+ }
209+ }
You can’t perform that action at this time.
0 commit comments