Skip to content

Commit 5270ca4

Browse files
authored
feat: Add support for Azure CAPI (#687)
* Add recipe and terraform for Azure CAPI * Add helm for Azure CAPI * Add client ID and secret to recipe config * Bump chart version * Add Azure identity helm * Revert last change * Fix secret creation * Pass resource group in terraform * Add aadpodidentity.k8s.io CRDs * Update location, resource group and Kubernetes version * Bump bootstrap-controller version * Bump chart version
1 parent 3d03cc8 commit 5270ca4

File tree

10 files changed

+525
-3
lines changed

10 files changed

+525
-3
lines changed

bootstrap/helm/bootstrap-operator/Chart.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ apiVersion: v2
22
name: bootstrap-operator
33
description: A Helm chart for the bootstrap operator
44
type: application
5-
version: 0.1.8
5+
version: 0.1.12
66
home: https://github.com/pluralsh/plural-helm-charts
77
keywords:
88
- clusterapi
99
- operator
1010
maintainers:
1111
- name: zreigz
1212
- name: floreks
13+
- name: maciaszczykm
14+
1315
appVersion: "0.1.0"

bootstrap/helm/bootstrap-operator/crds/azure-identity.yaml

Lines changed: 418 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{ if eq .Values.provider "azure" }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: cluster-identity-secret
6+
type: Opaque
7+
data:
8+
clientSecret: {{ .Values.operator.clientSecret }}
9+
{{ end }}

bootstrap/helm/bootstrap-operator/values.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ image:
1111
controller:
1212
repository: ghcr.io/pluralsh/bootstrap-controller
1313
pullPolicy: Always
14-
tag: 0.0.7
14+
tag: 0.0.11
1515

1616
imagePullSecrets: []
1717
nameOverride: ""
@@ -61,8 +61,12 @@ tolerations: []
6161

6262
affinity: {}
6363

64+
provider: ""
65+
6466
operator:
6567
clusterName: ""
6668
skipClusterCreation: true
6769
secret: {}
68-
cloud: {}
70+
cloud: {}
71+
# Used by Azure
72+
clientSecret: ""

bootstrap/helm/bootstrap-operator/values.yaml.tpl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
provider: {{ .Provider }}
2+
{{ if eq .Provider "azure" }}
3+
kubernetesVersion: v1.26.3
4+
{{ end }}
15
operator:
26
clusterName: {{ .Cluster }}
37
secret: {}
@@ -83,6 +87,42 @@ operator:
8387
name: variables
8488
key: AWS_SESSION_TOKEN
8589
{{ end }}
90+
{{ if eq .Provider "azure" }}
91+
clientSecret: {{ .Context.ClientSecret | b64enc | quote }}
92+
cloud:
93+
azure:
94+
version: v1.8.2
95+
clusterIdentity:
96+
name: azure-cluster-identity
97+
allowedNamespaces: {}
98+
clientID: {{ .Context.ClientId }}
99+
clientSecret:
100+
name: cluster-identity-secret
101+
namespace: bootstrap
102+
tenantID: {{ .Context.TenantId }}
103+
type: ServicePrincipal
104+
managedCluster: {}
105+
controlPlane:
106+
version: v1.26.3
107+
resourceGroupName: {{ .Project }}
108+
location: {{ .Region }}
109+
sshPublicKey: ''
110+
subscriptionID: {{ .Context.SubscriptionId }}
111+
identityRef:
112+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
113+
kind: AzureClusterIdentity
114+
name: azure-cluster-identity
115+
namespace: bootstrap
116+
machinePools:
117+
- name: pool0
118+
replicas: 1
119+
mode: System
120+
sku: Standard_D2s_v3
121+
- name: pool1
122+
replicas: 2
123+
mode: User
124+
sku: Standard_D2s_v3
125+
{{ end }}
86126
{{ if eq .Provider "google" }}
87127
secret:
88128
GCP_B64ENCODED_CREDENTIALS: {{ .Context.Credentials | quote }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: azure-cluster-api
2+
description: Creates an AKS cluster and installs the bootstrap chart
3+
provider: AZURE
4+
primary: false
5+
private: true
6+
dependencies: []
7+
sections:
8+
- name: bootstrap
9+
configuration:
10+
- name: client_id
11+
documentation: Service principal client ID
12+
type: STRING
13+
- name: client_secret
14+
documentation: Service principal password
15+
type: STRING
16+
items:
17+
- type: TERRAFORM
18+
name: azure-bootstrap-cluster-api
19+
- type: HELM
20+
name: bootstrap
21+
- type: HELM
22+
name: plural-certmanager-webhook
23+
- type: HELM
24+
name: bootstrap-operator
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: plural.sh/v1alpha1
2+
kind: Dependencies
3+
metadata:
4+
description: Creates an AKS cluster and prepares it for bootstrapping
5+
version: 0.1.0
6+
spec:
7+
breaking: true
8+
dependencies: []
9+
providers:
10+
- azure
11+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
data "azurerm_kubernetes_cluster" "cluster" {
2+
name = var.cluster_name
3+
resource_group_name = var.resource_group
4+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cluster_name = {{ .Cluster | quote }}
2+
resource_group = {{ .Project | quote }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
variable "cluster_name" {
2+
type = string
3+
default = "plural"
4+
}
5+
6+
variable "resource_group" {
7+
type = string
8+
}

0 commit comments

Comments
 (0)