@@ -17,6 +17,7 @@ package master
17
17
import (
18
18
"context"
19
19
"fmt"
20
+ "strings"
20
21
21
22
"github.com/aws/aws-sdk-go/aws"
22
23
"github.com/awslabs/kubernetes-iteration-toolkit/operator/pkg/apis/controlplane/v1alpha1"
@@ -82,7 +83,7 @@ func kcmLabels(clustername string) map[string]string {
82
83
83
84
func kcmPodSpecFor (controlPlane * v1alpha1.ControlPlane ) v1.PodSpec {
84
85
hostPathDirectoryOrCreate := v1 .HostPathDirectoryOrCreate
85
- return v1.PodSpec {
86
+ return kcmPodSpecForVersion ( controlPlane . Spec . KubernetesVersion , & v1.PodSpec {
86
87
TerminationGracePeriodSeconds : aws .Int64 (1 ),
87
88
HostNetwork : true ,
88
89
DNSPolicy : v1 .DNSClusterFirstWithHostNet ,
@@ -98,10 +99,6 @@ func kcmPodSpecFor(controlPlane *v1alpha1.ControlPlane) v1.PodSpec {
98
99
v1 .ResourceCPU : resource .MustParse ("1" ),
99
100
},
100
101
},
101
- Ports : []v1.ContainerPort {{
102
- ContainerPort : 10252 ,
103
- Name : "metrics" ,
104
- }},
105
102
Args : []string {
106
103
"--authentication-kubeconfig=/etc/kubernetes/config/kcm/controller-manager.conf" ,
107
104
"--authorization-kubeconfig=/etc/kubernetes/config/kcm/controller-manager.conf" ,
@@ -152,9 +149,9 @@ func kcmPodSpecFor(controlPlane *v1alpha1.ControlPlane) v1.PodSpec {
152
149
ProbeHandler : v1.ProbeHandler {
153
150
HTTPGet : & v1.HTTPGetAction {
154
151
Host : "127.0.0.1" ,
155
- Scheme : v1 . URISchemeHTTP ,
152
+ Scheme : kcmHealthCheckSchemeForVersion ( controlPlane . Spec . KubernetesVersion ) ,
156
153
Path : "/healthz" ,
157
- Port : intstr . FromInt ( 10252 ),
154
+ Port : kcmHealthCheckPortForVersion ( controlPlane . Spec . KubernetesVersion ),
158
155
},
159
156
},
160
157
InitialDelaySeconds : 10 ,
@@ -233,7 +230,7 @@ func kcmPodSpecFor(controlPlane *v1alpha1.ControlPlane) v1.PodSpec {
233
230
},
234
231
},
235
232
}},
236
- }
233
+ })
237
234
}
238
235
239
236
func CloudConfigMapName (clusterName string ) string {
@@ -253,3 +250,38 @@ data:
253
250
KubernetesClusterID={{ .ClusterName}}
254
251
`
255
252
)
253
+
254
+ var (
255
+ disabledFlagsForKube122 = map [string ]struct {}{"--horizontal-pod-autoscaler-use-rest-clients" : {}}
256
+ )
257
+
258
+ func kcmPodSpecForVersion (version string , defaultSpec * v1.PodSpec ) v1.PodSpec {
259
+ switch version {
260
+ case "1.22" :
261
+ args := []string {}
262
+ for _ , arg := range defaultSpec .Containers [0 ].Args {
263
+ if _ , skip := disabledFlagsForKube122 [strings .Split (arg , "=" )[0 ]]; skip {
264
+ continue
265
+ }
266
+ args = append (args , arg )
267
+ }
268
+ defaultSpec .Containers [0 ].Args = args
269
+ }
270
+ return * defaultSpec
271
+ }
272
+
273
+ func kcmHealthCheckPortForVersion (version string ) intstr.IntOrString {
274
+ switch version {
275
+ case "1.22" :
276
+ return intstr .FromInt (10257 )
277
+ }
278
+ return intstr .FromInt (10252 )
279
+ }
280
+
281
+ func kcmHealthCheckSchemeForVersion (version string ) v1.URIScheme {
282
+ switch version {
283
+ case "1.22" :
284
+ return v1 .URISchemeHTTPS
285
+ }
286
+ return v1 .URISchemeHTTP
287
+ }
0 commit comments