diff --git a/charts/prometheus-prefect-exporter/README.md b/charts/prometheus-prefect-exporter/README.md index 28d5db5f..8d536351 100644 --- a/charts/prometheus-prefect-exporter/README.md +++ b/charts/prometheus-prefect-exporter/README.md @@ -62,12 +62,12 @@ Shoutout to @ialejandro for the original work on this chart! | affinity | object | `{}` | Affinity for pod assignment | | autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Autoscaling with CPU or memory utilization percentage | | env | object | `{}` | Environment variables to configure application | -| fullnameOverride | string | `""` | String to fully override prometheus-prefect-exporter.fullname template | +| fullnameOverride | string | `""` | String to fully override common.names.fullname template | | image | object | `{"pullPolicy":"IfNotPresent","repository":"prefecthq/prometheus-prefect-exporter","tag":"1.1.0"}` | Image registry | | imagePullSecrets | list | `[]` | Global Docker registry secret names as an array | | ingress | object | `{"annotations":{},"className":"","enabled":false,"hosts":[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}],"tls":[]}` | Ingress configuration to expose app | | livenessProbe | bool | `false` | Enable livenessProbe | -| nameOverride | string | `""` | String to partially override prometheus-prefect-exporter.fullname template (will maintain the release name) | +| nameOverride | string | `""` | String to partially override common.names.fullname template (will maintain the release name) | | nodeSelector | object | `{}` | Node labels for pod assignment | | podAnnotations | object | `{}` | Pod annotations | | podDisruptionBudget | object | `{}` | Limits the number of Pods of a replicated application that are down simultaneously from voluntary disruptions | diff --git a/charts/prometheus-prefect-exporter/templates/NOTES.txt b/charts/prometheus-prefect-exporter/templates/NOTES.txt index a0436f04..7f6c35f6 100644 --- a/charts/prometheus-prefect-exporter/templates/NOTES.txt +++ b/charts/prometheus-prefect-exporter/templates/NOTES.txt @@ -6,16 +6,16 @@ {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "prometheus-prefect-exporter.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.names.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].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-prefect-exporter.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "prometheus-prefect-exporter.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "common.names.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.names.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-prefect-exporter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT diff --git a/charts/prometheus-prefect-exporter/templates/_helpers.tpl b/charts/prometheus-prefect-exporter/templates/_helpers.tpl index 837e8bd3..e1c74898 100644 --- a/charts/prometheus-prefect-exporter/templates/_helpers.tpl +++ b/charts/prometheus-prefect-exporter/templates/_helpers.tpl @@ -1,61 +1,9 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "prometheus-prefect-exporter.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "prometheus-prefect-exporter.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "prometheus-prefect-exporter.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "prometheus-prefect-exporter.labels" -}} -helm.sh/chart: {{ include "prometheus-prefect-exporter.chart" . }} -{{ include "prometheus-prefect-exporter.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "prometheus-prefect-exporter.selectorLabels" -}} -app.kubernetes.io/name: {{ include "prometheus-prefect-exporter.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - {{/* Create the name of the service account to use */}} {{- define "prometheus-prefect-exporter.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "prometheus-prefect-exporter.fullname" .) .Values.serviceAccount.name }} +{{- default (include "common.names.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/charts/prometheus-prefect-exporter/templates/deployment.yaml b/charts/prometheus-prefect-exporter/templates/deployment.yaml index cd38a4f5..cd49057d 100644 --- a/charts/prometheus-prefect-exporter/templates/deployment.yaml +++ b/charts/prometheus-prefect-exporter/templates/deployment.yaml @@ -1,17 +1,17 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "prometheus-prefect-exporter.fullname" . }} + name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: - {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} + {{- include "common.labels.standard" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: - {{- include "prometheus-prefect-exporter.selectorLabels" . | nindent 6 }} + {{- include "common.labels.matchLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -19,7 +19,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "prometheus-prefect-exporter.selectorLabels" . | nindent 8 }} + {{- include "common.labels.matchLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -36,7 +36,7 @@ spec: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: {{ include "common.images.image" (dict "imageRoot" .Values.image)}} imagePullPolicy: {{ .Values.image.pullPolicy }} args: {{- if .Values.containerArgs }} diff --git a/charts/prometheus-prefect-exporter/templates/hpa.yaml b/charts/prometheus-prefect-exporter/templates/hpa.yaml index bb581a8e..4bf3033f 100644 --- a/charts/prometheus-prefect-exporter/templates/hpa.yaml +++ b/charts/prometheus-prefect-exporter/templates/hpa.yaml @@ -2,15 +2,15 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "prometheus-prefect-exporter.fullname" . }} + name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: - {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} + {{- include "common.labels.standard" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "prometheus-prefect-exporter.fullname" . }} + name: {{ include "common.names.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: diff --git a/charts/prometheus-prefect-exporter/templates/pdb.yaml b/charts/prometheus-prefect-exporter/templates/pdb.yaml index 75a90c0e..9c40173f 100644 --- a/charts/prometheus-prefect-exporter/templates/pdb.yaml +++ b/charts/prometheus-prefect-exporter/templates/pdb.yaml @@ -2,13 +2,13 @@ apiVersion: policy/v1 kind: PodDisruptionBudget metadata: - name: {{ template "prometheus-prefect-exporter.fullname" . }} + name: {{ template "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: - {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} + {{- include "common.labels.standard" . | nindent 4 }} spec: selector: matchLabels: - {{- include "prometheus-prefect-exporter.selectorLabels" . | nindent 6 }} + {{- include "common.labels.matchLabels" . | nindent 6 }} {{ toYaml .Values.podDisruptionBudget | indent 2 }} {{- end }} diff --git a/charts/prometheus-prefect-exporter/templates/prometheusrule.yaml b/charts/prometheus-prefect-exporter/templates/prometheusrule.yaml index b391c54f..2f594ad6 100644 --- a/charts/prometheus-prefect-exporter/templates/prometheusrule.yaml +++ b/charts/prometheus-prefect-exporter/templates/prometheusrule.yaml @@ -2,10 +2,10 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: - name: {{ template "prometheus-prefect-exporter.fullname" . }} + name: {{ template "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: - {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} + {{- include "common.labels.standard" . | nindent 4 }} {{- with .Values.prometheusRule.additionalLabels -}} {{- toYaml . | nindent 4 -}} {{- end }} diff --git a/charts/prometheus-prefect-exporter/templates/service.yaml b/charts/prometheus-prefect-exporter/templates/service.yaml index f7e77c67..3a3b95e9 100644 --- a/charts/prometheus-prefect-exporter/templates/service.yaml +++ b/charts/prometheus-prefect-exporter/templates/service.yaml @@ -1,10 +1,10 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "prometheus-prefect-exporter.fullname" . }} + name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: - {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} + {{- include "common.labels.standard" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -13,4 +13,4 @@ spec: protocol: TCP name: http selector: - {{- include "prometheus-prefect-exporter.selectorLabels" . | nindent 4 }} + {{- include "common.labels.matchLabels" . | nindent 4 }} diff --git a/charts/prometheus-prefect-exporter/templates/serviceaccount.yaml b/charts/prometheus-prefect-exporter/templates/serviceaccount.yaml index 09780488..fc614b33 100644 --- a/charts/prometheus-prefect-exporter/templates/serviceaccount.yaml +++ b/charts/prometheus-prefect-exporter/templates/serviceaccount.yaml @@ -5,7 +5,7 @@ metadata: name: {{ include "prometheus-prefect-exporter.serviceAccountName" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: - {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} + {{- include "common.labels.standard" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/prometheus-prefect-exporter/templates/servicemonitor.yaml b/charts/prometheus-prefect-exporter/templates/servicemonitor.yaml index dbe5f6b4..b86487ed 100644 --- a/charts/prometheus-prefect-exporter/templates/servicemonitor.yaml +++ b/charts/prometheus-prefect-exporter/templates/servicemonitor.yaml @@ -2,10 +2,10 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ include "prometheus-prefect-exporter.fullname" . }} + name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: - {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} + {{- include "common.labels.standard" . | nindent 4 }} {{- with .Values.serviceMonitor.additionalLabels }} {{- toYaml . | nindent 4 }} {{- end }} @@ -13,7 +13,7 @@ spec: jobLabel: "{{ .Release.Name }}" selector: matchLabels: - {{- include "prometheus-prefect-exporter.selectorLabels" . | nindent 8 }} + {{- include "common.labels.matchLabels" . | nindent 8 }} endpoints: - port: http interval: {{ .Values.serviceMonitor.interval | quote }} diff --git a/charts/prometheus-prefect-exporter/templates/tests/test-connection.yaml b/charts/prometheus-prefect-exporter/templates/tests/test-connection.yaml index e4169f95..4d0ca9e9 100644 --- a/charts/prometheus-prefect-exporter/templates/tests/test-connection.yaml +++ b/charts/prometheus-prefect-exporter/templates/tests/test-connection.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "prometheus-prefect-exporter.fullname" . }}-test-connection" + name: "{{ include "common.names.fullname" . }}-test-connection" labels: - {{- include "prometheus-prefect-exporter.labels" . | nindent 4 }} + {{- include "common.labels.standard" . | nindent 4 }} annotations: "helm.sh/hook": test spec: @@ -12,6 +12,6 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "prometheus-prefect-exporter.fullname" . }}:{{ .Values.service.targetPort | default .Values.service.port }}'] + args: ['{{ include "common.names.fullname" . }}:{{ .Values.service.targetPort | default .Values.service.port }}'] restartPolicy: Never {{- end }} diff --git a/charts/prometheus-prefect-exporter/values.yaml b/charts/prometheus-prefect-exporter/values.yaml index 6d0bcd4b..c854566a 100644 --- a/charts/prometheus-prefect-exporter/values.yaml +++ b/charts/prometheus-prefect-exporter/values.yaml @@ -8,10 +8,10 @@ image: # Overrides the image tag whose default is the chart appVersion. tag: 1.1.0 -# -- String to partially override prometheus-prefect-exporter.fullname template (will maintain the release name) +# -- String to partially override common.names.fullname template (will maintain the release name) nameOverride: "" -# -- String to fully override prometheus-prefect-exporter.fullname template +# -- String to fully override common.names.fullname template fullnameOverride: "" # -- Global Docker registry secret names as an array