Skip to content

Commit c1dfda2

Browse files
committed
CORS-4220: pass dualstack cluster and service cidrs as comma-separated lists
kube-controller-manager expects the dualstack cluster and service CIDRs to be passed as comma-separated list arguments [0]. This ensures the dualstack cluster and service cidrs are indeed passed as comma-separated lists. References [0] https://kubernetes.io/docs/concepts/services-networking/dual-stack/#configure-ipv4-ipv6-dual-stack
1 parent ffe5113 commit c1dfda2

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

bindata/bootkube/config/bootstrap-config-overrides.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ extendedArguments:
1414
authorization-kubeconfig:
1515
- "/etc/kubernetes/secrets/kubeconfig"
1616
{{if .ClusterCIDR }}
17-
cluster-cidr: {{range .ClusterCIDR}}
18-
- {{.}}{{end}}
17+
cluster-cidr:
18+
- {{range $i, $cidr := .ClusterCIDR}}{{if $i}},{{end}}{{$cidr}}{{end}}
1919
{{end}}
2020
{{if .ServiceClusterIPRange }}
21-
service-cluster-ip-range: {{range .ServiceClusterIPRange}}
22-
- {{.}}{{end}}
21+
service-cluster-ip-range:
22+
- {{range $i, $ipRange := .ServiceClusterIPRange}}{{if $i}},{{end}}{{$ipRange}}{{end}}
2323
{{end}}
2424
pv-recycler-pod-template-filepath-nfs: # bootstrap KCM doesn't need recycler templates
2525
- ""
2626
pv-recycler-pod-template-filepath-hostpath:
2727
- ""
2828
feature-gates: {{range .FeatureGates}}
29-
- {{.}}{{end}}
29+
- {{.}}{{end}}

pkg/operator/configobservation/network/observe_network.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ func ObserveClusterCIDRs(genericListers configobserver.Listers, recorder events.
3636
}
3737

3838
if len(clusterCIDRs) > 0 {
39-
if err := unstructured.SetNestedStringSlice(observedConfig, clusterCIDRs, clusterCIDRsPath...); err != nil {
39+
clusterIPRange := strings.Join(clusterCIDRs, ",")
40+
if err := unstructured.SetNestedStringSlice(observedConfig, []string{clusterIPRange}, clusterCIDRsPath...); err != nil {
4041
errs = append(errs, err)
4142
}
4243
}

pkg/operator/configobservation/network/observe_networking_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ func TestObserveClusterCIDRs(t *testing.T) {
2525
expectedError bool
2626
}
2727
tests := []Test{
28+
{
29+
"single cluster network",
30+
&configv1.Network{
31+
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
32+
Status: configv1.NetworkStatus{ClusterNetwork: []configv1.ClusterNetworkEntry{
33+
{CIDR: "podCIDR"},
34+
}},
35+
},
36+
map[string]interface{}{},
37+
map[string]interface{}{
38+
"extendedArguments": map[string]interface{}{
39+
"cluster-cidr": []interface{}{"podCIDR"},
40+
},
41+
},
42+
false,
43+
},
2844
{
2945
"clusterNetworks",
3046
&configv1.Network{
@@ -37,7 +53,7 @@ func TestObserveClusterCIDRs(t *testing.T) {
3753
map[string]interface{}{
3854
"extendedArguments": map[string]interface{}{
3955
"cluster-cidr": []interface{}{
40-
"podCIDR1", "podCIDR2",
56+
"podCIDR1,podCIDR2",
4157
},
4258
},
4359
},

0 commit comments

Comments
 (0)