Commit 13b5a79d by Fyery Committed by Craig Jellick

Add ability to use private image registry when deploying monitoring tools

problem: We can not deploy monitoring tools in an air gap environment. Solution: Add the ability to use the private image registry when deploying monitoring tools Issue: https://github.com/rancher/rancher/issues/17842
parent 69520015
...@@ -24,7 +24,7 @@ spec: ...@@ -24,7 +24,7 @@ spec:
chart: {{ template "app.version" . }} chart: {{ template "app.version" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
{{- end }} {{- end }}
baseImage: "{{ .Values.image.repository }}" baseImage: {{ template "system_default_registry" . }}{{ .Values.image.repository }}
{{- if .Values.externalUrl }} {{- if .Values.externalUrl }}
externalUrl: "{{ .Values.externalUrl }}" externalUrl: "{{ .Values.externalUrl }}"
{{- end }} {{- end }}
......
...@@ -29,7 +29,7 @@ spec: ...@@ -29,7 +29,7 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: alertmanager-proxy - name: alertmanager-proxy
image: {{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }}
args: args:
- nginx - nginx
- -g - -g
...@@ -55,4 +55,4 @@ spec: ...@@ -55,4 +55,4 @@ spec:
- key: nginx.conf - key: nginx.conf
mode: 438 mode: 438
path: nginx.conf path: nginx.conf
name: {{ template "app.nginx.fullname" . }} name: {{ template "app.nginx.fullname" . }}
\ No newline at end of file
...@@ -23,7 +23,7 @@ spec: ...@@ -23,7 +23,7 @@ spec:
spec: spec:
containers: containers:
- name: kube-state - name: kube-state
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
ports: ports:
- name: http - name: http
containerPort: 8080 containerPort: 8080
......
...@@ -22,7 +22,7 @@ spec: ...@@ -22,7 +22,7 @@ spec:
spec: spec:
containers: containers:
- name: exporter-node - name: exporter-node
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
args: args:
- --web.listen-address=$(POD_IP):{{ .Values.ports.metrics.port }} - --web.listen-address=$(POD_IP):{{ .Values.ports.metrics.port }}
- --path.procfs=/host/proc - --path.procfs=/host/proc
......
...@@ -23,7 +23,7 @@ spec: ...@@ -23,7 +23,7 @@ spec:
spec: spec:
initContainers: initContainers:
- name: grafana-init-plugin-json-copy - name: grafana-init-plugin-json-copy
image: {{ .Values.image.repository }}:{{ .Values.image.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
{{- if and .Values.resources .Values.resources.inits }} {{- if and .Values.resources .Values.resources.inits }}
resources: resources:
{{ toYaml .Values.resources.inits | indent 10 }} {{ toYaml .Values.resources.inits | indent 10 }}
...@@ -35,7 +35,7 @@ spec: ...@@ -35,7 +35,7 @@ spec:
- name: grafana-static-contents - name: grafana-static-contents
mountPath: /host mountPath: /host
- name: grafana-init-plugin-json-modify - name: grafana-init-plugin-json-modify
image: {{ .Values.image.tool.repository }}:{{ .Values.image.tool.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.tool.repository }}:{{ .Values.image.tool.tag }}
command: command:
- /usr/bin/modify-datasource-plugin-json.sh - /usr/bin/modify-datasource-plugin-json.sh
{{- if and .Values.resources .Values.resources.inits }} {{- if and .Values.resources .Values.resources.inits }}
...@@ -50,7 +50,7 @@ spec: ...@@ -50,7 +50,7 @@ spec:
mountPath: /host mountPath: /host
containers: containers:
- name: grafana - name: grafana
image: {{ .Values.image.repository }}:{{ .Values.image.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
env: env:
- name: GF_AUTH_BASIC_ENABLED - name: GF_AUTH_BASIC_ENABLED
value: "true" value: "true"
...@@ -90,7 +90,7 @@ spec: ...@@ -90,7 +90,7 @@ spec:
{{ toYaml .Values.resources.core | indent 10 }} {{ toYaml .Values.resources.core | indent 10 }}
{{- end }} {{- end }}
- name: grafana-proxy - name: grafana-proxy
image: {{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }}
args: args:
- nginx - nginx
- -g - -g
......
...@@ -26,7 +26,7 @@ spec: ...@@ -26,7 +26,7 @@ spec:
spec: spec:
initContainers: initContainers:
- name: nginx-init-auth-add - name: nginx-init-auth-add
image: {{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }}
command: command:
- /usr/bin/replace-config-by-auth.sh - /usr/bin/replace-config-by-auth.sh
volumeMounts: volumeMounts:
...@@ -43,7 +43,7 @@ spec: ...@@ -43,7 +43,7 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: prometheus-proxy - name: prometheus-proxy
image: {{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.proxy.repository }}:{{ .Values.image.proxy.tag }}
args: args:
- nginx - nginx
- -g - -g
......
...@@ -29,7 +29,7 @@ spec: ...@@ -29,7 +29,7 @@ spec:
env: env:
{{ toYaml .Values.auth.env | indent 6 }} {{ toYaml .Values.auth.env | indent 6 }}
{{- end }} {{- end }}
image: {{ .Values.image.auth.repository }}:{{ .Values.image.auth.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.auth.repository }}:{{ .Values.image.auth.tag }}
ports: ports:
- containerPort: 9090 - containerPort: 9090
name: web name: web
...@@ -88,7 +88,7 @@ spec: ...@@ -88,7 +88,7 @@ spec:
name: alertmanager-operated name: alertmanager-operated
port: http port: http
{{- end }} {{- end }}
baseImage: "{{ .Values.image.repository }}" baseImage: {{ template "system_default_registry" . }}{{ .Values.image.repository }}
{{- if .Values.externalLabels }} {{- if .Values.externalLabels }}
externalLabels: externalLabels:
{{ toYaml .Values.externalLabels | indent 4}} {{ toYaml .Values.externalLabels | indent 4}}
......
...@@ -117,3 +117,12 @@ ...@@ -117,3 +117,12 @@
{{- "rbac.authorization.k8s.io/v1alpha1" -}} {{- "rbac.authorization.k8s.io/v1alpha1" -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "system_default_registry" -}}
{{- if .Values.global.systemDefaultRegistry -}}
{{- printf "%s/" .Values.global.systemDefaultRegistry -}}
{{- else -}}
{{- "" -}}
{{- end -}}
{{- end -}}
...@@ -24,13 +24,13 @@ spec: ...@@ -24,13 +24,13 @@ spec:
spec: spec:
containers: containers:
- name: prometheus-operator - name: prometheus-operator
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
args: args:
- --kubelet-service={{ .Release.Namespace }}/expose-kubelets-metrics - --kubelet-service={{ .Release.Namespace }}/expose-kubelets-metrics
- --log-format={{ .Values.logFormat }} - --log-format={{ .Values.logFormat }}
- --log-level={{ .Values.logLevel }} - --log-level={{ .Values.logLevel }}
- --prometheus-config-reloader={{ .Values.image.prometheusConfigReloader.repository }}:{{ .Values.image.prometheusConfigReloader.tag }} - --prometheus-config-reloader={{ template "system_default_registry" . }}{{ .Values.image.prometheusConfigReloader.repository }}:{{ .Values.image.prometheusConfigReloader.tag }}
- --config-reloader-image={{ .Values.image.configmapReload.repository }}:{{ .Values.image.configmapReload.tag }} - --config-reloader-image={{ template "system_default_registry" . }}{{ .Values.image.configmapReload.repository }}:{{ .Values.image.configmapReload.tag }}
- --labels={{ .Values.apiGroup }}=true - --labels={{ .Values.apiGroup }}=true
- --crd-apigroup={{ template "operator_api_group" . }} - --crd-apigroup={{ template "operator_api_group" . }}
- --manage-crds={{ .Values.manageCRDs }} - --manage-crds={{ .Values.manageCRDs }}
......
...@@ -411,3 +411,6 @@ prometheus: ...@@ -411,3 +411,6 @@ prometheus:
runAsUser: 1000 runAsUser: 1000
runAsNonRoot: true runAsNonRoot: true
fsGroup: 2000 fsGroup: 2000
global:
systemDefaultRegistry: ""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment