-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for azure system assigned identities
- add new field for IdentityType in AzureMachineSpec - add new flavor for VMs with system assigned identity
- Loading branch information
1 parent
259ffb2
commit 8f1ad61
Showing
12 changed files
with
366 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
197 changes: 197 additions & 0 deletions
197
templates/cluster-template-system-assigned-identity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 | ||
kind: KubeadmConfigTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-md-0 | ||
spec: | ||
template: | ||
spec: | ||
files: | ||
- content: | | ||
{ | ||
"cloud": "AzurePublicCloud", | ||
"tenantId": "${AZURE_TENANT_ID}", | ||
"subscriptionId": "${AZURE_SUBSCRIPTION_ID}", | ||
"resourceGroup": "${CLUSTER_NAME}", | ||
"securityGroupName": "${CLUSTER_NAME}-node-nsg", | ||
"location": "${AZURE_LOCATION}", | ||
"vmType": "standard", | ||
"vnetName": "${CLUSTER_NAME}-vnet", | ||
"vnetResourceGroup": "${CLUSTER_NAME}", | ||
"subnetName": "${CLUSTER_NAME}-node-subnet", | ||
"routeTableName": "${CLUSTER_NAME}-node-routetable", | ||
"loadBalancerSku": "standard", | ||
"maximumLoadBalancerRuleCount": 250, | ||
"useManagedIdentityExtension": true, | ||
"useInstanceMetadata": true | ||
} | ||
owner: root:root | ||
path: /etc/kubernetes/azure.json | ||
permissions: "0644" | ||
joinConfiguration: | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cloud-config: /etc/kubernetes/azure.json | ||
cloud-provider: azure | ||
name: '{{ ds.meta_data["local_hostname"] }}' | ||
--- | ||
apiVersion: cluster.x-k8s.io/v1alpha3 | ||
kind: Cluster | ||
metadata: | ||
name: ${CLUSTER_NAME} | ||
namespace: default | ||
spec: | ||
clusterNetwork: | ||
pods: | ||
cidrBlocks: | ||
- 192.168.0.0/16 | ||
controlPlaneRef: | ||
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 | ||
kind: KubeadmControlPlane | ||
name: ${CLUSTER_NAME}-control-plane | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 | ||
kind: AzureCluster | ||
name: ${CLUSTER_NAME} | ||
--- | ||
apiVersion: cluster.x-k8s.io/v1alpha3 | ||
kind: MachineDeployment | ||
metadata: | ||
name: ${CLUSTER_NAME}-md-0 | ||
spec: | ||
clusterName: ${CLUSTER_NAME} | ||
replicas: ${WORKER_MACHINE_COUNT} | ||
selector: | ||
matchLabels: null | ||
template: | ||
spec: | ||
bootstrap: | ||
configRef: | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 | ||
kind: KubeadmConfigTemplate | ||
name: ${CLUSTER_NAME}-md-0 | ||
clusterName: ${CLUSTER_NAME} | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 | ||
kind: AzureMachineTemplate | ||
name: ${CLUSTER_NAME}-md-0 | ||
version: ${KUBERNETES_VERSION} | ||
--- | ||
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 | ||
kind: KubeadmControlPlane | ||
metadata: | ||
name: ${CLUSTER_NAME}-control-plane | ||
namespace: default | ||
spec: | ||
infrastructureTemplate: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 | ||
kind: AzureMachineTemplate | ||
name: ${CLUSTER_NAME}-control-plane | ||
kubeadmConfigSpec: | ||
clusterConfiguration: | ||
apiServer: | ||
extraArgs: | ||
cloud-config: /etc/kubernetes/azure.json | ||
cloud-provider: azure | ||
extraVolumes: | ||
- hostPath: /etc/kubernetes/azure.json | ||
mountPath: /etc/kubernetes/azure.json | ||
name: cloud-config | ||
readOnly: true | ||
timeoutForControlPlane: 20m | ||
controllerManager: | ||
extraArgs: | ||
allocate-node-cidrs: "false" | ||
cloud-config: /etc/kubernetes/azure.json | ||
cloud-provider: azure | ||
extraVolumes: | ||
- hostPath: /etc/kubernetes/azure.json | ||
mountPath: /etc/kubernetes/azure.json | ||
name: cloud-config | ||
readOnly: true | ||
files: | ||
- content: | | ||
{ | ||
"cloud": "AzurePublicCloud", | ||
"tenantId": "${AZURE_TENANT_ID}", | ||
"subscriptionId": "${AZURE_SUBSCRIPTION_ID}", | ||
"aadClientId": "${AZURE_CLIENT_ID}", | ||
"aadClientSecret": "${AZURE_CLIENT_SECRET}", | ||
"resourceGroup": "${AZURE_RESOURCE_GROUP}", | ||
"securityGroupName": "${CLUSTER_NAME}-node-nsg", | ||
"location": "${AZURE_LOCATION}", | ||
"vmType": "standard", | ||
"vnetName": "${CLUSTER_NAME}-vnet", | ||
"vnetResourceGroup": "${CLUSTER_NAME}", | ||
"subnetName": "${CLUSTER_NAME}-node-subnet", | ||
"routeTableName": "${CLUSTER_NAME}-node-routetable", | ||
"userAssignedID": "${CLUSTER_NAME}", | ||
"loadBalancerSku": "standard", | ||
"maximumLoadBalancerRuleCount": 250, | ||
"useManagedIdentityExtension": false, | ||
"useInstanceMetadata": true | ||
} | ||
owner: root:root | ||
path: /etc/kubernetes/azure.json | ||
permissions: "0644" | ||
initConfiguration: | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cloud-config: /etc/kubernetes/azure.json | ||
cloud-provider: azure | ||
name: '{{ ds.meta_data["local_hostname"] }}' | ||
joinConfiguration: | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cloud-config: /etc/kubernetes/azure.json | ||
cloud-provider: azure | ||
name: '{{ ds.meta_data["local_hostname"] }}' | ||
useExperimentalRetryJoin: true | ||
replicas: ${CONTROL_PLANE_MACHINE_COUNT} | ||
version: ${KUBERNETES_VERSION} | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 | ||
kind: AzureCluster | ||
metadata: | ||
name: ${CLUSTER_NAME} | ||
namespace: default | ||
spec: | ||
location: ${AZURE_LOCATION} | ||
networkSpec: | ||
vnet: | ||
name: ${AZURE_VNET_NAME} | ||
resourceGroup: ${AZURE_RESOURCE_GROUP} | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 | ||
kind: AzureMachineTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-control-plane | ||
namespace: default | ||
spec: | ||
template: | ||
spec: | ||
identity: SystemAssigned | ||
location: ${AZURE_LOCATION} | ||
osDisk: | ||
diskSizeGB: 128 | ||
managedDisk: | ||
storageAccountType: Premium_LRS | ||
osType: Linux | ||
sshPublicKey: ${AZURE_SSH_PUBLIC_KEY} | ||
vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 | ||
kind: AzureMachineTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-md-0 | ||
spec: | ||
template: | ||
spec: | ||
identity: SystemAssigned | ||
location: ${AZURE_LOCATION} | ||
osDisk: | ||
diskSizeGB: 30 | ||
managedDisk: | ||
storageAccountType: Premium_LRS | ||
osType: Linux | ||
sshPublicKey: ${AZURE_SSH_PUBLIC_KEY} | ||
vmSize: ${AZURE_NODE_MACHINE_TYPE} |
5 changes: 5 additions & 0 deletions
5
templates/flavors/system-assigned-identity/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resources: | ||
- ../base | ||
- system-assigned-identity.yaml | ||
patchesStrategicMerge: | ||
- patches/system-assigned-identity.yaml |
52 changes: 52 additions & 0 deletions
52
templates/flavors/system-assigned-identity/patches/system-assigned-identity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 | ||
kind: KubeadmConfigTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-md-0 | ||
spec: | ||
template: | ||
spec: | ||
files: | ||
- content: | | ||
{ | ||
"cloud": "AzurePublicCloud", | ||
"tenantId": "${AZURE_TENANT_ID}", | ||
"subscriptionId": "${AZURE_SUBSCRIPTION_ID}", | ||
"resourceGroup": "${CLUSTER_NAME}", | ||
"securityGroupName": "${CLUSTER_NAME}-node-nsg", | ||
"location": "${AZURE_LOCATION}", | ||
"vmType": "standard", | ||
"vnetName": "${CLUSTER_NAME}-vnet", | ||
"vnetResourceGroup": "${CLUSTER_NAME}", | ||
"subnetName": "${CLUSTER_NAME}-node-subnet", | ||
"routeTableName": "${CLUSTER_NAME}-node-routetable", | ||
"loadBalancerSku": "standard", | ||
"maximumLoadBalancerRuleCount": 250, | ||
"useManagedIdentityExtension": true, | ||
"useInstanceMetadata": true | ||
} | ||
owner: root:root | ||
path: /etc/kubernetes/azure.json | ||
permissions: "0644" | ||
joinConfiguration: | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cloud-config: /etc/kubernetes/azure.json | ||
cloud-provider: azure | ||
name: '{{ ds.meta_data["local_hostname"] }}' | ||
--- | ||
kind: AzureMachineTemplate | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 | ||
metadata: | ||
name: "${CLUSTER_NAME}-control-plane" | ||
spec: | ||
template: | ||
spec: | ||
location: ${AZURE_LOCATION} | ||
identity: SystemAssigned | ||
vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} | ||
osDisk: | ||
osType: "Linux" | ||
diskSizeGB: 128 | ||
managedDisk: | ||
storageAccountType: "Premium_LRS" | ||
sshPublicKey: ${AZURE_SSH_PUBLIC_KEY} |
Oops, something went wrong.