diff --git a/charts/prometheus-json-exporter/Chart.yaml b/charts/prometheus-json-exporter/Chart.yaml index 7de7dd23a45f..d81097e23936 100644 --- a/charts/prometheus-json-exporter/Chart.yaml +++ b/charts/prometheus-json-exporter/Chart.yaml @@ -19,7 +19,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.8.0 +version: 0.9.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/prometheus-json-exporter/templates/NOTES.txt b/charts/prometheus-json-exporter/templates/NOTES.txt index cb8225116c7e..5d11b2815e5c 100644 --- a/charts/prometheus-json-exporter/templates/NOTES.txt +++ b/charts/prometheus-json-exporter/templates/NOTES.txt @@ -6,17 +6,17 @@ {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[].nodePort}" services {{ include "prometheus-json-exporter.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[].status.addresses[].address}") + export NODE_PORT=$(kubectl get --namespace {{ include "prometheus-json-exporter.namespace" . }} -o jsonpath="{.spec.ports[].nodePort}" services {{ include "prometheus-json-exporter.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ include "prometheus-json-exporter.namespace" . }} -o jsonpath="{.items[].status.addresses[].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "prometheus-json-exporter.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "prometheus-json-exporter.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{[]}{{ end }}"}}") + You can watch the status of by running 'kubectl get --namespace {{ include "prometheus-json-exporter.namespace" . }} svc -w {{ include "prometheus-json-exporter.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ include "prometheus-json-exporter.namespace" . }} {{ include "prometheus-json-exporter.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{[]}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "prometheus-json-exporter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[].ports[].containerPort}") + export POD_NAME=$(kubectl get pods --namespace {{ include "prometheus-json-exporter.namespace" . }} -l "app.kubernetes.io/name={{ include "prometheus-json-exporter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ include "prometheus-json-exporter.namespace" . }} $POD_NAME -o jsonpath="{.spec.containers[].ports[].containerPort}") echo "Visit http://127.0.0.1:{{ .Values.service.port }} to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME {{ .Values.service.port }}:$CONTAINER_PORT + kubectl --namespace {{ include "prometheus-json-exporter.namespace" . }} port-forward $POD_NAME {{ .Values.service.port }}:$CONTAINER_PORT {{- end }} diff --git a/charts/prometheus-json-exporter/templates/_helpers.tpl b/charts/prometheus-json-exporter/templates/_helpers.tpl index f0c16dd26ec7..4fda8f4c3afe 100644 --- a/charts/prometheus-json-exporter/templates/_helpers.tpl +++ b/charts/prometheus-json-exporter/templates/_helpers.tpl @@ -60,3 +60,10 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +Allow overriding namespace +*/}} +{{- define "prometheus-json-exporter.namespace" -}} +{{- default .Release.Namespace .Values.namespaceOverride -}} +{{- end }} \ No newline at end of file diff --git a/charts/prometheus-json-exporter/templates/configmap.yaml b/charts/prometheus-json-exporter/templates/configmap.yaml index e68ccbb780e4..5d5fc4b495bb 100644 --- a/charts/prometheus-json-exporter/templates/configmap.yaml +++ b/charts/prometheus-json-exporter/templates/configmap.yaml @@ -2,6 +2,9 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "prometheus-json-exporter.fullname" . }} + namespace: {{ include "prometheus-json-exporter.namespace" . }} + labels: + {{- include "prometheus-json-exporter.labels" . | nindent 4 }} data: allow-snippet-annotations: "false" config.yml: | diff --git a/charts/prometheus-json-exporter/templates/deployment.yaml b/charts/prometheus-json-exporter/templates/deployment.yaml index b2d149cb6b0b..2ea0b3d6e13e 100644 --- a/charts/prometheus-json-exporter/templates/deployment.yaml +++ b/charts/prometheus-json-exporter/templates/deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "prometheus-json-exporter.fullname" . }} + namespace: {{ include "prometheus-json-exporter.namespace" . }} labels: {{- include "prometheus-json-exporter.labels" . | nindent 4 }} spec: diff --git a/charts/prometheus-json-exporter/templates/hpa.yaml b/charts/prometheus-json-exporter/templates/hpa.yaml index c022159bb382..d1f3d78d1941 100644 --- a/charts/prometheus-json-exporter/templates/hpa.yaml +++ b/charts/prometheus-json-exporter/templates/hpa.yaml @@ -3,6 +3,7 @@ apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: name: {{ include "prometheus-json-exporter.fullname" . }} + namespace: {{ include "prometheus-json-exporter.namespace" . }} labels: {{- include "prometheus-json-exporter.labels" . | nindent 4 }} spec: diff --git a/charts/prometheus-json-exporter/templates/ingress.yaml b/charts/prometheus-json-exporter/templates/ingress.yaml index cd7cd1221580..05398fb93a1b 100644 --- a/charts/prometheus-json-exporter/templates/ingress.yaml +++ b/charts/prometheus-json-exporter/templates/ingress.yaml @@ -16,6 +16,7 @@ apiVersion: extensions/v1beta1 kind: Ingress metadata: name: {{ $fullName }} + namespace: {{ include "prometheus-json-exporter.namespace" . }} labels: {{- include "prometheus-json-exporter.labels" . | nindent 4 }} {{- with .Values.ingress.labels }} diff --git a/charts/prometheus-json-exporter/templates/prometheusrule.yaml b/charts/prometheus-json-exporter/templates/prometheusrule.yaml index 782ca93a3162..aebfc20cdc1e 100644 --- a/charts/prometheus-json-exporter/templates/prometheusrule.yaml +++ b/charts/prometheus-json-exporter/templates/prometheusrule.yaml @@ -3,9 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: {{ template "prometheus-json-exporter.fullname" . }} - {{- with .Values.prometheusRule.namespace }} - namespace: {{ . }} - {{- end }} + namespace: {{ default (include "prometheus-json-exporter.namespace" .) .Values.prometheusRule.namespace }} labels: {{- include "prometheus-json-exporter.labels" . | nindent 4 }} {{- with .Values.prometheusRule.additionalLabels -}} diff --git a/charts/prometheus-json-exporter/templates/service.yaml b/charts/prometheus-json-exporter/templates/service.yaml index 646f3ba0a83e..f86bfa9c31f5 100644 --- a/charts/prometheus-json-exporter/templates/service.yaml +++ b/charts/prometheus-json-exporter/templates/service.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Service metadata: name: {{ include "prometheus-json-exporter.fullname" . }} + namespace: {{ include "prometheus-json-exporter.namespace" . }} labels: {{- include "prometheus-json-exporter.labels" . | nindent 4 }} {{- with .Values.service.labels }} diff --git a/charts/prometheus-json-exporter/templates/serviceaccount.yaml b/charts/prometheus-json-exporter/templates/serviceaccount.yaml index 71200e45eb19..381a1f73406e 100644 --- a/charts/prometheus-json-exporter/templates/serviceaccount.yaml +++ b/charts/prometheus-json-exporter/templates/serviceaccount.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "prometheus-json-exporter.serviceAccountName" . }} + namespace: {{ include "prometheus-json-exporter.namespace" . }} labels: {{- include "prometheus-json-exporter.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} diff --git a/charts/prometheus-json-exporter/templates/servicemonitor.yaml b/charts/prometheus-json-exporter/templates/servicemonitor.yaml index 5c19fdb2d8b6..4cf98e2f200e 100644 --- a/charts/prometheus-json-exporter/templates/servicemonitor.yaml +++ b/charts/prometheus-json-exporter/templates/servicemonitor.yaml @@ -5,9 +5,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "prometheus-json-exporter.fullname" $ }}-{{ .name }} - {{- if $.Values.serviceMonitor.namespace }} - namespace: {{ $.Values.serviceMonitor.namespace }} - {{- end }} + namespace: {{ default (include "prometheus-json-exporter.namespace" $) $.Values.serviceMonitor.namespace }} labels: {{- include "prometheus-json-exporter.labels" $ | nindent 4 }} {{- if or $.Values.serviceMonitor.defaults.labels .labels }} @@ -46,6 +44,6 @@ spec: {{- include "prometheus-json-exporter.selectorLabels" $ | nindent 6 }} namespaceSelector: matchNames: - - {{ $.Release.Namespace }} + - {{ include "prometheus-json-exporter.namespace" $ }} {{- end }} {{- end }}