Initial commit
This commit is contained in:
16
templates/NOTES.txt
Normal file
16
templates/NOTES.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
Successfully installed OpenEBS.
|
||||
|
||||
Check the status by running: kubectl get pods -n {{ .Release.Namespace }}
|
||||
|
||||
The default values will install both Local PV and Replicated PV. However,
|
||||
the Replicated PV will require additional configuration to be fuctional.
|
||||
The Local PV offers non-replicated local storage using 3 different storage
|
||||
backends i.e Hostpath, LVM and ZFS, while the Replicated PV provides one replicated highly-available
|
||||
storage backend i.e Mayastor.
|
||||
|
||||
For more information,
|
||||
- view the online documentation at https://openebs.io/docs
|
||||
- connect with an active community on our Kubernetes slack channel.
|
||||
- Sign up to Kubernetes slack: https://slack.k8s.io
|
||||
- #openebs channel: https://kubernetes.slack.com/messages/openebs
|
||||
93
templates/_helpers.tpl
Normal file
93
templates/_helpers.tpl
Normal file
@@ -0,0 +1,93 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "openebs.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 "openebs.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 "openebs.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "openebs.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "openebs.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Define meta labels for openebs components
|
||||
*/}}
|
||||
{{- define "openebs.common.metaLabels" -}}
|
||||
chart: {{ template "openebs.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
openebs.io/version: {{ .Values.release.version | quote }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns matched if the Hostpath Localpv Deployment is of v3.x
|
||||
Usage:
|
||||
{{- if include "hostpath_is_v3" . }}
|
||||
Do something
|
||||
{{- end }}
|
||||
*/}}
|
||||
{{- define "hostpath_is_v3" -}}
|
||||
{{/* Name from https://github.com/openebs/charts/blob/openebs-3.10.0/charts/openebs/templates/localprovisioner/deployment-local-provisioner.yaml#L8 */}}
|
||||
{{- $name1 := printf "%s-localpv-provisioner" (include "openebs.fullname" .) -}}
|
||||
{{/* Name from https://github.com/openebs/dynamic-localpv-provisioner/blob/v4.3.0/deploy/helm/charts/templates/deployment.yaml#L5 */}}
|
||||
{{- $sub := index .Subcharts "localpv-provisioner" -}}
|
||||
{{- $name2 := include "localpv.fullname" $sub -}}
|
||||
|
||||
{{/* Lookup Deployment by name1, fallback to name2 */}}
|
||||
{{- $deploy := lookup "apps/v1" "Deployment" .Release.Namespace $name1 -}}
|
||||
{{- if not $deploy -}}
|
||||
{{- $deploy = lookup "apps/v1" "Deployment" .Release.Namespace $name2 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $deploy -}}
|
||||
{{/* There just is no localpv-provisioner deployment. This is unexpected. We err on the side of caution and match */}}
|
||||
matched
|
||||
{{- else -}}
|
||||
{{/* Validate chart label matches v3.x.y */}}
|
||||
{{- if and $deploy.metadata $deploy.metadata.labels -}}
|
||||
{{- $chart := index $deploy.metadata.labels "chart" | default "" -}}
|
||||
{{- if regexMatch "^(openebs|localpv-provisioner)-3\\.[0-9]+\\.[0-9]+.*$" $chart -}}
|
||||
matched
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{/*
|
||||
Localpv deployment exists, but doesn't have .metadata or .metadata.labels for some reason.
|
||||
This may happen in a dry-run due to how lookup behaves. Erring on the side of caution and matching.
|
||||
*/}}
|
||||
matched
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
33
templates/loki-storage/storage/localpv-storageclass.yaml
Normal file
33
templates/loki-storage/storage/localpv-storageclass.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- if and (.Values.loki.localpvScConfig.enabled) (.Values.loki.singleBinary.persistence.enabled) (.Values.loki.enabled) }}
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
annotations:
|
||||
cas.openebs.io/config: |
|
||||
- name: StorageType
|
||||
value: "hostpath"
|
||||
- name: BasePath
|
||||
value: {{ tpl ( .Values.loki.localpvScConfig.loki.basePath | quote ) . }}
|
||||
openebs.io/cas-type: local
|
||||
name: {{ tpl .Values.loki.localpvScConfig.loki.name . | required "StorageClass name for loki localpv storage cannot be empty" }}
|
||||
provisioner: openebs.io/local
|
||||
reclaimPolicy: {{ .Values.loki.localpvScConfig.loki.reclaimPolicy }}
|
||||
volumeBindingMode: {{ .Values.loki.localpvScConfig.loki.volumeBindingMode }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if and (.Values.loki.localpvScConfig.enabled) (.Values.loki.minio.persistence.enabled) (.Values.loki.enabled) }}
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
annotations:
|
||||
cas.openebs.io/config: |
|
||||
- name: StorageType
|
||||
value: "hostpath"
|
||||
- name: BasePath
|
||||
value: {{ tpl ( .Values.loki.localpvScConfig.minio.basePath | quote ) . }}
|
||||
openebs.io/cas-type: local
|
||||
name: {{ tpl .Values.loki.localpvScConfig.minio.name . | required "StorageClass name for loki localpv storage cannot be empty" }}
|
||||
provisioner: openebs.io/local
|
||||
reclaimPolicy: {{ .Values.loki.localpvScConfig.minio.reclaimPolicy }}
|
||||
volumeBindingMode: {{ .Values.loki.localpvScConfig.minio.volumeBindingMode }}
|
||||
{{- end }}
|
||||
115
templates/pre-upgrade-hook.yaml
Normal file
115
templates/pre-upgrade-hook.yaml
Normal file
@@ -0,0 +1,115 @@
|
||||
{{- if .Values.preUpgradeHook.enabled }}
|
||||
{{- if .Release.IsUpgrade }}
|
||||
{{- if include "hostpath_is_v3" . }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: openebs-pre-upgrade-hook
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
annotations:
|
||||
"helm.sh/hook": pre-upgrade
|
||||
"helm.sh/hook-weight": "-2"
|
||||
{{- with .Values.preUpgradeHook.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: openebs-pre-upgrade-hook
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
annotations:
|
||||
"helm.sh/hook": pre-upgrade
|
||||
"helm.sh/hook-weight": "-2"
|
||||
{{- with .Values.preUpgradeHook.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["get", "patch"]
|
||||
- apiGroups: ["apps"]
|
||||
resources: ["deployments"]
|
||||
verbs: ["delete", "list"]
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: openebs-pre-upgrade-hook
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
annotations:
|
||||
"helm.sh/hook": pre-upgrade
|
||||
"helm.sh/hook-weight": "-1"
|
||||
{{- with .Values.preUpgradeHook.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: openebs-pre-upgrade-hook
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: openebs-pre-upgrade-hook
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "openebs-pre-upgrade-hook"
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
annotations:
|
||||
"helm.sh/hook": pre-upgrade
|
||||
"helm.sh/hook-weight": "0"
|
||||
{{- with .Values.preUpgradeHook.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: "openebs-pre-upgrade-hook"
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
{{- with .Values.preUpgradeHook.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceAccountName: "openebs-pre-upgrade-hook"
|
||||
{{- with .Values.preUpgradeHook.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: pre-upgrade-job
|
||||
image: {{ .Values.preUpgradeHook.image.registry }}/{{ .Values.preUpgradeHook.image.repo }}:{{ .Values.preUpgradeHook.image.tag }}
|
||||
imagePullPolicy: {{ .Values.preUpgradeHook.image.pullPolicy }}
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
args:
|
||||
- "(kubectl annotate --overwrite crd volumesnapshots.snapshot.storage.k8s.io volumesnapshotclasses.snapshot.storage.k8s.io volumesnapshotcontents.snapshot.storage.k8s.io helm.sh/resource-policy=keep || true) && (kubectl -n {{ .Release.Namespace }} delete deploy -l openebs.io/component-name=openebs-localpv-provisioner --ignore-not-found)"
|
||||
{{- if .Values.preUpgradeHook.imagePullSecrets }}
|
||||
imagePullSecrets: {{ toYaml .Values.preUpgradeHook.imagePullSecrets | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user