Skip to content

Commit

Permalink
Merge pull request #17983 from richardkchapman/yaml-format
Browse files Browse the repository at this point in the history
HPCC-31716 Improve formatting of Roxie YAML templates

Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored May 2, 2024
2 parents 742c2ae + fe06d22 commit a2ff1bb
Show file tree
Hide file tree
Showing 2 changed files with 271 additions and 271 deletions.
138 changes: 69 additions & 69 deletions helm/hpcc/templates/localroxie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@ data:
version: 1.0
roxie:
{{ toYaml (omit .me "logging" "tracing" "env") | indent 6 }}
{{- include "hpcc.generateLoggingConfig" . | indent 6 }}
{{- include "hpcc.generateTracingConfig" . | indent 6 }}
{{ include "hpcc.generateVaultConfig" . | indent 6 }}
{{- include "hpcc.generateLoggingConfig" . | indent 6 }}
{{- include "hpcc.generateTracingConfig" . | indent 6 }}
{{ include "hpcc.generateVaultConfig" . | indent 6 }}
global:
{{ include "hpcc.generateGlobalConfigMap" .root | indent 6 }}
{{- end -}}
{{ include "hpcc.generateGlobalConfigMap" .root | indent 6 }}
{{- end -}}{{/* define "hpcc.localroxieConfigMap */}}

{{ range $roxie := $.Values.roxie -}}
{{- if not $roxie.disabled -}}
{{- $env := concat ($.Values.global.env | default list) (.env | default list) -}}
{{- $secretsCategories := list "system" "eclUser" "ecl" "storage" }}
{{- $enginePlaneDetails := dict -}}
{{- $_ := include "hpcc.getEnginePlanes" (dict "root" $ "me" . "result" $enginePlaneDetails) -}}
{{- $commonCtx := dict "root" $ "me" $roxie "includeCategories" $enginePlaneDetails.planeCategories "includeNames" $enginePlaneDetails.namedPlanes "secretsCategories" $secretsCategories "env" $env }}
{{- $configSHA := include "hpcc.getConfigSHA" ($commonCtx | merge (dict "configMapHelper" "hpcc.localroxieConfigMap" "component" "roxie" "excludeKeys" "global")) }}
{{- include "hpcc.checkDefaultStoragePlane" $commonCtx }}
{{- $singleNode := (hasKey $roxie "singleNode") | ternary $roxie.singleNode ((hasKey $roxie "localAgent") | ternary $roxie.localAgent false) }}
{{- if $singleNode -}}
{{- $localAgent := ((hasKey $roxie "localAgent") | ternary $roxie.localAgent true) -}}
{{- $name := $roxie.name -}}
{{- $servername := printf "%s-server" $roxie.name -}}
{{ range $roxie := $.Values.roxie -}}
{{- if not $roxie.disabled -}}
{{- $env := concat ($.Values.global.env | default list) (.env | default list) -}}
{{- $secretsCategories := list "system" "eclUser" "ecl" "storage" }}
{{- $enginePlaneDetails := dict -}}
{{- $_ := include "hpcc.getEnginePlanes" (dict "root" $ "me" . "result" $enginePlaneDetails) -}}
{{- $commonCtx := dict "root" $ "me" $roxie "includeCategories" $enginePlaneDetails.planeCategories "includeNames" $enginePlaneDetails.namedPlanes "secretsCategories" $secretsCategories "env" $env }}
{{- $configSHA := include "hpcc.getConfigSHA" ($commonCtx | merge (dict "configMapHelper" "hpcc.localroxieConfigMap" "component" "roxie" "excludeKeys" "global")) }}
{{- include "hpcc.checkDefaultStoragePlane" $commonCtx }}
{{- $singleNode := (hasKey $roxie "singleNode") | ternary $roxie.singleNode ((hasKey $roxie "localAgent") | ternary $roxie.localAgent false) }}
{{- if $singleNode -}}
{{- $localAgent := ((hasKey $roxie "localAgent") | ternary $roxie.localAgent true) -}}
{{- $name := $roxie.name -}}
{{- $servername := printf "%s-server" $roxie.name -}}

