Skip to content

Commit

Permalink
Added Azure capz helm chart
Browse files Browse the repository at this point in the history
Signed-off-by: Devesh Sharma <[email protected]>
  • Loading branch information
Devesh Sharma committed Aug 2, 2024
1 parent d3813b5 commit edf3a58
Show file tree
Hide file tree
Showing 15 changed files with 276 additions and 0 deletions.
3 changes: 3 additions & 0 deletions argocd-helm-charts/capi-cluster/charts/azure/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: azure
version: 1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.selfmangedCluster }}
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureCluster
metadata:
name: {{ .Values.global.clusterName }}
namespace: {{ .Release.Namespace }}
spec:
location: {{ .Values.location }}
resourceGroup: {{ .Values.resourceGroup }}
subscriptionID: {{ .Values.subscriptionID }}
networkSpec:
vnet:
name: {{ .Values.global.virtualNetwork.name }}
cidrBlocks:
- {{ .Values.global.virtualNetwork.cidrBlock | toString }}
subnets:
- name: {{ .Values.global.virtualNetwork.subnet.name }}
role: node
cidrBlocks:
- {{ .Values.global.virtualNetwork.subnet.cidrBlock | toString }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureClusterIdentity
metadata:
labels:
clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
name: {{ .Values.global.clusterName }}-cluster-identity
namespace: {{ .Release.Namespace }}
spec:
allowedNamespaces:
list:
- {{ .Release.Namespace }}
clientID: {{ .Values.global.clientID}}
clientSecret:
name: {{ .Values.global.clientSecret}}
namespace: {{ .Release.Namespace }}
tenantID: {{ .Values.global.tenantID }}
type: ServicePrincipal

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if .Values.selfmangedCluster }}
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureMachinePool
metadata:
name: spool1
namespace: {{ .Values.metadata.namespace }}
spec:
location: {{ .Values.location }}
template:
osDisk:
diskSizeGB: {{ .Values.systemPool.osDiskSizeGB }}
managedDisk:
storageAccountType: Standard_LRS
vmSize: {{ .Values.systemPool.sku }}
sshPublicKey: {{ .Values.sshPublicKey | b64enc }}
strategy:
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
additionalTags:
{{- with .Values.additionalTags }}
{{ toYaml . | indent 6 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- if .Values.managedCluster }}
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedCluster
metadata:
name: {{ .Values.global.clusterName }}
namespace: {{ .Release.Namespace }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{- if .Values.managedCluster }}
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedControlPlane
metadata:
name: {{ .Values.global.clusterName }}-control-plane
namespace: {{ .Release.Namespace }}
spec:
location: {{ .Values.location }}
resourceGroupName: {{ .Values.resourceGroupName }}
sshPublicKey: {{ .Values.sshPublicKey | b64enc }}
subscriptionID: {{ .Values.subscriptionID }}
version: {{ .Values.global.kubernetes.version }}
networkPolicy: {{ .Values.global.networkPolicy }} #azure # or calico
networkPlugin: {{ .Values.global.networkPlugin }} #azure # or kubenet
sku:
tier: {{ .Values.global.skuTier }} #Free # or Standard
{{- if .Values.global.addonProfiles }}
addonProfiles:
{{- range $profile := .Values.global.addonProfiles }}
- name: {{ $profile.name }}
enabled: {{ $profile.enabled }}
{{- end }}
{{- end }}
{{- if .Values.global.virtualNetwork }}
virtualNetwork:
name: {{ .Values.global.virtualNetwork.name }}
cidrBlock: {{ .Values.global.virtualNetwork.cidrBlock | toString }}
resourceGroup: {{ .Values.resourceGroupName }}
subnet:
name: {{ .Values.global.virtualNetwork.subnet.name }}
cidrBlock: {{ .Values.global.virtualNetwork.subnet.cidrBlock | toString }}
{{- end }}
identityRef:
name: {{ .Values.global.clusterName }}-cluster-identity
kind: AzureClusterIdentity
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
name: {{ .Values.global.clusterName}}-systempool
namespace: {{ .Release.Namespace }}
spec:
clusterName: {{ .Values.global.clusterName }}
replicas: {{ .Values.systemPool.replicas }}
template:
spec:
clusterName: {{ .Values.global.clusterName }}
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedMachinePool
name: mspool01
namespace: {{ .Release.Namespace }}
version: {{ .Values.global.kubernetes.version }}
bootstrap:
dataSecretName: {{ .Values.global.clientSecret}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.managedCluster }}
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedMachinePool
metadata:
name: mspool01
spec:
mode: System
osDiskSizeGB: {{ .Values.systemPool.osDiskSizeGB }}
sku: {{ .Values.systemPool.sku }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.managedCluster }}
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
name: {{ .Values.global.clusterName}}-userpool
namespace: {{ .Release.Namespace }}
spec:
clusterName: {{ .Values.global.clusterName }}
replicas: {{ .Values.userPool.replicas }}
template:
spec:
clusterName: {{ .Values.global.clusterName }}
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedMachinePool
name: mupool01
namespace: {{ .Release.Namespace }}
version: {{ .Values.global.kubernetes.version }}
bootstrap:
dataSecretName: {{ .Values.global.clientSecret}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.managedCluster }}
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedMachinePool
metadata:
name: mupool01
spec:
mode: User
osDiskSizeGB: {{ .Values.userPool.osDiskSizeGB }}
sku: {{ .Values.userPool.sku }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: {{ .Values.global.clusterName }}
namespace: {{ .Release.Namespace }}
spec:
clusterNetwork:
services:
cidrBlocks:
- {{ .Values.global.clusterNetwork.services.cidrBlocks }}
controlPlaneRef:
{{- if .Values.managedCluster }}
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedControlPlane
name: {{ .Values.global.clusterName }}-control-plane
{{- end }}
infrastructureRef:
{{- if .Values.managedCluster }}
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureManagedCluster
name: {{ .Values.global.clusterName }}
{{- end }}
44 changes: 44 additions & 0 deletions argocd-helm-charts/capi-cluster/charts/azure/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
global:
clusterName: my-cluster
kubernetes:
version: "1.29.2"
networkPolicy: azure # or calico
networkPlugin: azure # or kubenet
skuTier: Free
clientSecret: mysecret
clientID: 158ac5a8-c34d-4d35-81ff-90677ce31b5d
tenantID: 3964984e-eaaf-4ac4-b3ff-b3cda81256ff
addonProfiles:
- name: azureKeyvaultSecretsProvider
enabled: true
- name: azurepolicy
enabled: true
clusterNetwork:
services:
cidrBlocks: "192.168.0.0/16"
virtualNetwork:
name: controlplan-vnet
cidrBlock: "10.1.0.0/16"
subnet:
name: controlplan-subnet
cidrBlock: "10.1.1.0/24"

managedCluster: true
selfManagedCluster: false

systemPool:
osDiskSizeGB: 30
sku: Standard_D2s_v3
replica: 1

userPool:
osDiskSizeGB: 30
sku: Standard_D2s_v3
replica: 1

location: centralindia
resourceGroupName: cluster-api
sshPublicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCrRKqLY7bihiRdr8uJnTMcfDMeQ9HOUxYHp7jBbl+Paae2nJ8tzbSGbMk9+Wqw8i5C38rlUolq6Sc1xUUDzWCXB8LCVSsIUrpWUsy5tjlq6U9r8NpypSIon48tNrLdEwtYEf1/5bYA0Y2PFTxtkZcvWtqcor7q9hiejQWrNU3CCVAt8kBGzsieT00YwCrI6AvT+Ko8xjJyDFuunIpliYjyotgXXFF2BohxKEdkuIVpS7iUGQxF993tKQNaMtkKnuU9ijLFhdp41Rk8lSCc1x+oavUbR+ACtbZwlYnc7lcOAJUP3HEQ6ewR5W1zuASlRyR5Mr9sJ0vGf7zbkTAk3VGRlGRVXyU+rZUkqGm71LyKBkptxv32MD/HGbnE81KeJXm7tvLJvr96ssOn3AuBiPEppNAhtqN7Xo/7aYOfkaBxYpddJQ9uhAXdmVTRNnQuRIJK4vWI1o5urJ+1VJ1WawX6QdFOc+3Wbi2JGeyxtweYGIFjcwqkD3gbWtoSb4XLKHE= davesh.sharma@LM2RTXP4K9"
subscriptionID: cce2e9ac-1580-4d82-b79f-a637f5f3e443
additionalTags:
environment: dev
22 changes: 22 additions & 0 deletions argocd-helm-charts/capi-cluster/templates/ccm-azure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if (.Values.provider).azure }}
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: HelmChartProxy
metadata:
name: ccm-azure-{{ .Values.global.clusterName }}
spec:
clusterSelector:
matchLabels:
cluster.x-k8s.io/name: {{ .Values.global.clusterName }}
repoURL: https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo
chartName: cloud-provider-azure
namespace: kube-system
releaseName: cloud-provider-azure
version: 1.30.3
options:
waitForJobs: true
wait: true
timeout: 5m0s
valuesTemplate: |
infra:
clusterName: {{ .Values.global.clusterName }}
{{- end }}
2 changes: 2 additions & 0 deletions argocd-helm-charts/capi-cluster/templates/cilium.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if (.Values.provider).aws }}
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: HelmChartProxy
metadata:
Expand Down Expand Up @@ -44,3 +45,4 @@ spec:
ui:
enabled: true
rollOutPods: true
{{- end }}
16 changes: 16 additions & 0 deletions argocd-helm-charts/capi-cluster/templates/provider-azure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if (.Values.provider).azure }}
# Need to work on this, not completed
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: InfrastructureProvider
metadata:
name: azure-{{ .Values.global.customerid }}
namespace: {{ .Release.Namespace }}
spec:
version: {{ .Values.global.capz.version }}
fetchConfig:
url: https://github.com/kubernetes-sigs/cluster-api-provider-azure/releases/download/{{ .Values.global.capz.version }}/infrastructure-components.yaml
manager:
metrics:
bindAddress: ":8443"
syncPeriod: 10m0s
{{- end }}

0 comments on commit edf3a58

Please sign in to comment.