sigs.k8s.io/cluster-api-provider-azure@v1.17.0/templates/cluster-template-flatcar.yaml (about)

     1  apiVersion: cluster.x-k8s.io/v1beta1
     2  kind: Cluster
     3  metadata:
     4    name: ${CLUSTER_NAME}
     5    namespace: default
     6  spec:
     7    clusterNetwork:
     8      pods:
     9        cidrBlocks:
    10        - 192.168.0.0/16
    11    controlPlaneRef:
    12      apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    13      kind: KubeadmControlPlane
    14      name: ${CLUSTER_NAME}-control-plane
    15    infrastructureRef:
    16      apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    17      kind: AzureCluster
    18      name: ${CLUSTER_NAME}
    19  ---
    20  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    21  kind: AzureCluster
    22  metadata:
    23    name: ${CLUSTER_NAME}
    24    namespace: default
    25  spec:
    26    identityRef:
    27      apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    28      kind: AzureClusterIdentity
    29      name: ${CLUSTER_IDENTITY_NAME}
    30    location: ${AZURE_LOCATION}
    31    networkSpec:
    32      subnets:
    33      - name: control-plane-subnet
    34        role: control-plane
    35      - name: node-subnet
    36        role: node
    37      vnet:
    38        name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet}
    39    resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}}
    40    subscriptionID: ${AZURE_SUBSCRIPTION_ID}
    41  ---
    42  apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    43  kind: KubeadmControlPlane
    44  metadata:
    45    name: ${CLUSTER_NAME}-control-plane
    46    namespace: default
    47  spec:
    48    kubeadmConfigSpec:
    49      clusterConfiguration:
    50        apiServer:
    51          extraArgs:
    52            cloud-provider: external
    53          timeoutForControlPlane: 20m
    54        controllerManager:
    55          extraArgs:
    56            allocate-node-cidrs: "false"
    57            cloud-provider: external
    58            cluster-name: ${CLUSTER_NAME}
    59        etcd:
    60          local:
    61            dataDir: /var/lib/etcddisk/etcd
    62            extraArgs:
    63              quota-backend-bytes: "8589934592"
    64      diskSetup:
    65        filesystems:
    66        - device: /dev/disk/azure/scsi1/lun0
    67          extraOpts:
    68          - -E
    69          - lazy_itable_init=1,lazy_journal_init=1
    70          filesystem: ext4
    71          label: etcd_disk
    72          overwrite: false
    73        partitions: []
    74      files:
    75      - contentFrom:
    76          secret:
    77            key: control-plane-azure.json
    78            name: ${CLUSTER_NAME}-control-plane-azure-json
    79        owner: root:root
    80        path: /etc/kubernetes/azure.json
    81        permissions: "0644"
    82      format: ignition
    83      ignition:
    84        containerLinuxConfig:
    85          additionalConfig: |
    86            systemd:
    87              units:
    88              - name: kubeadm.service
    89                dropins:
    90                - name: 10-flatcar.conf
    91                  contents: |
    92                    [Unit]
    93                    After=oem-cloudinit.service
    94                    # kubeadm must run after containerd - see https://github.com/kubernetes-sigs/image-builder/issues/939.
    95                    After=containerd.service
    96            # Workaround for https://github.com/kubernetes-sigs/cluster-api/issues/7679.
    97            storage:
    98              disks:
    99              - device: /dev/disk/azure/scsi1/lun0
   100                partitions:
   101                - number: 1
   102      initConfiguration:
   103        nodeRegistration:
   104          kubeletExtraArgs:
   105            cloud-provider: external
   106          name: '@@HOSTNAME@@'
   107      joinConfiguration:
   108        nodeRegistration:
   109          kubeletExtraArgs:
   110            cloud-provider: external
   111          name: '@@HOSTNAME@@'
   112      mounts:
   113      - - etcd_disk
   114        - /var/lib/etcddisk
   115      postKubeadmCommands: []
   116      preKubeadmCommands:
   117      - sed -i "s/@@HOSTNAME@@/$(curl -s -H Metadata:true --noproxy '*' 'http://169.254.169.254/metadata/instance?api-version=2020-09-01'
   118        | jq -r .compute.name)/g" /etc/kubeadm.yml
   119    machineTemplate:
   120      infrastructureRef:
   121        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   122        kind: AzureMachineTemplate
   123        name: ${CLUSTER_NAME}-control-plane
   124    replicas: ${CONTROL_PLANE_MACHINE_COUNT:=1}
   125    version: ${KUBERNETES_VERSION}
   126  ---
   127  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   128  kind: AzureMachineTemplate
   129  metadata:
   130    name: ${CLUSTER_NAME}-control-plane
   131    namespace: default
   132  spec:
   133    template:
   134      spec:
   135        dataDisks:
   136        - diskSizeGB: 256
   137          lun: 0
   138          nameSuffix: etcddisk
   139        identity: UserAssigned
   140        image:
   141          computeGallery:
   142            gallery: flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0
   143            name: flatcar-stable-amd64-capi-${KUBERNETES_VERSION}
   144            version: ${FLATCAR_VERSION}
   145        osDisk:
   146          diskSizeGB: 128
   147          osType: Linux
   148        sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
   149        userAssignedIdentities:
   150        - providerID: /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${CI_RG:=capz-ci}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/${USER_IDENTITY:=cloud-provider-user-identity}
   151        vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE}
   152  ---
   153  apiVersion: cluster.x-k8s.io/v1beta1
   154  kind: MachineDeployment
   155  metadata:
   156    name: ${CLUSTER_NAME}-md-0
   157    namespace: default
   158  spec:
   159    clusterName: ${CLUSTER_NAME}
   160    replicas: ${WORKER_MACHINE_COUNT:=2}
   161    selector:
   162      matchLabels: null
   163    template:
   164      spec:
   165        bootstrap:
   166          configRef:
   167            apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
   168            kind: KubeadmConfigTemplate
   169            name: ${CLUSTER_NAME}-md-0
   170        clusterName: ${CLUSTER_NAME}
   171        infrastructureRef:
   172          apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   173          kind: AzureMachineTemplate
   174          name: ${CLUSTER_NAME}-md-0
   175        version: ${KUBERNETES_VERSION}
   176  ---
   177  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   178  kind: AzureMachineTemplate
   179  metadata:
   180    name: ${CLUSTER_NAME}-md-0
   181    namespace: default
   182  spec:
   183    template:
   184      spec:
   185        image:
   186          computeGallery:
   187            gallery: flatcar4capi-742ef0cb-dcaa-4ecb-9cb0-bfd2e43dccc0
   188            name: flatcar-stable-amd64-capi-${KUBERNETES_VERSION}
   189            version: ${FLATCAR_VERSION}
   190        osDisk:
   191          diskSizeGB: 128
   192          osType: Linux
   193        sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
   194        vmSize: ${AZURE_NODE_MACHINE_TYPE}
   195  ---
   196  apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
   197  kind: KubeadmConfigTemplate
   198  metadata:
   199    name: ${CLUSTER_NAME}-md-0
   200    namespace: default
   201  spec:
   202    template:
   203      spec:
   204        files:
   205        - contentFrom:
   206            secret:
   207              key: worker-node-azure.json
   208              name: ${CLUSTER_NAME}-md-0-azure-json
   209          owner: root:root
   210          path: /etc/kubernetes/azure.json
   211          permissions: "0644"
   212        format: ignition
   213        ignition:
   214          containerLinuxConfig:
   215            additionalConfig: |
   216              systemd:
   217                units:
   218                - name: kubeadm.service
   219                  dropins:
   220                  - name: 10-flatcar.conf
   221                    contents: |
   222                      [Unit]
   223                      After=oem-cloudinit.service
   224                      # kubeadm must run after containerd - see https://github.com/kubernetes-sigs/image-builder/issues/939.
   225                      After=containerd.service
   226        joinConfiguration:
   227          nodeRegistration:
   228            kubeletExtraArgs:
   229              cloud-provider: external
   230            name: '@@HOSTNAME@@'
   231        postKubeadmCommands: []
   232        preKubeadmCommands:
   233        - sed -i "s/@@HOSTNAME@@/$(curl -s -H Metadata:true --noproxy '*' 'http://169.254.169.254/metadata/instance?api-version=2020-09-01'
   234          | jq -r .compute.name)/g" /etc/kubeadm.yml
   235  ---
   236  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   237  kind: AzureClusterIdentity
   238  metadata:
   239    labels:
   240      clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
   241    name: ${CLUSTER_IDENTITY_NAME}
   242    namespace: default
   243  spec:
   244    allowedNamespaces: {}
   245    clientID: ${AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY}
   246    tenantID: ${AZURE_TENANT_ID}
   247    type: ${CLUSTER_IDENTITY_TYPE:=WorkloadIdentity}