update some indentation

This commit is contained in:
Stavros kois
2022-11-10 18:19:06 +02:00
parent b9859a28fc
commit cd40293d4b
13 changed files with 93 additions and 60 deletions

View File

@@ -10,4 +10,4 @@ tests:
isKind:
of: Deployment
TODO: ports
#TODO: ports

View File

@@ -175,7 +175,7 @@ tests:
set:
persistence.some_volume.type: nfs
persistence.some_volume.enabled: true
persistence.some_volume.enabled: some_path
persistence.some_volume.path: some_path
asserts:
- failedTemplate:
errorMessage: NFS Server not set on item some_volume

View File

@@ -5,7 +5,7 @@ Rendered under ".metadata.annotations"
{{- define "ix.v1.common.annotations" -}}
{{- with .Values.global.annotations -}}
{{- range $k, $v := . }}
{{ $k }}: {{ tpl $v $ | quote }}
{{- $k | nindent 6 }}: {{ tpl $v $ | quote }}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -28,6 +28,4 @@ Rendered under ".metadata.annotations"
rollme: {{ randAlphaNum 5 | quote }}
{{- end -}}
{{/*
Workloads = Deployment, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob, etc
*/}}
{{/* Workloads = Deployment, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob, etc */}}

View File

@@ -1,34 +1,24 @@
{{/*
Return the appropriate apiVersion for deployment
*/}}
{{/* Return the appropriate apiVersion for deployment */}}
{{- define "ix.v1.common.capabilities.deployment.apiVersion" -}}
{{- print "apps/v1" -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for statefulset
*/}}
{{/* Return the appropriate apiVersion for statefulset */}}
{{- define "ix.v1.common.capabilities.statefulset.apiVersion" -}}
{{- print "apps/v1" -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for daemonset
*/}}
{{/* Return the appropriate apiVersion for daemonset */}}
{{- define "ix.v1.common.capabilities.daemonset.apiVersion" -}}
{{- print "apps/v1" -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for CronJob
*/}}
{{/* Return the appropriate apiVersion for CronJob */}}
{{- define "ix.v1.common.capabilities.cronJob.apiVersion" -}}
{{- print "batch/v1" -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for Job
*/}}
{{/* Return the appropriate apiVersion for Job */}}
{{- define "ix.v1.common.capabilities.job.apiVersion" -}}
{{- print "batch/v1" -}}
{{- end -}}

View File

@@ -7,18 +7,18 @@ helm-revision: {{ .Release.Revision | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.global.labels }}
{{- range $k, $v := . }}
{{ $k }}: {{ tpl $v $ | quote }}
{{- with .Values.global.labels }}
{{- range $k, $v := . }}
{{- $k | nindent 0 }}: {{ tpl $v $ | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
{{/* Selector labels shared across objects */}}
{{/* TODO: Check why "app" and "release" are needed (ported from the current common) */}}
{{- define "ix.v1.common.labels.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ix.v1.common.names.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{/* TODO: Check why those are needed (ported from the current common) */}}
app: {{ include "ix.v1.common.names.name" . }}
release: {{ .Release.Name }}
{{- end -}}

View File

@@ -4,9 +4,7 @@ global.nameOverride applies to the current chart and all sub-charts
nameOverride applies only to the current chart
*/}}
{{/*
Expand ther name of the chart
*/}}
{{/* Expand ther name of the chart */}}
{{- define "ix.v1.common.names.name" -}}
{{- $globalNameOverride := "" -}}
{{- if hasKey .Values "global" -}}
@@ -17,9 +15,7 @@ Expand ther name of the chart
{{- default .Chart.Name (default .Values.nameOverride $globalNameOverride) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
*/}}
{{/* Create a default fully qualified app name. */}}
{{- define "ix.v1.common.names.fullname" -}}
{{- $name := include "ix.v1.common.names.name" . -}}
{{- $globalFullNameOverride := "" -}}
@@ -43,24 +39,17 @@ Create a default fully qualified app name.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the "name" + "." + "namespace" fqdn
*/}}
{{/* Create the "name" + "." + "namespace" fqdn */}}
{{- define "ix.v1.common.names.fqdn" -}}
{{- printf "%s.%s" (include "ix.v1.common.names.fullname" .) .Release.Namespace | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the "fqdn" + "." + "svc.cluster.local"
*/}}
{{/* Create the "fqdn" + "." + "svc.cluster.local" */}}
{{- define "ix.v1.common.names.fqdn.cluster" -}}
{{- printf "%s.%s" (include "ix.v1.common.names.fqdn" .) "svc.cluster.local" -}}
{{- end -}}
{{/*
TODO: See if it's needed
Return the properly cased version of the controller type
*/}}
{{/* Return the properly cased version of the controller type */}}
{{- define "ix.v1.common.names.controllerType" -}}
{{- if eq (.Values.controller.type | lower) "deployment" -}}
{{- print "Deployment" -}}

