This repository was archived by the owner on Apr 17, 2025. It is now read-only.
generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 113
feat(helm): initial try at making a helm chart #62
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fc74adf
feat(helm): initial try at making a helm chart
hutchic 60f70b3
fix(helm): the helm chart needs it own directory
hutchic 3cdf743
fix(hnc): use the released hnc manifest not a locally built one
hutchic fc98cf9
PR feedback
hutchic e757ad9
helm: adjust some template variables, added some comments, change nam…
hutchic 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
apiVersion: v2 | ||
name: hnc | ||
description: A Helm chart to install hnc on Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
appVersion: 0.8.0 |
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,66 @@ | ||
{{/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of interest, is there a canonical version of this file? If so, it might be useful to link to it in a comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the current latest that gets generated by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah got it. Maybe add a "Generated by 'helm create chart'" comment unless that'll be overwritten in the future? |
||
File gernated by the `helm create` command | ||
*/}} | ||
|
||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "hnc.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 "hnc.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 "hnc.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "hnc.labels" -}} | ||
helm.sh/chart: {{ include "hnc.chart" . }} | ||
{{ include "hnc.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "hnc.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "hnc.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "hnc.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "hnc.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "hnc.fullname" . }} | ||
labels: | ||
{{- include "hnc.labels" . | nindent 4 }} | ||
annotations: | ||
helm.sh/hook: pre-install,post-delete | ||
rules: | ||
- apiGroups: | ||
- '*' | ||
resources: | ||
- '*' | ||
verbs: | ||
- '*' | ||
- nonResourceURLs: | ||
- '*' | ||
verbs: | ||
- '*' |
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,17 @@ | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "hnc.fullname" . }} | ||
labels: | ||
{{- include "hnc.labels" . | nindent 4 }} | ||
annotations: | ||
helm.sh/hook: pre-install,post-delete | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "hnc.fullname" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "hnc.fullname" . }} | ||
namespace: {{ .Release.Namespace }} |
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,55 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ include "hnc.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "hnc.labels" . | nindent 4 }} | ||
annotations: | ||
helm.sh/hook-weight: "1" | ||
helm.sh/hook: pre-install | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
{{- range .Values.hncExcludeNamespaces }} | ||
- name: labeler-{{ . }} | ||
image: gcr.io/google_containers/hyperkube:v1.9.7 | ||
command: | ||
- kubectl | ||
- label | ||
- ns | ||
- {{ . }} | ||
- hnc.x-k8s.io/excluded-namespace=true | ||
- --overwrite | ||
{{- end }} | ||
restartPolicy: Never | ||
serviceAccountName: {{ include "hnc.fullname" . }} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: hnc | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "hnc.labels" . | nindent 4 }} | ||
annotations: | ||
helm.sh/hook-weight: "1" | ||
helm.sh/hook: post-delete | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
{{- range .Values.hncExcludeNamespaces }} | ||
- name: labeler-{{ . }} | ||
image: gcr.io/google_containers/hyperkube:v1.9.7 | ||
command: | ||
- kubectl | ||
- label | ||
- ns | ||
- {{ . }} | ||
- hnc.x-k8s.io/excluded-namespace- | ||
{{- end }} | ||
restartPolicy: Never | ||
serviceAccountName: {{ include "hnc.fullname" . }} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear on what this is supposed to be. E.g. if we update HNC from v0.8.0 to v0.9.0, should this go from v0.1.0 to v0.2.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my understanding which could be incorrect:
so appVersion should be part of the release process to auto bump it. I guess chart version bumps handled in the PR template as process(?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really have an "auto bump" anywhere but it's fine to just document the process and expect the releaser to follow it. That's what we do for the version numbers in our docs.
As for when we increase the minor vs patch version of the chart, I'm happy to just explain it in the comments right here. E.g.: the chart major/minor/patch versions must increment whenever the corresponding app major/minor/patch version changes, but never needs to be the same as those numbers. For example, if we have chart=0.1.0 and app=0.8.0, and we change the app to 0.9.0, we should change the chart to 0.2.0. But if we change it to 0.8.1, we should change the chart to 0.1.1. In addition, we can increment that chart versions for any other reason at any time.