Skip to content

Commit

Permalink
feat(bootstrap): add capz chart (#825)
Browse files Browse the repository at this point in the history
Signed-off-by: David van der Spek <[email protected]>
  • Loading branch information
davidspek authored Sep 5, 2023
1 parent 0ff9bed commit a30cdc9
Show file tree
Hide file tree
Showing 24 changed files with 5,649 additions and 0 deletions.
23 changes: 23 additions & 0 deletions bootstrap/helm/cluster-api-provider-azure/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions bootstrap/helm/cluster-api-provider-azure/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: cluster-api-provider-azure
repository: https://pluralsh.github.io/capi-helm-charts
version: 0.1.8
digest: sha256:a121b432405288d78644e268fab20ac4369a2bfd13084094b9de9e0f65c05ad1
generated: "2023-08-24T17:11:19.117169+02:00"
10 changes: 10 additions & 0 deletions bootstrap/helm/cluster-api-provider-azure/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: cluster-api-provider-azure
description: A Helm chart for Kubernetes
type: application
version: 0.1.11
appVersion: v1.10.2
dependencies:
- name: cluster-api-provider-azure
version: 0.1.8
repository: https://pluralsh.github.io/capi-helm-charts
3 changes: 3 additions & 0 deletions bootstrap/helm/cluster-api-provider-azure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Cluster API Provider Azure

A helm chart that deploys the Cluster API Provider for Azure
Binary file not shown.
7 changes: 7 additions & 0 deletions bootstrap/helm/cluster-api-provider-azure/deps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: plural.sh/v1alpha1
kind: Dependencies
metadata:
application: true
description: installs the cluster api provider azure
spec:
dependencies: []
24 changes: 24 additions & 0 deletions bootstrap/helm/cluster-api-provider-azure/scripts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
AZURE_VERSION=v1.9.14

azure:
# Clean current CRDs
rm -rf ../templates/*-crd.yaml
mkdir tmp
wget https://github.com/pluralsh/cluster-api-provider-azure/releases/download/${AZURE_VERSION}/infrastructure-components.yaml
# This rewrites the data to stringData in the secret
yq 'select(.kind == "Secret") | .stringData += .data | del(.data)' infrastructure-components.yaml > tmp.yaml
# This removes the Secret from the yaml
yq 'del( select(.kind == "Secret"))' infrastructure-components.yaml > tmp2.yaml

# This combines the yaml files back together
yq eval-all tmp.yaml tmp2.yaml > infrastructure-components.yaml

cat infrastructure-components.yaml | helmify -generate-defaults -image-pull-secrets tmp/cluster-api-provider-azure
rm infrastructure-components.yaml tmp.yaml tmp2.yaml
yq -i ".appVersion=\"${AZURE_VERSION}\"" ../Chart.yaml

# This removes the Azure credentials from the values.yaml since it is being set by managerBootstrapCredentials.credentials instead
yq -i "del(.configVariables.azureClientIdB64) | del(.configVariables.azureClientSecretB64) | del(.configVariables.azureSubscriptionIdB64) | del(.configVariables.azureTenantIdB64)" tmp/cluster-api-provider-azure/values.yaml

mv tmp/cluster-api-provider-azure/templates/*-crd.yaml ../templates/
rm -rf tmp/
62 changes: 62 additions & 0 deletions bootstrap/helm/cluster-api-provider-azure/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cluster-api-provider-azure-plural.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cluster-api-provider-azure-plural.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cluster-api-provider-azure-plural.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cluster-api-provider-azure-plural.labels" -}}
helm.sh/chart: {{ include "cluster-api-provider-azure-plural.chart" . }}
{{ include "cluster-api-provider-azure-plural.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cluster-api-provider-azure-plural.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cluster-api-provider-azure-plural.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cluster-api-provider-azure-plural.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cluster-api-provider-azure-plural.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading

0 comments on commit a30cdc9

Please sign in to comment.