apiVersion: apps/v1
kind: Deployment
Expand All @@ -74,19 +74,19 @@ spec:
accessDali: "yes"
accessEsp: "yes"
helmVersion: 9.7.0-trunk0
{{- include "hpcc.addStandardLabels" (dict "root" $ "component" "roxie-server" "name" "roxie" "instance" $roxie.name) | indent 8 }}
{{- if hasKey . "labels" }}
{{ toYaml .labels | indent 8 }}
{{- end }}
{{- include "hpcc.addStandardLabels" (dict "root" $ "component" "roxie-server" "name" "roxie" "instance" $roxie.name) | indent 8 }}
{{- if hasKey . "labels" }}
{{ toYaml .labels | indent 8 }}
{{- end }}
annotations:
checksum/config: {{ $configSHA }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
{{- include "hpcc.generateAnnotations" $commonCtx | indent 8 }}
spec:
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $roxie.name "target" $roxie.name "type" "roxie") | indent 6 }}
{{- include "hpcc.placementsByPodTargetType" (dict "root" $ "pod" $roxie.name "target" $roxie.name "type" "roxie") | indent 6 }}
serviceAccountName: "hpcc-default"
initContainers:
{{- include "hpcc.createConfigInitContainers" $commonCtx | indent 6 }}
{{- include "hpcc.addImagePullSecrets" $commonCtx | nindent 6 -}}
{{- include "hpcc.createConfigInitContainers" $commonCtx | indent 6 }}
{{- include "hpcc.addImagePullSecrets" $commonCtx | nindent 6 -}}
containers:
- name: {{ $roxie.name | quote }}
workingDir: /var/lib/HPCCSystems
Expand All @@ -99,58 +99,58 @@ spec:
"--resolveLocally=false"
]
env:
{{ include "hpcc.mergeEnvironments" $env | indent 8 -}}
{{ include "hpcc.mergeEnvironments" $env | indent 8 -}}
- name: "SENTINEL"
value: "/tmp/{{ $roxie.name }}.sentinel"
{{- $local := dict "first" true }}
{{- range $service := $roxie.services }}
{{- if ne (int $service.servicePort) 0 }}
{{- if $local.first }}
{{- $_ := set $local "first" false }}
{{- $local := dict "first" true }}
{{- range $service := $roxie.services }}
{{- if ne (int $service.servicePort) 0 }}
{{- if $local.first }}
{{- $_ := set $local "first" false }}
ports:
{{- end }}
{{- end }}
- name: {{ $service.name }}
containerPort: {{ $service.servicePort }}
{{- end }}
{{- end }}
{{- include "hpcc.addSecurityContext" $commonCtx | indent 8 }}
{{- $omitResources := hasKey $.Values.global "omitResources" | ternary $.Values.global.omitResources $.Values.global.privileged }}
{{- if not $omitResources }}
{{- include "hpcc.addResources" (dict "me" $roxie.resources) | indent 8 }}
{{- end }}
{{ include "hpcc.addImageAttrs" $commonCtx | indent 8 }}
{{- end }}
{{- end }}
{{- include "hpcc.addSecurityContext" $commonCtx | indent 8 }}
{{- $omitResources := hasKey $.Values.global "omitResources" | ternary $.Values.global.omitResources $.Values.global.privileged }}
{{- if not $omitResources }}
{{- include "hpcc.addResources" (dict "me" $roxie.resources) | indent 8 }}
{{- end }}
{{ include "hpcc.addImageAttrs" $commonCtx | indent 8 }}
volumeMounts:
{{ include "hpcc.addConfigMapVolumeMount" . | indent 8 }}
{{ include "hpcc.addVolumeMounts" $commonCtx | indent 8 }}
{{- include "hpcc.addSecretVolumeMounts" $commonCtx | indent 8 }}
{{ include "hpcc.addVaultClientCertificateVolumeMounts" $commonCtx | indent 8 }}
{{ include "hpcc.addCertificateVolumeMount" (dict "root" $ "name" $roxie.name "component" "localroxie" "external" false) | indent 8 }}
{{ include "hpcc.addCertificateVolumeMount" (dict "root" $ "name" $roxie.name "component" "localroxie" "external" true "includeRemote" true) | indent 8 }}
{{ include "hpcc.addUDPCertificateVolumeMount" (dict "root" $ "name" $roxie.name "component" "localudpkey" ) | indent 8 }}
{{ include "hpcc.addConfigMapVolumeMount" . | indent 8 }}
{{ include "hpcc.addVolumeMounts" $commonCtx | indent 8 }}
{{- include "hpcc.addSecretVolumeMounts" $commonCtx | indent 8 }}
{{ include "hpcc.addVaultClientCertificateVolumeMounts" $commonCtx | indent 8 }}
{{ include "hpcc.addCertificateVolumeMount" (dict "root" $ "name" $roxie.name "component" "localroxie" "external" false) | indent 8 }}
{{ include "hpcc.addCertificateVolumeMount" (dict "root" $ "name" $roxie.name "component" "localroxie" "external" true "includeRemote" true) | indent 8 }}
{{ include "hpcc.addUDPCertificateVolumeMount" (dict "root" $ "name" $roxie.name "component" "localudpkey" ) | indent 8 }}
volumes:
{{ include "hpcc.addConfigMapVolume" . | indent 6 }}
{{ include "hpcc.addVolumes" $commonCtx | indent 6 }}
{{ include "hpcc.addSecretVolumes" $commonCtx | indent 6 }}
{{ include "hpcc.addVaultClientCertificateVolumes" $commonCtx | indent 6 }}
{{ include "hpcc.addCertificateVolume" (dict "root" $ "name" $roxie.name "component" "localroxie" "external" false) | indent 6 }}
{{ include "hpcc.addCertificateVolume" (dict "root" $ "name" $roxie.name "component" "localroxie" "external" true "includeRemote" true) | indent 6 }}
{{ include "hpcc.addUDPCertificateVolume" (dict "root" $ "name" $roxie.name "component" "localudpkey" ) | indent 6 }}
{{ include "hpcc.addConfigMapVolume" . | indent 6 }}
{{ include "hpcc.addVolumes" $commonCtx | indent 6 }}
{{ include "hpcc.addSecretVolumes" $commonCtx | indent 6 }}
{{ include "hpcc.addVaultClientCertificateVolumes" $commonCtx | indent 6 }}
{{ include "hpcc.addCertificateVolume" (dict "root" $ "name" $roxie.name "component" "localroxie" "external" false) | indent 6 }}
{{ include "hpcc.addCertificateVolume" (dict "root" $ "name" $roxie.name "component" "localroxie" "external" true "includeRemote" true) | indent 6 }}
{{ include "hpcc.addUDPCertificateVolume" (dict "root" $ "name" $roxie.name "component" "localudpkey" ) | indent 6 }}
---
{{- range $service := $roxie.services }}
{{- if ne (int $service.servicePort) 0 }}
{{ include "hpcc.addService" ( dict "root" $ "name" $service.name "service" $service "selector" $servername "defaultPort" $service.servicePort ) }}
{{- range $service := $roxie.services }}
{{- if ne (int $service.servicePort) 0 }}
{{ include "hpcc.addService" ( dict "root" $ "name" $service.name "service" $service "selector" $servername "defaultPort" $service.servicePort ) }}
---
{{- end }}
{{- end }}
{{- end }}
{{- end }}
kind: ConfigMap
{{ include "hpcc.generateConfig" ($commonCtx | merge (dict "configMapHelper" "hpcc.localroxieConfigMap")) }}
{{ include "hpcc.generateConfig" ($commonCtx | merge (dict "configMapHelper" "hpcc.localroxieConfigMap")) }}
---
{{ include "hpcc.addCertificate" (dict "root" $ "name" $roxie.name "services" $roxie.services "component" "localroxie" "external" false) }}
{{ include "hpcc.addCertificate" (dict "root" $ "name" $roxie.name "services" $roxie.services "component" "localroxie" "external" true "includeRemote" true) }}
{{ include "hpcc.addUDPCertificate" (dict "root" $ "name" $roxie.name "component" "localudpkey") }}
{{ include "hpcc.addCertificate" (dict "root" $ "name" $roxie.name "services" $roxie.services "component" "localroxie" "external" false) }}
{{ include "hpcc.addCertificate" (dict "root" $ "name" $roxie.name "services" $roxie.services "component" "localroxie" "external" true "includeRemote" true) }}
{{ include "hpcc.addUDPCertificate" (dict "root" $ "name" $roxie.name "component" "localudpkey") }}
---
{{ include "hpcc.addEgress" $commonCtx }}
{{ include "hpcc.addEgress" $commonCtx }}

{{- end }}
{{- end }}
{{- end }}
{{- end }}{{/* if singleNode */}}
{{- end }}{{/* if not disabled */}}
{{- end }}{{/* range */}}
Loading

0 comments on commit a2ff1bb

Please sign in to comment.