Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bindata/bootkube/config/bootstrap-config-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ extendedArguments:
- "/etc/kubernetes/secrets/kubeconfig"
authorization-kubeconfig:
- "/etc/kubernetes/secrets/kubeconfig"
{{if .ClusterCIDR }}
cluster-cidr: {{range .ClusterCIDR}}
- {{.}}{{end}}
{{if .ClusterCIDR | len }}
cluster-cidr:
- {{index .ClusterCIDR 0}}{{if gt (.ClusterCIDR | len) 1}},{{index .ClusterCIDR 1}}{{end}}
{{end}}
{{if .ServiceClusterIPRange }}
service-cluster-ip-range: {{range .ServiceClusterIPRange}}
- {{.}}{{end}}
{{if .ServiceClusterIPRange | len }}
service-cluster-ip-range:
- {{index .ServiceClusterIPRange 0}}{{if gt (.ServiceClusterIPRange | len) 1}},{{index .ServiceClusterIPRange 1}}{{end}}
{{end}}
pv-recycler-pod-template-filepath-nfs: # bootstrap KCM doesn't need recycler templates
- ""
pv-recycler-pod-template-filepath-hostpath:
- ""
feature-gates: {{range .FeatureGates}}
- {{.}}{{end}}
- {{.}}{{end}}
3 changes: 2 additions & 1 deletion pkg/operator/configobservation/network/observe_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func ObserveClusterCIDRs(genericListers configobserver.Listers, recorder events.
}

if len(clusterCIDRs) > 0 {
if err := unstructured.SetNestedStringSlice(observedConfig, clusterCIDRs, clusterCIDRsPath...); err != nil {
clusterIPRange := strings.Join(clusterCIDRs, ",")
if err := unstructured.SetNestedStringSlice(observedConfig, []string{clusterIPRange}, clusterCIDRsPath...); err != nil {
errs = append(errs, err)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ func TestObserveClusterCIDRs(t *testing.T) {
expectedError bool
}
tests := []Test{
{
"single cluster network",
&configv1.Network{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
Status: configv1.NetworkStatus{ClusterNetwork: []configv1.ClusterNetworkEntry{
{CIDR: "podCIDR"},
}},
},
map[string]interface{}{},
map[string]interface{}{
"extendedArguments": map[string]interface{}{
"cluster-cidr": []interface{}{"podCIDR"},
},
},
false,
},
{
"clusterNetworks",
&configv1.Network{
Expand All @@ -37,7 +53,7 @@ func TestObserveClusterCIDRs(t *testing.T) {
map[string]interface{}{
"extendedArguments": map[string]interface{}{
"cluster-cidr": []interface{}{
"podCIDR1", "podCIDR2",
"podCIDR1,podCIDR2",
},
},
},
Expand Down