Skip to content

Commit

Permalink
Enable private registry support for ace installer
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Oct 26, 2023
1 parent e55c501 commit 3a6937d
Show file tree
Hide file tree
Showing 21 changed files with 276 additions and 77 deletions.
3 changes: 3 additions & 0 deletions apis/installer/v1alpha1/ace_options_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ type RegistryProxies struct {
// ghcr.io
//+optional
GHCR string `json:"ghcr"`
// quay.io
//+optional
Quay string `json:"quay"`
// registry.k8s.io
//+optional
Kubernetes string `json:"kubernetes"`
Expand Down
109 changes: 55 additions & 54 deletions charts/ace-installer/README.md

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions charts/ace-installer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,57 @@ Selector labels
app.kubernetes.io/name: {{ include "ace-installer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Registry Proxy Templates
*/}}
{{- define "registry.dockerHub" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.dockerHub .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "registry.dockerLibrary" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.dockerLibrary .Values.image.proxies.dockerHub .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "registry.ghcr" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.ghcr .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "registry.quay" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.quay .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "registry.kubernetes" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.kubernetes .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "registry.appscode" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.appscode .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{/*
Image Templates
*/}}
{{- define "image.dockerHub" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.dockerHub .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "image.dockerLibrary" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.dockerLibrary .Values.image.proxies.dockerHub .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "image.ghcr" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.ghcr .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "image.quay" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.quay .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "image.kubernetes" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.kubernetes .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}

{{- define "image.appscode" -}}
{{ prepend (list ._repo) (list .Values.image.proxies.appscode .Values.image.registryFQDN | compact | first) | compact | join "/" }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- with (index .Values "helm" "releases" "cert-manager-csi-driver-cacerts") }}
{{- if .enabled }}

{{ $overrides := dict "registryFQDN" (include "registry.ghcr" $) }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -35,7 +40,7 @@ spec:
kind: HelmRepository
name: kubeops
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- with (index .Values "helm" "releases" "cert-manager-webhook-ace") }}
{{- if .enabled }}

{{ $overrides := dict "registryFQDN" (include "registry.ghcr" $) }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -35,7 +40,7 @@ spec:
kind: HelmRepository
name: bytebuilders
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{{- with (index .Values "helm" "releases" "cert-manager") }}
{{- if .enabled }}

{{ $overrides := printf `
image:
repository: %s
webhook:
image:
repository: %s` (include "image.quay" (merge (dict "_repo" "jetstack/cert-manager-controller") $)) (include "image.quay" (merge (dict "_repo" "jetstack/cert-manager-webhook") $)) | fromYaml }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -33,7 +43,7 @@ spec:
kind: HelmRepository
name: jetstack
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
11 changes: 10 additions & 1 deletion charts/ace-installer/templates/apps/kubedb/kubedb.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{{- with (index .Values "helm" "releases" "kubedb") }}
{{- if .enabled }}

{{ $overrides := printf `
global:
registryFQDN: %q
` (include "registry.ghcr" $) | fromYaml }}
{{ $_ := set $overrides.global "kubedb-catalog" $.Values.image }}
{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -39,7 +48,7 @@ spec:
kind: HelmRepository
name: kubedb
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- with (index .Values "helm" "releases" "docker-machine-operator") }}
{{- if .enabled }}

{{ $overrides := dict "registryFQDN" (include "registry.ghcr" $) }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -33,7 +38,7 @@ spec:
kind: HelmRepository
name: kubeops
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- with (index .Values "helm" "releases" "external-dns-operator") }}
{{- if .enabled }}

{{ $overrides := dict "registryFQDN" (include "registry.ghcr" $) }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -33,7 +38,7 @@ spec:
kind: HelmRepository
name: kubeops
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- with (index .Values "helm" "releases" "license-proxyserver") }}
{{- if .enabled }}

