-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from librepod/update-librepod-chart-library
Update librepod chart library to v 1.0.0
- Loading branch information
Showing
25 changed files
with
1,397 additions
and
100 deletions.
There are no files selected for viewing
This file contains 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 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,33 @@ | ||
{{/* | ||
Main entrypoint for the librepod library chart. It will render all underlying templates based on the provided values. | ||
*/}} | ||
{{- define "librepod.all" -}} | ||
{{- /* Merge the local chart values and the librepod chart defaults */ -}} | ||
{{- include "librepod.values.setup" . }} | ||
|
||
{{ include "librepod.configmap" . | nindent 0 }} | ||
|
||
{{- /* Build the templates */ -}} | ||
{{- include "librepod.pvc" . }} | ||
|
||
{{- if .Values.serviceAccount.create -}} | ||
{{- include "librepod.serviceAccount" . }} | ||
{{- end -}} | ||
|
||
{{- if .Values.controller.enabled }} | ||
{{- if eq .Values.controller.type "deployment" }} | ||
{{- include "librepod.deployment" . | nindent 0 }} | ||
{{ else if eq .Values.controller.type "daemonset" }} | ||
{{- include "librepod.daemonset" . | nindent 0 }} | ||
{{ else if eq .Values.controller.type "statefulset" }} | ||
{{- include "librepod.statefulset" . | nindent 0 }} | ||
{{ else }} | ||
{{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{ include "librepod.service" . | nindent 0 }} | ||
|
||
{{ include "librepod.ingressroute" . | nindent 0 }} | ||
|
||
{{- end -}} |
This file contains 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 |
---|---|---|
@@ -1,13 +1,19 @@ | ||
{{- define "librepod.configmap.tpl" -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "librepod.names.fullname" . }} | ||
labels: | ||
{{- include "librepod.names.labels" . | nindent 4 }} | ||
data: {} | ||
{{- end -}} | ||
|
||
{{/* | ||
Renders the configMap objects required by the chart. | ||
*/}} | ||
{{- define "librepod.configmap" -}} | ||
{{- include "librepod.util.merge" (append . "librepod.configmap.tpl") -}} | ||
{{- end -}} | ||
{{- /* Generate named configMaps as required */ -}} | ||
{{- range $name, $configmap := .Values.configmap }} | ||
{{- if $configmap.enabled -}} | ||
{{- $configmapValues := $configmap -}} | ||
|
||
{{/* set the default nameOverride to the configMap name */}} | ||
{{- if not $configmapValues.nameOverride -}} | ||
{{- $_ := set $configmapValues "nameOverride" $name -}} | ||
{{ end -}} | ||
|
||
{{- $_ := set $ "ObjectValues" (dict "configmap" $configmapValues) -}} | ||
{{- include "librepod.classes.configmap" $ }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains 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 |
---|---|---|
@@ -1,51 +1,56 @@ | ||
{{- define "librepod.deployment" -}} | ||
{{/* | ||
This template serves as the blueprint for the Deployment objects that are created | ||
within the librepod library. | ||
*/}} | ||
{{- define "librepod.deployment" }} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "librepod.names.fullname" . }} | ||
labels: | ||
{{- include "librepod.names.labels" . | nindent 4 }} | ||
{{- include "librepod.labels" . | nindent 4 }} | ||
{{- with .Values.controller.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.controller.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if not .Values.autoscaling.enabled }} | ||
replicas: {{ .Values.replicaCount }} | ||
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }} | ||
replicas: {{ .Values.controller.replicas }} | ||
{{- $strategy := default "Recreate" .Values.controller.strategy }} | ||
{{- if and (ne $strategy "Recreate") (ne $strategy "RollingUpdate") }} | ||
{{- fail (printf "Not a valid strategy type for Deployment (%s)" $strategy) }} | ||
{{- end }} | ||
strategy: | ||
type: {{ $strategy }} | ||
{{- with .Values.controller.rollingUpdate }} | ||
{{- if and (eq $strategy "RollingUpdate") (or .surge .unavailable) }} | ||
rollingUpdate: | ||
{{- with .unavailable }} | ||
maxUnavailable: {{ . }} | ||
{{- end }} | ||
{{- with .surge }} | ||
maxSurge: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "librepod.names.selectorLabels" . | nindent 6 }} | ||
{{- include "librepod.labels.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "librepod.names.selectorLabels" . | nindent 8 }} | ||
{{- include "librepod.labels.selectorLabels" . | nindent 8 }} | ||
{{- with .Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ include "librepod.names.serviceAccountName" . }} | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: {{ template "librepod.names.fullname" . }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: "/config/config.yaml" | ||
subPath: "config.yaml" | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.service.targetPort }} | ||
protocol: TCP | ||
# livenessProbe: | ||
# httpGet: | ||
# path: / | ||
# port: http | ||
# readinessProbe: | ||
# httpGet: | ||
# path: / | ||
# port: http | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- end -}} | ||
{{- include "librepod.controller.pod" . | nindent 6 }} | ||
{{- end }} |
This file contains 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 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,16 @@ | ||
{{/* | ||
Renders the Persistent Volume Claim objects required by the chart. | ||
*/}} | ||
{{- define "librepod.pvc" -}} | ||
{{- /* Generate pvc as required */ -}} | ||
{{- range $index, $PVC := .Values.persistence }} | ||
{{- if and $PVC.enabled (eq (default "pvc" $PVC.type) "pvc") (not $PVC.existingClaim) -}} | ||
{{- $persistenceValues := $PVC -}} | ||
{{- if not $persistenceValues.nameOverride -}} | ||
{{- $_ := set $persistenceValues "nameOverride" $index -}} | ||
{{- end -}} | ||
{{- $_ := set $ "ObjectValues" (dict "persistence" $persistenceValues) -}} | ||
{{- include "librepod.classes.pvc" $ | nindent 0 -}} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains 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 |
---|---|---|
@@ -1,17 +1,43 @@ | ||
{{/* | ||
Renders the Service objects required by the chart. | ||
*/}} | ||
{{- define "librepod.service" -}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "librepod.names.fullname" . }} | ||
labels: | ||
{{- include "librepod.names.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ default "ClusterIP" .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: {{ default .Values.service.port .Values.service.targetPort }} | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "librepod.names.selectorLabels" . | nindent 4 }} | ||
{{- /* Generate named services as required */ -}} | ||
{{- range $name, $service := .Values.service }} | ||
{{- if $service.enabled -}} | ||
{{- $serviceValues := $service -}} | ||
|
||
{{/* set the default nameOverride to the service name */}} | ||
{{- if and (not $serviceValues.nameOverride) (ne $name (include "librepod.service.primary" $)) -}} | ||
{{- $_ := set $serviceValues "nameOverride" $name -}} | ||
{{ end -}} | ||
|
||
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}} | ||
{{- include "librepod.classes.service" $ }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Return the primary service object | ||
*/}} | ||
{{- define "librepod.service.primary" -}} | ||
{{- $enabledServices := dict -}} | ||
{{- range $name, $service := .Values.service -}} | ||
{{- if $service.enabled -}} | ||
{{- $_ := set $enabledServices $name . -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- $result := "" -}} | ||
{{- range $name, $service := $enabledServices -}} | ||
{{- if and (hasKey $service "primary") $service.primary -}} | ||
{{- $result = $name -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- if not $result -}} | ||
{{- $result = keys $enabledServices | first -}} | ||
{{- end -}} | ||
{{- $result -}} | ||
{{- end -}} |
This file contains 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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
{{- define "librepod.serviceAccount" -}} | ||
{{/* | ||
The ServiceAccount object to be created. | ||
*/}} | ||
{{- define "librepod.serviceAccount" }} | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "librepod.names.serviceAccountName" . }} | ||
labels: | ||
{{- include "librepod.names.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
labels: {{- include "librepod.labels" $ | nindent 4 }} | ||
{{- with (merge (.Values.serviceAccount.annotations | default dict) (include "librepod.annotations" $ | fromYaml)) }} | ||
annotations: {{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end -}} | ||
{{- end }} |
Oops, something went wrong.