Skip to content

Commit

Permalink
Bring back cloud-provider flag for kubelet (#348)
Browse files Browse the repository at this point in the history
Signed-off-by: Waleed Malik <[email protected]>
  • Loading branch information
ahmedwaleedmalik authored Jan 16, 2024
1 parent d9581af commit 34aa7a2
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 26 deletions.
3 changes: 2 additions & 1 deletion deploy/osps/default/osp-amzn2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,11 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
{{- if .ExternalCloudProvider }}
--cloud-provider=external \
{{- else if .InTreeCCMAvailable }}
{{- /* In-tree cloud providers have been disabled starting from k8s 1.29. For more information: https://github.com/kubernetes/kubernetes/pull/117503 */}}
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
--cloud-provider={{- .CloudProviderName }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion deploy/osps/default/osp-centos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,11 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
{{- if .ExternalCloudProvider }}
--cloud-provider=external \
{{- else if .InTreeCCMAvailable }}
{{- /* In-tree cloud providers have been disabled starting from k8s 1.29. For more information: https://github.com/kubernetes/kubernetes/pull/117503 */}}
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
--cloud-provider={{- .CloudProviderName }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion deploy/osps/default/osp-flatcar-cloud-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,11 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
{{- if .ExternalCloudProvider }}
--cloud-provider=external \
{{- else if .InTreeCCMAvailable }}
{{- /* In-tree cloud providers have been disabled starting from k8s 1.29. For more information: https://github.com/kubernetes/kubernetes/pull/117503 */}}
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
--cloud-provider={{- .CloudProviderName }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion deploy/osps/default/osp-flatcar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,11 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
{{- if .ExternalCloudProvider }}
--cloud-provider=external \
{{- else if .InTreeCCMAvailable }}
{{- /* In-tree cloud providers have been disabled starting from k8s 1.29. For more information: https://github.com/kubernetes/kubernetes/pull/117503 */}}
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
--cloud-provider={{- .CloudProviderName }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion deploy/osps/default/osp-rhel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,11 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
{{- if .ExternalCloudProvider }}
--cloud-provider=external \
{{- else if .InTreeCCMAvailable }}
{{- /* In-tree cloud providers have been disabled starting from k8s 1.29. For more information: https://github.com/kubernetes/kubernetes/pull/117503 */}}
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
--cloud-provider={{- .CloudProviderName }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion deploy/osps/default/osp-rockylinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,11 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
{{- if .ExternalCloudProvider }}
--cloud-provider=external \
{{- else if .InTreeCCMAvailable }}
{{- /* In-tree cloud providers have been disabled starting from k8s 1.29. For more information: https://github.com/kubernetes/kubernetes/pull/117503 */}}
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
--cloud-provider={{- .CloudProviderName }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
Expand Down
3 changes: 2 additions & 1 deletion deploy/osps/default/osp-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,11 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
{{- if .ExternalCloudProvider }}
--cloud-provider=external \
{{- else if .InTreeCCMAvailable }}
{{- /* In-tree cloud providers have been disabled starting from k8s 1.29. For more information: https://github.com/kubernetes/kubernetes/pull/117503 */}}
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
--cloud-provider={{- .CloudProviderName }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
Expand Down
37 changes: 20 additions & 17 deletions pkg/controllers/osc/osc_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ func init() {
}

type testConfig struct {
namespace string
containerRuntime string
clusterDNSIPs []net.IP
featureGates map[string]bool
namespace string
containerRuntime string
clusterDNSIPs []net.IP
featureGates map[string]bool
externalCloudProvider bool
}

func TestReconciler_Reconcile(t *testing.T) {
Expand Down Expand Up @@ -149,9 +150,10 @@ func TestReconciler_Reconcile(t *testing.T) {
provisioningSecretFile: "secret-ubuntu-aws-containerd-provisioning.yaml",
bootstrapSecretFile: "secret-ubuntu-aws-containerd-bootstrap.yaml",
config: testConfig{
namespace: "kube-system",
containerRuntime: "containerd",
clusterDNSIPs: []net.IP{net.IPv4(10, 0, 0, 0)},
namespace: "kube-system",
containerRuntime: "containerd",
externalCloudProvider: true,
clusterDNSIPs: []net.IP{net.IPv4(10, 0, 0, 0)},
},
cloudProvider: "aws",
cloudProviderSpec: runtime.RawExtension{Raw: []byte(`{"availabilityZone": "eu-central-1b", "vpcId": "e-123f", "subnetID": "test-subnet"}`)},
Expand Down Expand Up @@ -851,15 +853,16 @@ func buildReconciler(fakeClient controllerruntimeclient.Client, config testConfi
Client: fakeClient,
workerClient: fakeClient,

log: testUtil.DefaultLogger,
generator: generator.NewDefaultCloudConfigGenerator(""),
namespace: config.namespace,
caCert: dummyCACert,
containerRuntime: config.containerRuntime,
clusterDNSIPs: config.clusterDNSIPs,
kubeletFeatureGates: featureGates,
bootstrappingManager: bootstrappingManager,
nodeHTTPProxy: "http://test-http-proxy.com",
nodeNoProxy: "http://test-no-proxy.com",
log: testUtil.DefaultLogger,
generator: generator.NewDefaultCloudConfigGenerator(""),
namespace: config.namespace,
caCert: dummyCACert,
containerRuntime: config.containerRuntime,
clusterDNSIPs: config.clusterDNSIPs,
kubeletFeatureGates: featureGates,
bootstrappingManager: bootstrappingManager,
externalCloudProvider: config.externalCloudProvider,
nodeHTTPProxy: "http://test-http-proxy.com",
nodeNoProxy: "http://test-no-proxy.com",
}
}
2 changes: 2 additions & 0 deletions pkg/controllers/osc/testdata/osc-ubuntu-aws-containerd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
--cloud-provider=external \
--hostname-override=${KUBELET_HOSTNAME} \
--exit-on-lock-contention \
--lock-file=/tmp/kubelet.lock \
--container-runtime-endpoint=unix:///run/containerd/containerd.sock \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,11 @@ spec:
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
--cert-dir=/etc/kubernetes/pki \
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
{{- if .ExternalCloudProvider }}
--cloud-provider=external \
{{- else if .InTreeCCMAvailable }}
{{- /* In-tree cloud providers have been disabled starting from k8s 1.29. For more information: https://github.com/kubernetes/kubernetes/pull/117503 */}}
{{- if or (semverCompare "<1.29" .KubeVersion) (.DisableCloudProvidersFeatureGateDisabled) }}
--cloud-provider={{- .CloudProviderName }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
Expand Down

Large diffs are not rendered by default.

0 comments on commit 34aa7a2

Please sign in to comment.