-
Notifications
You must be signed in to change notification settings - Fork 124
Helm: add support for auto upgrading CRDs #789
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
117c3df
Helm: add support for auto upgrading CRDs
benashz 193d7b9
Preserve symlinks and directories
benashz 879d271
Work around limitations with actions-docker-build
benashz 76aa42b
Cache go modules
benashz 09534f2
Revert "Cache go modules"
benashz 8eeff1a
Set the exit code to 1 on error
benashz 92d88c9
Misc fixups
benashz 9ebc460
Add chart tests
benashz 9d98f24
Add chart integration Go tests
benashz 44d097c
Update CI
benashz 2858e87
Use VERSION and IMAGE_TAG_BASE instead of IMG
benashz d088232
Support multi-doc YAML manifests
benashz 9b5c3a1
Post review updates
benashz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,116 @@ | ||
{{- /* | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
*/ -}} | ||
|
||
{{- if .Values.hooks.upgradeCRDs.enabled -}} | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ template "vso.chart.fullname" . }}-upgrade-crds | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app.kubernetes.io/component: controller-manager | ||
{{ include "vso.chart.labels" . | indent 4 }} | ||
annotations: | ||
helm.sh/hook: pre-upgrade | ||
helm.sh/hook-delete-policy: "hook-succeeded,before-hook-creation" | ||
helm.sh/hook-weight: "1" | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ template "vso.chart.fullname" . }}-upgrade-crds | ||
labels: | ||
app.kubernetes.io/component: rbac | ||
{{ include "vso.chart.labels" . | indent 4 }} | ||
annotations: | ||
helm.sh/hook: pre-upgrade | ||
helm.sh/hook-delete-policy: "hook-succeeded,before-hook-creation" | ||
helm.sh/hook-weight: "2" | ||
rules: | ||
- apiGroups: | ||
- apiextensions.k8s.io | ||
resources: | ||
- customresourcedefinitions | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ template "vso.chart.fullname" . }}-upgrade-crds | ||
labels: | ||
app.kubernetes.io/component: rbac | ||
{{ include "vso.chart.labels" . | indent 4 }} | ||
annotations: | ||
helm.sh/hook: pre-upgrade | ||
helm.sh/hook-delete-policy: "hook-succeeded,before-hook-creation" | ||
helm.sh/hook-weight: "2" | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ template "vso.chart.fullname" . }}-upgrade-crds | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
kind: ClusterRole | ||
name: {{ template "vso.chart.fullname" . }}-upgrade-crds | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ printf "%s-%s" "upgrade-crds" (include "vso.chart.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app.kubernetes.io/component: controller-manager | ||
{{- include "vso.chart.labels" . | nindent 4 }} | ||
annotations: | ||
# This is what defines this resource as a hook. Without this line, the | ||
# job is considered part of the release. | ||
helm.sh/hook: pre-upgrade | ||
helm.sh/hook-delete-policy: "hook-succeeded,before-hook-creation" | ||
helm.sh/hook-weight: "99" | ||
{{- if .Values.controller.annotations }} | ||
{{- toYaml .Values.controller.annotations | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
backoffLimit: {{ .Values.hooks.upgradeCRDs.backoffLimit | default 5 }} | ||
template: | ||
metadata: | ||
name: {{ printf "%s-%s" "upgrade-crds" (include "vso.chart.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
spec: | ||
serviceAccountName: {{ template "vso.chart.fullname" . }}-upgrade-crds | ||
securityContext: | ||
{{- toYaml .Values.controller.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: pre-upgrade-crds | ||
image: {{ .Values.controller.manager.image.repository }}:{{ .Values.controller.manager.image.tag }} | ||
env: | ||
- name: VSO_UPGRADE_CRDS_TIMEOUT | ||
value: {{ .Values.hooks.upgradeCRDs.executionTimeout }} | ||
command: | ||
- /scripts/upgrade-crds | ||
{{- with .Values.hooks.resources }} | ||
resources: | ||
{{- toYaml . | nindent 10 }} | ||
{{- end}} | ||
{{- with .Values.controller.securityContext }} | ||
securityContext: | ||
{{- toYaml .| nindent 10 }} | ||
{{- end}} | ||
restartPolicy: Never | ||
{{- with .Values.controller.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.controller.tolerations }} | ||
tolerations: | ||
{{- toYaml .| nindent 8 }} | ||
{{- end }} | ||
{{- end -}} |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.