Skip to content

Commit 8791fa9

Browse files
authored
Merge pull request #1405 from shysank/cloud_provider_secret_fix
Forward port cloud provider secret fix
2 parents 38e6656 + b201e4e commit 8791fa9

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

controllers/helpers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ func GetCloudProviderSecret(d azure.ClusterScoper, namespace, name string, owner
187187
secret.Data = map[string][]byte{
188188
"control-plane-azure.json": controlPlaneData,
189189
"worker-node-azure.json": workerNodeData,
190+
// added for backwards compatibility
191+
"azure.json": controlPlaneData,
190192
}
191193

192194
return secret, nil

controllers/helpers_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ func TestGetCloudProviderConfig(t *testing.T) {
170170
if diff := cmp.Diff(tc.expectedWorkerNodeConfig, string(cloudConfig.Data["worker-node-azure.json"])); diff != "" {
171171
t.Errorf(diff)
172172
}
173+
if diff := cmp.Diff(tc.expectedControlPlaneConfig, string(cloudConfig.Data["azure.json"])); diff != "" {
174+
t.Errorf(diff)
175+
}
173176
})
174177
}
175178
}

docs/book/src/topics/cloud-provider-config.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ The [Azure cloud provider](https://github.com/kubernetes-sigs/cloud-provider-azu
44

55
CAPZ automatically generates this file based on user-provided values in AzureMachineTemplate and AzureMachine. All AzureMachines in the same MachineDeployment or control plane will all share a single cloud provider secret, while AzureMachines created inidividually will have their own secret.
66

7-
For AzureMachineTemplate and standalone AzureMachines, the generated secret will have the name "${RESOURCE}-azure-json", where "${RESOURCE}" is the name of either the AzureMachineTemplate or AzureMachine. The secret will have one data field, `azure.json`, with the raw content for that file. When the secret `${RESOURCE}-azure-json` already exists in the same namespace as an AzureCluster and does not have the label `"${CLUSTER_NAME}": "owned"`, CAPZ will not generate the default described above. Instead it will directly use whatever the user provides in that secret.
7+
For AzureMachineTemplate and standalone AzureMachines, the generated secret will have the name "${RESOURCE}-azure-json", where "${RESOURCE}" is the name of either the AzureMachineTemplate or AzureMachine. The secret will have two data fields: `control-plane-azure.json` and `worker-node-azure.json`, with the raw content for that file containing the control plane and worker node data respectively. When the secret `${RESOURCE}-azure-json` already exists in the same namespace as an AzureCluster and does not have the label `"${CLUSTER_NAME}": "owned"`, CAPZ will not generate the default described above. Instead it will directly use whatever the user provides in that secret.
8+
9+
<aside class="note warning">
10+
11+
<h1> Warning </h1>
12+
13+
For backwards compatibility, the generated secret will also have the `azure.json` field with the control plane data.
14+
But, this is deprecated and will be removed in capz `v0.6.x`. It is recommended to use the `control-plane-azure.json` and `worker-node-azure.json` fields instead.
15+
16+
</aside>
817

918
### Overriding Cloud Provider Config
1019

0 commit comments

Comments
 (0)