{{ $overrides := dict "registryFQDN" (include "registry.ghcr" $) }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -33,7 +38,7 @@ spec:
kind: HelmRepository
name: bytebuilders
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
11 changes: 10 additions & 1 deletion charts/ace-installer/templates/apps/kubeops/reloader.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{{- with (index .Values "helm" "releases" "reloader") }}
{{- if .enabled }}

{{ $overrides := printf `
reloader:
deployment:
image:
name: %s` (include "image.ghcr" (merge (dict "_repo" "stakater/reloader") $)) | fromYaml }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -33,7 +42,7 @@ spec:
kind: HelmRepository
name: stakater
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,69 @@
{{- with (index .Values "helm" "releases" "kube-prometheus-stack") }}
{{- if .enabled }}

{{ $alertmanager := printf `
alertmanager:
alertmanagerSpec:
image:
repository: %s` (include "image.quay" (merge (dict "_repo" "prometheus/alertmanager") $)) | fromYaml }}

{{ $prometheusOperator := printf `
prometheusOperator:
image:
repository: %s
prometheusConfigReloader:
image:
repository: %s
thanosImage:
repository: %s` (include "image.quay" (merge (dict "_repo" "prometheus-operator/prometheus-operator") $)) (include "image.quay" (merge (dict "_repo" "prometheus-operator/prometheus-config-reloader") $)) (include "image.quay" (merge (dict "_repo" "thanos/thanos") $)) | fromYaml }}

{{ $prometheus := printf `
prometheus:
prometheusSpec:
image:
repository: %s` (include "image.quay" (merge (dict "_repo" "prometheus/prometheus") $)) | fromYaml }}

{{ $ksm := printf `
kube-state-metrics:
image:
repository: %s` (include "image.kubernetes" (merge (dict "_repo" "kube-state-metrics/kube-state-metrics") $)) | fromYaml }}

{{ $node := printf `
prometheus-node-exporter:
image:
repository: %s` (include "image.quay" (merge (dict "_repo" "prometheus/node-exporter") $)) | fromYaml }}

# https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md
{{ $grafana := printf `
grafana:
# docker
image:
registry: %s
initChownData:
image:
registry: %s
testFramework:
image:
registry: %s
downloadDashboardsImage:
registry: %s
imageRenderer:
image:
registry: %s
# quay.io
sidecar:
image:
registry: %s`
(include "image.dockerHub" $)
(include "image.dockerHub" $)
(include "image.dockerHub" $)
(include "image.dockerHub" $)
(include "image.dockerHub" $)
(include "image.quay" $) | fromYaml }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $alertmanager $prometheusOperator $prometheus $ksm $node $grafana }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -32,7 +95,7 @@ spec:
kind: HelmRepository
name: prometheus-community
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- with (index .Values "helm" "releases" "panopticon") }}
{{- if .enabled }}

{{ $overrides := dict "registryFQDN" (include "registry.ghcr" $) }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -34,7 +39,7 @@ spec:
kind: HelmRepository
name: kubeops
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- with (index .Values "helm" "releases" "opscenter-features") }}
{{- if .enabled }}

{{ $overrides := dict "image" $.Values.image }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -29,7 +34,7 @@ spec:
kind: HelmRepository
name: bootstrap
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

Expand Down
13 changes: 11 additions & 2 deletions charts/ace-installer/templates/apps/stash/stash.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{{- with (index .Values "helm" "releases" "stash") }}
{{- if .enabled }}

{{ $overrides := printf `
global:
registryFQDN: %s
stash-enterprise:
pushgateway:
registry: %s/prom` (include "registry.ghcr" $) (include "registry.dockerLibrary" $) | fromYaml }}

{{ $vals := dig "values" dict . }}
{{ $vals = mergeOverwrite $vals $overrides }}

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -38,10 +48,9 @@ spec:
kind: HelmRepository
name: stashed
namespace: {{ $.Release.Namespace }}
{{- with (dig "values" dict .) }}
{{- with $vals }}
{{- dict "values" . | toYaml | nindent 2 }}
{{- end }}

{{- end }}
{{- end }}

Loading

0 comments on commit 3a6937d

Please sign in to comment.