Add helm-controller to addons chart
This commit is contained in:
parent
a61a283532
commit
1c36f5e3de
23
charts/cluster-addons/.helmignore
Normal file
23
charts/cluster-addons/.helmignore
Normal file
@ -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/
|
5
charts/cluster-addons/Chart.yaml
Normal file
5
charts/cluster-addons/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v2
|
||||
name: cluster-addons
|
||||
description: Helm chart for deploying cluster addons for a CAPI cluster.
|
||||
type: application
|
||||
version: 0.1.0
|
42
charts/cluster-addons/crds/helmchart.yaml
Normal file
42
charts/cluster-addons/crds/helmchart.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: helmcharts.helm.cattle.io
|
||||
namespace: kube-system
|
||||
spec:
|
||||
group: helm.cattle.io
|
||||
version: v1
|
||||
additionalPrinterColumns:
|
||||
- name: Job
|
||||
type: string
|
||||
description: Job associated with updates to this chart
|
||||
JSONPath: .status.jobName
|
||||
- name: Chart
|
||||
type: string
|
||||
description: Helm Chart name
|
||||
JSONPath: .spec.chart
|
||||
- name: TargetNamespace
|
||||
type: string
|
||||
description: Helm Chart target namespace
|
||||
JSONPath: .spec.targetNamespace
|
||||
- name: Version
|
||||
type: string
|
||||
description: Helm Chart version
|
||||
JSONPath: .spec.version
|
||||
- name: Repo
|
||||
type: string
|
||||
description: Helm Chart repository URL
|
||||
JSONPath: .spec.repo
|
||||
- name: HelmVersion
|
||||
type: string
|
||||
description: Helm version used to manage the selected chart
|
||||
JSONPath: .spec.helmVersion
|
||||
- name: Bootstrap
|
||||
type: boolean
|
||||
description: True if this is chart is needed to bootstrap the cluster
|
||||
JSONPath: .spec.bootstrap
|
||||
names:
|
||||
kind: HelmChart
|
||||
plural: helmcharts
|
||||
singular: helmchart
|
||||
scope: Namespaced
|
82
charts/cluster-addons/templates/_helpers.tpl
Normal file
82
charts/cluster-addons/templates/_helpers.tpl
Normal file
@ -0,0 +1,82 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "cluster-addons.name" -}}
|
||||
{{- .Chart.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
*/}}
|
||||
{{- define "cluster-addons.fullname" -}}
|
||||
{{- if contains .Chart.Name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a fully qualified component name.
|
||||
*/}}
|
||||
{{- define "cluster-addons.componentName" -}}
|
||||
{{- $ctx := index . 0 -}}
|
||||
{{- $componentName := index . 1 -}}
|
||||
{{- if contains $ctx.Chart.Name $ctx.Release.Name }}
|
||||
{{- printf "%s-%s" $ctx.Release.Name $componentName | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s-%s" $ctx.Release.Name $ctx.Chart.Name $componentName | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "cluster-addons.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels for a chart-level resource.
|
||||
*/}}
|
||||
{{- define "cluster-addons.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "cluster-addons.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels for a component-level resource.
|
||||
*/}}
|
||||
{{- define "cluster-addons.componentSelectorLabels" -}}
|
||||
{{- $ctx := index . 0 -}}
|
||||
{{- $componentName := index . 1 -}}
|
||||
{{- include "cluster-addons.selectorLabels" $ctx -}}
|
||||
app.kubernetes.io/component: {{ $componentName }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Common labels for all resources.
|
||||
*/}}
|
||||
{{- define "cluster-addons.commonLabels" -}}
|
||||
helm.sh/chart: {{ include "cluster-addons.chart" . }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Labels for a chart-level resource.
|
||||
*/}}
|
||||
{{- define "cluster-addons.labels" -}}
|
||||
{{- include "cluster-addons.commonLabels" . -}}
|
||||
{{- include "cluster-addons.selectorLabels" . -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Component labels
|
||||
*/}}
|
||||
{{- define "cluster-addons.componentLabels" -}}
|
||||
{{- include "cluster-addons.commonLabels" (index . 0) -}}
|
||||
{{- include "cluster-addons.componentSelectorLabels" . -}}
|
||||
{{- end -}}
|
@ -0,0 +1,41 @@
|
||||
---
|
||||
{{- $values := .Values.helmController -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "cluster-addons.componentName" (list . "helm-controller") }}
|
||||
labels: {{ include "cluster-addons.componentLabels" (list . "helm-controller") | nindent 4 }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels: {{ include "cluster-addons.componentSelectorLabels" (list . "helm-controller") | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels: {{ include "cluster-addons.componentSelectorLabels" (list . "helm-controller") | nindent 8 }}
|
||||
{{- with $values.podAnnotations }}
|
||||
annotations: {{ toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
containers:
|
||||
- name: helm-controller
|
||||
image: {{ printf "%s:%s" $values.image.repository $values.image.tag }}
|
||||
imagePullPolicy: {{ $values.image.pullPolicy }}
|
||||
command: ["helm-controller"]
|
||||
{{- with $values.securityContext }}
|
||||
securityContext: {{ toYaml $values.securityContext | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with $values.resources }}
|
||||
resources: {{ toYaml $values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with $values.podSecurityContext }}
|
||||
securityContext: {{ toYaml $values.podSecurityContext | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $values.nodeSelector }}
|
||||
nodeSelector: {{ toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $values.affinity }}
|
||||
affinity: {{ toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $values.tolerations }}
|
||||
tolerations: {{ toYaml . | nindent 8 }}
|
||||
{{- end }}
|
5
charts/cluster-addons/values.yaml
Normal file
5
charts/cluster-addons/values.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
helmController:
|
||||
image:
|
||||
repository: rancher/helm-controller
|
||||
tag: v0.1.2
|
||||
pullPolicy: IfNotPresent
|
Loading…
x
Reference in New Issue
Block a user