_service.tpl 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {{/* Service Spawner */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.spawner.service" $ -}}
  4. */}}
  5. {{- define "ix.v1.common.spawner.service" -}}
  6. {{/* Primary validation for enabled service. */}}
  7. {{- include "ix.v1.common.lib.service.primaryValidation" $ -}}
  8. {{- range $name, $service := .Values.service -}}
  9. {{- if $service.enabled -}}
  10. {{/* Create a copy of the configmap */}}
  11. {{- $objectData := (mustDeepCopy $service) -}}
  12. {{- $objectName := include "ix.v1.common.lib.chart.names.fullname" $ -}}
  13. {{- if not $objectData.primary -}}
  14. {{- $objectName = (printf "%s-%s" (include "ix.v1.common.lib.chart.names.fullname" $) $name) -}}
  15. {{- end -}}
  16. {{/* Perform validations */}}
  17. {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}}
  18. {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Service") -}}
  19. {{- include "ix.v1.common.lib.service.validation" (dict "rootCtx" $ "objectData" $objectData) -}}
  20. {{/* Set the name of the service account */}}
  21. {{- $_ := set $objectData "name" $objectName -}}
  22. {{- $_ := set $objectData "shortName" $name -}}
  23. {{/* Call class to create the object */}}
  24. {{- include "ix.v1.common.class.service" (dict "rootCtx" $ "objectData" $objectData) -}}
  25. {{- end -}}
  26. {{- end -}}
  27. {{- end -}}