From 0fde5aaf7b657edc96ba9ae02f9da95e26707792 Mon Sep 17 00:00:00 2001 From: Nawaz Hussain Khazielakha Date: Thu, 14 Nov 2024 18:05:55 -0800 Subject: [PATCH] update private templates --- templates/cluster-template-private.yaml | 17 ++++++-- templates/flavors/private/kustomization.yaml | 42 +++++++++++++++++++ .../ci/cluster-template-prow-private.yaml | 4 +- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/templates/cluster-template-private.yaml b/templates/cluster-template-private.yaml index 5663fb7403d5..ea0962978234 100644 --- a/templates/cluster-template-private.yaml +++ b/templates/cluster-template-private.yaml @@ -32,6 +32,9 @@ spec: location: ${AZURE_LOCATION} networkSpec: apiServerLB: + frontendIPs: + - name: ${CLUSTER_NAME}-internal-lb-private-ip + privateIP: 10.9.0.100 name: ${CLUSTER_NAME}-internal-lb type: Internal controlPlaneOutboundLB: @@ -39,11 +42,17 @@ spec: nodeOutboundLB: frontendIPsCount: 1 subnets: - - name: control-plane-subnet + - cidrBlocks: + - 10.9.0.0/24 + name: control-plane-subnet role: control-plane - - name: node-subnet + - cidrBlocks: + - 10.9.1.0/24 + name: node-subnet role: node vnet: + cidrBlocks: + - 10.9.0.0/16 name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} subscriptionID: ${AZURE_SUBSCRIPTION_ID} @@ -203,7 +212,9 @@ spec: kubeletExtraArgs: cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' - preKubeadmCommands: [] + preKubeadmCommands: + - echo '10.9.0.100 ${CLUSTER_NAME}-${APISERVER_LB_DNS_SUFFIX}.${AZURE_LOCATION}.cloudapp.azure.com' + >> /etc/hosts --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureClusterIdentity diff --git a/templates/flavors/private/kustomization.yaml b/templates/flavors/private/kustomization.yaml index e8b87f0ff6be..0a49a8be7b9d 100644 --- a/templates/flavors/private/kustomization.yaml +++ b/templates/flavors/private/kustomization.yaml @@ -11,6 +11,48 @@ patches: - path: patches/private-lb.yaml - path: patches/apiserver-host-dns.yaml - path: patches/azure-bastion.yaml +- path: ../../internal-load-balancer/azure-cluster-cidrs-and-frontend-ips.yaml +- path: ../../internal-load-balancer/kubeadm-config-template-worker-node.yaml +- target: + kind: KubeadmConfigTemplate + patch: |- + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: echo '10.9.0.100 ${CLUSTER_NAME}-${APISERVER_LB_DNS_SUFFIX}.${AZURE_LOCATION}.cloudapp.azure.com' >> /etc/hosts +- target: + kind: AzureCluster + patch: |- + - op: replace + path: /spec/networkSpec/apiServerLB/frontendIPs/1/privateIP + value: 10.9.0.100 +- target: + kind: AzureCluster + patch: |- + - op: replace + path: /spec/networkSpec/vnet/cidrBlocks/0 + value: 10.9.0.0/16 +- target: + kind: AzureCluster + patch: |- + - op: replace + path: /spec/networkSpec/subnets/0/cidrBlocks/0 + value: 10.9.0.0/24 +- target: + kind: AzureCluster + patch: |- + - op: replace + path: /spec/networkSpec/subnets/1/cidrBlocks/0 + value: 10.9.1.0/24 +- target: + kind: AzureCluster + patch: |- + - op: remove + path: /spec/networkSpec/apiServerLB/frontendIPs/0 +- target: + kind: KubeadmConfigTemplate + patch: |- + - op: remove + path: /spec/template/spec/preKubeadmCommands/0 sortOptions: order: fifo diff --git a/templates/test/ci/cluster-template-prow-private.yaml b/templates/test/ci/cluster-template-prow-private.yaml index 4f6613665e1d..cdf5c19a249f 100644 --- a/templates/test/ci/cluster-template-prow-private.yaml +++ b/templates/test/ci/cluster-template-prow-private.yaml @@ -236,7 +236,9 @@ spec: kubeletExtraArgs: cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' - preKubeadmCommands: [] + preKubeadmCommands: + - echo '10.9.0.100 ${CLUSTER_NAME}-${APISERVER_LB_DNS_SUFFIX}.${AZURE_LOCATION}.cloudapp.azure.com' + >> /etc/hosts --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureClusterIdentity