Skip to content

Commit 6cf2090

Browse files
authored
Merge pull request #789 from nader-ziada/defaults
⚠ add variable defaults to templates
2 parents 82b903d + dadb939 commit 6cf2090

15 files changed

+31
-27
lines changed

config/default/cloud_environment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ metadata:
44
name: manager-bootstrap-cloud-env
55
namespace: system
66
data:
7-
cloud-env: ${AZURE_ENVIRONMENT}
7+
cloud-env: ${AZURE_ENVIRONMENT:-"AzurePublicCloud"}
8+

docs/development.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export AZURE_SSH_PUBLIC_KEY=$(cat "${SSH_KEY_FILE}.pub" | base64 | tr -d '\r\n')
282282

283283
# To populate secret in azure.json file.
284284
export AZURE_JSON_B64=$(echo '{
285-
"cloud": "${AZURE_ENVIRONMENT}",
285+
"cloud": "${AZURE_ENVIRONMENT:="AzurePublicCloud"}",
286286
"tenantId": "${AZURE_TENANT_ID}",
287287
"subscriptionId": "${AZURE_SUBSCRIPTION_ID}",
288288
"aadClientId": "${AZURE_CLIENT_ID}",
@@ -291,7 +291,7 @@ export AZURE_JSON_B64=$(echo '{
291291
"securityGroupName": "${CLUSTER_NAME}-node-nsg",
292292
"location": "${AZURE_LOCATION}",
293293
"vmType": "vmss",
294-
"vnetName": "${AZURE_VNET_NAME}",
294+
"vnetName": "${AZURE_VNET_NAME:=$CLUSTER_NAME-vnet}",
295295
"vnetResourceGroup": "${CLUSTER_NAME}",
296296
"subnetName": "${CLUSTER_NAME}-node-subnet",
297297
"routeTableName": "${CLUSTER_NAME}-node-routetable",
@@ -302,6 +302,9 @@ export AZURE_JSON_B64=$(echo '{
302302
}' | envsubst | base64 | tr -d '\r\n')
303303
```
304304

305+
⚠️ Please note the generated templates include default values and therefore requrie the use of `clusterctl` to create the cluster
306+
or the use of `envsubst` to replace these values
307+
305308
##### Creating the cluster
306309

307310
⚠️ Make sure you followed the previous two steps to build the dev image and set the required environment variables before proceding.

hack/create-dev-cluster.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fi
5959
export AZURE_SSH_PUBLIC_KEY=$(cat "${SSH_KEY_FILE}.pub" | base64 | tr -d '\r\n')
6060

6161
export AZURE_JSON_B64=$(echo '{
62-
"cloud": "${AZURE_ENVIRONMENT}",
62+
"cloud": "${AZURE_ENVIRONMENT:="AzurePublicCloud"}",
6363
"tenantId": "${AZURE_TENANT_ID}",
6464
"subscriptionId": "${AZURE_SUBSCRIPTION_ID}",
6565
"aadClientId": "${AZURE_CLIENT_ID}",
@@ -68,7 +68,7 @@ export AZURE_JSON_B64=$(echo '{
6868
"securityGroupName": "${CLUSTER_NAME}-node-nsg",
6969
"location": "${AZURE_LOCATION}",
7070
"vmType": "vmss",
71-
"vnetName": "${AZURE_VNET_NAME}",
71+
"vnetName": "${AZURE_VNET_NAME:=$CLUSTER_NAME-vnet}",
7272
"vnetResourceGroup": "${CLUSTER_NAME}",
7373
"subnetName": "${CLUSTER_NAME}-node-subnet",
7474
"routeTableName": "${CLUSTER_NAME}-node-routetable",

templates/cluster-template-aks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
defaultPoolRef:
2727
name: agentpool0
2828
location: ${AZURE_LOCATION}
29-
resourceGroup: ${AZURE_RESOURCE_GROUP}
29+
resourceGroup: ${AZURE_RESOURCE_GROUP:=$CLUSTER_NAME}
3030
sshPublicKey: ${AZURE_SSH_PUBLIC_KEY}
3131
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
3232
version: ${KUBERNETES_VERSION}

templates/cluster-template-external-cloud-provider.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ spec:
2626
location: ${AZURE_LOCATION}
2727
networkSpec:
2828
vnet:
29-
name: ${AZURE_VNET_NAME}
30-
resourceGroup: ${AZURE_RESOURCE_GROUP}
29+
name: ${AZURE_VNET_NAME:=$CLUSTER_NAME-vnet}
30+
resourceGroup: ${AZURE_RESOURCE_GROUP:=$CLUSTER_NAME}
3131
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
3232
---
3333
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3

templates/cluster-template-machinepool.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ spec:
2626
location: ${AZURE_LOCATION}
2727
networkSpec:
2828
vnet:
29-
name: ${AZURE_VNET_NAME}
30-
resourceGroup: ${AZURE_RESOURCE_GROUP}
29+
name: ${AZURE_VNET_NAME:=$CLUSTER_NAME-vnet}
30+
resourceGroup: ${AZURE_RESOURCE_GROUP:=$CLUSTER_NAME}
3131
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
3232
---
3333
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3

templates/cluster-template-system-assigned-identity.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ spec:
2626
location: ${AZURE_LOCATION}
2727
networkSpec:
2828
vnet:
29-
name: ${AZURE_VNET_NAME}
30-
resourceGroup: ${AZURE_RESOURCE_GROUP}
29+
name: ${AZURE_VNET_NAME:=$CLUSTER_NAME-vnet}
30+
resourceGroup: ${AZURE_RESOURCE_GROUP:=$CLUSTER_NAME}
3131
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
3232
---
3333
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3

templates/cluster-template-user-assigned-identity.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ spec:
2626
location: ${AZURE_LOCATION}
2727
networkSpec:
2828
vnet:
29-
name: ${AZURE_VNET_NAME}
30-
resourceGroup: ${AZURE_RESOURCE_GROUP}
29+
name: ${AZURE_VNET_NAME:=$CLUSTER_NAME-vnet}
30+
resourceGroup: ${AZURE_RESOURCE_GROUP:=$CLUSTER_NAME}
3131
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
3232
---
3333
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3

templates/cluster-template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ spec:
2626
location: ${AZURE_LOCATION}
2727
networkSpec:
2828
vnet:
29-
name: ${AZURE_VNET_NAME}
30-
resourceGroup: ${AZURE_RESOURCE_GROUP}
29+
name: ${AZURE_VNET_NAME:=$CLUSTER_NAME-vnet}
30+
resourceGroup: ${AZURE_RESOURCE_GROUP:=$CLUSTER_NAME}
3131
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
3232
---
3333
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3

templates/flavors/aks/cluster-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ metadata:
2929
name: ${CLUSTER_NAME}-control-plane
3030
spec:
3131
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
32-
resourceGroup: "${AZURE_RESOURCE_GROUP}"
32+
resourceGroup: "${AZURE_RESOURCE_GROUP:=$CLUSTER_NAME}"
3333
location: "${AZURE_LOCATION}"
3434
defaultPoolRef:
3535
name: "agentpool0"

0 commit comments

Comments
 (0)