_configuration.tpl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {{- define "distribution.configuration" -}}
  2. {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
  3. {{- $secretKey := randAlphaNum 32 -}}
  4. {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-distribution" $fullname)) -}}
  5. {{- $secretKey = ((index .data "REGISTRY_HTTP_SECRET") | b64dec) -}}
  6. {{- end }}
  7. configmap:
  8. distribution-config:
  9. enabled: true
  10. data:
  11. REGISTRY_HTTP_ADDR: {{ printf "0.0.0.0:%v" .Values.distributionNetwork.apiPort }}
  12. {{- if .Values.distributionStorage.useFilesystemBackend }}
  13. REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /var/lib/registry
  14. {{- end -}}
  15. {{- if .Values.distributionNetwork.certificateID }}
  16. REGISTRY_HTTP_TLS_CERTIFICATE: /certs/tls.crt
  17. REGISTRY_HTTP_TLS_KEY: /certs/tls.key
  18. {{- end -}}
  19. {{- if .Values.distributionConfig.basicAuthUsers }}
  20. REGISTRY_AUTH_HTPASSWD_REALM: basic-realm
  21. REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
  22. {{- end }}
  23. secret:
  24. distribution-creds:
  25. enabled: true
  26. data:
  27. REGISTRY_HTTP_SECRET: {{ $secretKey }}
  28. {{- if .Values.distributionConfig.basicAuthUsers }}
  29. distribution-htpasswd:
  30. enabled: true
  31. data:
  32. htpasswd: |
  33. {{- range $idx, $v := .Values.distributionConfig.basicAuthUsers }}
  34. {{- htpasswd $v.user $v.pass | nindent 8 }}
  35. {{- end -}}
  36. {{- end -}}
  37. {{- end -}}