View File

@@ -0,0 +1,40 @@
{{/* The main container included in the controller */}}
{{- define "ix.v1.common.controller.mainContainer" -}}
- name: {{ include "ix.v1.common.names.fullname" . }}
image: TODO:!!
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.command }}
command:
{{- if kindIs "string" . }}
- {{ tpl . $ }}
{{- else }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- if or (.Values.extraArgs) (.Values.args) }}
args:
{{/* args usually defined while developing the chart */}}
{{- with .Values.args }}
{{- if kindIs "string" . }}
- {{ tpl . $ }}
{{- else }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}
{{/* extraArgs used in cases that users wants to APPEND to args */}}
{{- with .Values.extraArgs }}
{{- if kindIs "string" . }}
- {{ tpl . $ }}
{{- else }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.tty }}
tty: {{ . }}
{{- end }}
{{- with .Values.stdin }}
stdin: {{ . }}
{{- end }}
{{- end -}}

View File

@@ -1,9 +1,9 @@
{{/*
The pod definition included in the controller.
*/}}
{{/* The pod definition included in the controller. */}}
{{- define "ix.v1.common.controller.pod" -}}
{{- with (include "ix.v1.common.controller.volumes" . | trim) }}
containers:
{{- include "ix.v1.common.controller.mainContainer" . | nindent 2 }}
{{- with (include "ix.v1.common.controller.volumes" . | trim) }}
volumes:
{{- . | nindent 2 }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -1,6 +1,4 @@
{{/*
Ports included by the controller.
*/}}
{{/* Ports included by the controller. */}}
{{- define "ix.v1.common.controller.ports" -}}
{{ $ports := list }}
{{- range .Values.service -}}
@@ -12,9 +10,7 @@ Ports included by the controller.
{{- end -}}
{{- end -}}
{{/*
Render the list of ports
*/}}
{{/* Render the list of ports */}}
{{- if $ports -}}
{{- range $_ := $ports }}
{{- if .enabled }}
@@ -27,6 +23,9 @@ Render the list of ports
This is for cases where port (that container listens)
can be dynamically configured via an env var.
*/}}
{{- if not .port }}
{{- fail (printf "Port is required on enabled services. Service: (%s)" .name) }}
{{- end }}
containerPort: {{ default .port .targetPort }}
{{- with .protocol }}
{{- if or (eq (. | upper) "HTTP") (eq (. | upper) "HTTPS") (eq (. | upper) "TCP") }}

View File

@@ -1,6 +1,4 @@
{{/*
Probes selection logic.
*/}}
{{/* Probes selection logic. */}}
{{- define "ix.v1.common.controller.probes" -}}
{{- end -}}

View File

@@ -1,6 +1,4 @@
{{/*
Volumes included by the controller.
*/}}
{{/* Volumes included by the controller. */}}
{{- define "ix.v1.common.controller.volumes" -}}
{{- $persistenceDefault := "pvc" -}}
{{- range $index, $persistence := .Values.persistence }}

View File

@@ -46,7 +46,7 @@ spec:
labels:
{{- include "ix.v1.common.labels.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
spec:
blabla:

View File

@@ -19,6 +19,27 @@ ixExternalInterfacesConfigurationNames: []
# - interface1
# - interface2
image:
# -- Image repository
repository:
# -- Image tag
tag:
# -- Image pull policy
pullPolicy: IfNotPresent
# -- Override the args for the default container
args: []
# -- Add args in addition to the arguments set by default.
# Primarily for the SCALE GUI
extraArgs: []
# -- Determines whether containers in a pod runs with TTY enabled.
tty: false
# -- Determines whether containers in a pod runs with stdin enabled.
stdin: false
controller:
# -- Enable the controller.
enabled: true