Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚠️ Use v1alpha2 manifests in the helm chart #220

Merged
merged 2 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ metadata:
"helm.sh/hook-weight": "1"
name: capi-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
name: cluster-api
namespace: capi-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if .Values.secretName }}
{{- with .Values.configSecret }}
spec:
secretName: {{ .Values.secretName }}
{{- if .Values.secretNamespace }}
secretNamespace: {{ .Values.secretNamespace }}
{{- end }}
configSecret:
name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
Comment on lines +23 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while I have not tested this and all other changes regarding helm charts, just wanna raise a voice that we have had issues with it recently and if we tested templating changes locally at least?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I tested this PR locally, plus we have some e2e tests in place.
The issue there happened because I put the object in the wrong section, so it's not strictly related... I wonder if we can introduce https://github.com/yannh/kubeconform to verify templates we generate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d recommend using chart tester for that purpose, it has support for linting and verification - https://github.com/helm/chart-testing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, I'll add chart-testing support in another PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

{{- end }}
{{- end }}
{{- end }}
15 changes: 8 additions & 7 deletions hack/charts/cluster-api-operator/templates/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,26 @@ metadata:
"helm.sh/hook-weight": "1"
name: {{ $bootstrapNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: BootstrapProvider
metadata:
name: {{ $bootstrapName }}
namespace: {{ $bootstrapNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if or $bootstrapVersion $.Values.secretName }}
{{- if or $bootstrapVersion $.Values.configSecret.name }}
spec:
{{- end}}
{{- if $bootstrapVersion }}
version: {{ $bootstrapVersion }}
{{- end }}
{{- if $.Values.secretName }}
secretName: {{ $.Values.secretName }}
{{- end }}
{{- if $.Values.secretNamespace }}
secretNamespace: {{ $.Values.secretNamespace }}
{{- if $.Values.configSecret.name }}
configSecret:
name: {{ $.Values.configSecret.name }}
{{- if $.Values.configSecret.namespace }}
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ metadata:
"helm.sh/hook-weight": "1"
name: capi-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
name: cluster-api
namespace: capi-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if .Values.secretName }}
{{- with .Values.configSecret }}
spec:
secretName: {{ .Values.secretName }}
{{- if .Values.secretNamespace }}
secretNamespace: {{ .Values.secretNamespace }}
{{- end }}
configSecret:
name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
15 changes: 8 additions & 7 deletions hack/charts/cluster-api-operator/templates/control-plane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,26 @@ metadata:
"helm.sh/hook-weight": "1"
name: {{ $controlPlaneNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: ControlPlaneProvider
metadata:
name: {{ $controlPlaneName }}
namespace: {{ $controlPlaneNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if or $controlPlaneVersion $.Values.secretName }}
{{- if or $controlPlaneVersion $.Values.configSecret.name }}
spec:
{{- end}}
{{- if $controlPlaneVersion }}
version: {{ $controlPlaneVersion }}
{{- end }}
{{- if $.Values.secretName }}
secretName: {{ $.Values.secretName }}
{{- end }}
{{- if $.Values.secretNamespace }}
secretNamespace: {{ $.Values.secretNamespace }}
{{- if $.Values.configSecret.name }}
configSecret:
name: {{ $.Values.configSecret.name }}
{{- if $.Values.configSecret.namespace }}
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
15 changes: 8 additions & 7 deletions hack/charts/cluster-api-operator/templates/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,25 @@ metadata:
"helm.sh/hook-weight": "1"
name: {{ $coreNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
name: {{ $coreName }}
namespace: {{ $coreNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if or $coreVersion .Values.secretName }}
{{- if or $coreVersion $.Values.configSecret.name }}
spec:
{{- end}}
{{- if $coreVersion }}
version: {{ $coreVersion }}
{{- end }}
{{- if .Values.secretName }}
secretName: {{ .Values.secretName }}
{{- end }}
{{- if .Values.secretNamespace }}
secretNamespace: {{ .Values.secretNamespace }}
{{- if $.Values.configSecret.name }}
configSecret:
name: {{ $.Values.configSecret.name }}
{{- if $.Values.configSecret.namespace }}
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- end }}
43 changes: 25 additions & 18 deletions hack/charts/cluster-api-operator/templates/infra-conditions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.infrastructure }}

# Deploy core, bootstrap, and infrastructure components if not specified
{{- if not .Values.core }}
---
Expand All @@ -10,22 +11,24 @@ metadata:
"helm.sh/hook-weight": "1"
name: capi-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
name: cluster-api
namespace: capi-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if .Values.secretName }}
{{- with .Values.configSecret }}
spec:
secretName: {{ .Values.secretName }}
{{- if .Values.secretNamespace }}
secretNamespace: {{ .Values.secretNamespace }}
{{- end }}
configSecret:
name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
{{- end }}
{{- end }}

{{- if not .Values.bootstrap }}
---
apiVersion: v1
Expand All @@ -36,22 +39,24 @@ metadata:
"helm.sh/hook-weight": "1"
name: capi-kubeadm-bootstrap-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: BootstrapProvider
metadata:
name: kubeadm
namespace: capi-kubeadm-bootstrap-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if .Values.secretName }}
{{- with .Values.configSecret }}
spec:
secretName: {{ .Values.secretName }}
{{- if .Values.secretNamespace }}
secretNamespace: {{ .Values.secretNamespace }}
{{- end }}
configSecret:
name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
{{- end }}
{{- end }}

{{- if not .Values.controlPlane }}
---
apiVersion: v1
Expand All @@ -62,20 +67,22 @@ metadata:
"helm.sh/hook-weight": "1"
name: capi-kubeadm-control-plane-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: ControlPlaneProvider
metadata:
name: kubeadm
namespace: capi-kubeadm-control-plane-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if .Values.secretName }}
{{- with .Values.configSecret }}
spec:
secretName: {{ .Values.secretName }}
{{- if .Values.secretNamespace }}
secretNamespace: {{ .Values.secretNamespace }}
{{- end }}
configSecret:
name: {{ .name }}
{{- if .namespace }}
namespace: {{ .namespace }}
{{- end }}
{{- end }}
{{- end }}

{{- end }}
15 changes: 8 additions & 7 deletions hack/charts/cluster-api-operator/templates/infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,26 @@ metadata:
"helm.sh/hook-weight": "1"
name: {{ $infrastructureNamespace }}
---
apiVersion: operator.cluster.x-k8s.io/v1alpha1
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: InfrastructureProvider
metadata:
name: {{ $infrastructureName }}
namespace: {{ $infrastructureNamespace }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
{{- if or $infrastructureVersion $.Values.secretName }}
{{- if or $infrastructureVersion $.Values.configSecret.name }}
spec:
{{- end }}
{{- if $infrastructureVersion }}
version: {{ $infrastructureVersion }}
{{- end }}
{{- if $.Values.secretName }}
secretName: {{ $.Values.secretName }}
{{- end }}
{{- if $.Values.secretNamespace }}
secretNamespace: {{ $.Values.secretNamespace }}
{{- if $.Values.configSecret.name }}
configSecret:
name: {{ $.Values.configSecret.name }}
{{- if $.Values.configSecret.namespace }}
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions hack/charts/cluster-api-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ controlPlane: ""
infrastructure: ""
# ---
# Common configuration secret options
secretName: ""
secretNamespace: ""
configSecret: {}
# ---
# CAPI operator deployment options
logLevel: 2
Expand Down
Loading