diff --git a/charts/netbox/Chart.yaml b/charts/netbox/Chart.yaml index 2dbb15e0..bee6b80b 100644 --- a/charts/netbox/Chart.yaml +++ b/charts/netbox/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: netbox -version: 5.0.0-beta1 +version: 5.0.0-beta2 appVersion: "v3.6.4" type: application kubeVersion: ^1.25.0-0 diff --git a/charts/netbox/templates/NOTES.txt b/charts/netbox/templates/NOTES.txt index 97ca55a0..dc0fa4c6 100644 --- a/charts/netbox/templates/NOTES.txt +++ b/charts/netbox/templates/NOTES.txt @@ -8,21 +8,21 @@ NetBox should be available at the following URL(s) shortly: {{- else if contains "NodePort" .Values.service.type }} Get the application URL by running these commands: - 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}") + export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . | quote }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.names.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . | quote }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} Get the application URL by running these commands: - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . | quote }} {{ include "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo http://$SERVICE_IP:{{ .Values.service.port }} 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 "common.names.fullname" . }}' + You can watch the status of by running 'kubectl get --namespace {{ include "common.names.namespace" . | quote }} svc -w {{ include "common.names.fullname" . }}' {{- else if contains "ClusterIP" .Values.service.type }} Get the application URL by running these commands: - 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 POD_NAME=$(kubectl get pods --namespace {{ include "common.names.namespace" . | quote }} -l "app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl port-forward $POD_NAME 8080:8080 {{- end }} diff --git a/charts/netbox/templates/configmap.yaml b/charts/netbox/templates/configmap.yaml index b2b693f7..2e7815c1 100644 --- a/charts/netbox/templates/configmap.yaml +++ b/charts/netbox/templates/configmap.yaml @@ -2,12 +2,11 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "common.names.fullname" . }} - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} data: configuration.py: |- import re diff --git a/charts/netbox/templates/cronjob.yaml b/charts/netbox/templates/cronjob.yaml index 379d5863..bdd0df8e 100644 --- a/charts/netbox/templates/cronjob.yaml +++ b/charts/netbox/templates/cronjob.yaml @@ -2,14 +2,13 @@ apiVersion: batch/v1 kind: CronJob metadata: - name: {{ include "common.names.fullname" . }}-housekeeping - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} + name: {{ printf "%s-housekeeping" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: housekeeping + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: concurrencyPolicy: {{ .Values.housekeeping.concurrencyPolicy }} failedJobsHistoryLimit: {{ .Values.housekeeping.failedJobsHistoryLimit }} diff --git a/charts/netbox/templates/deployment.yaml b/charts/netbox/templates/deployment.yaml index 614a868a..3a3766df 100644 --- a/charts/netbox/templates/deployment.yaml +++ b/charts/netbox/templates/deployment.yaml @@ -2,13 +2,12 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "common.names.fullname" . }} - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: netbox + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} diff --git a/charts/netbox/templates/hpa.yaml b/charts/netbox/templates/hpa.yaml index ebcbcc67..4123dc3a 100644 --- a/charts/netbox/templates/hpa.yaml +++ b/charts/netbox/templates/hpa.yaml @@ -3,13 +3,12 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "common.names.fullname" . }} - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: netbox + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: scaleTargetRef: apiVersion: apps/v1 diff --git a/charts/netbox/templates/ingress.yaml b/charts/netbox/templates/ingress.yaml index 82836f5d..8ad007be 100644 --- a/charts/netbox/templates/ingress.yaml +++ b/charts/netbox/templates/ingress.yaml @@ -1,19 +1,13 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "common.names.fullname" . -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ $fullName }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} - {{- if or .Values.commonAnnotations .Values.ingress.annotations }} - annotations: - {{- with .Values.ingress.annotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} + name: {{ include "common.names.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if or .Values.service.annotations .Values.commonAnnotations }} + {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.ingress.annotations .Values.commonAnnotations ) "context" . ) }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} spec: ingressClassName: {{ .Values.ingress.className }} @@ -38,7 +32,7 @@ spec: pathType: Prefix backend: service: - name: {{ $fullName }} + name: {{ include "common.names.fullname" . }} port: name: http {{- else }} diff --git a/charts/netbox/templates/pvc-media.yaml b/charts/netbox/templates/pvc-media.yaml index e832435d..d483da1b 100644 --- a/charts/netbox/templates/pvc-media.yaml +++ b/charts/netbox/templates/pvc-media.yaml @@ -2,13 +2,12 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ include "common.names.fullname" . }}-media - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} + name: {{ printf "%s-media" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }} diff --git a/charts/netbox/templates/pvc-reports.yaml b/charts/netbox/templates/pvc-reports.yaml index 97f61182..2f79d6fa 100644 --- a/charts/netbox/templates/pvc-reports.yaml +++ b/charts/netbox/templates/pvc-reports.yaml @@ -2,13 +2,12 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ include "common.names.fullname" . }}-reports - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} + name: {{ printf "%s-reports" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} spec: accessModes: - {{ .Values.reportsPersistence.accessMode | quote }} diff --git a/charts/netbox/templates/secret.yaml b/charts/netbox/templates/secret.yaml index 776b568a..951b2459 100644 --- a/charts/netbox/templates/secret.yaml +++ b/charts/netbox/templates/secret.yaml @@ -2,13 +2,12 @@ apiVersion: v1 kind: Secret metadata: - name: {{ include "common.names.fullname" . }} - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} + name: {{ include "common.secrets.name" (dict "context" $) }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} type: Opaque data: {{ if and (not .Values.postgresql.enabled) (not .Values.externalDatabase.existingSecretName) -}} diff --git a/charts/netbox/templates/service.yaml b/charts/netbox/templates/service.yaml index 783eeb6b..9caada6d 100644 --- a/charts/netbox/templates/service.yaml +++ b/charts/netbox/templates/service.yaml @@ -2,16 +2,11 @@ apiVersion: v1 kind: Service metadata: name: {{ include "common.names.fullname" . }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} - {{- if or .Values.commonAnnotations .Values.service.annotations }} - annotations: - {{- with .Values.service.annotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if or .Values.service.annotations .Values.commonAnnotations }} + {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.service.annotations .Values.commonAnnotations ) "context" . ) }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} spec: type: {{ .Values.service.type }} diff --git a/charts/netbox/templates/serviceaccount.yaml b/charts/netbox/templates/serviceaccount.yaml index cc90118e..674b9222 100644 --- a/charts/netbox/templates/serviceaccount.yaml +++ b/charts/netbox/templates/serviceaccount.yaml @@ -4,16 +4,11 @@ kind: ServiceAccount automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} metadata: name: {{ include "netbox.serviceAccountName" . }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if or .Values.commonAnnotations .Values.serviceAccount.annotations }} - annotations: - {{- with .Values.serviceAccount.annotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} + {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} {{- with .Values.serviceAccount.imagePullSecrets }} imagePullSecrets: diff --git a/charts/netbox/templates/servicemonitor.yaml b/charts/netbox/templates/servicemonitor.yaml index c9df9bf2..3dea01e6 100644 --- a/charts/netbox/templates/servicemonitor.yaml +++ b/charts/netbox/templates/servicemonitor.yaml @@ -3,17 +3,17 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "common.names.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} - {{- with .Values.serviceMonitor.additionalLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} + namespace: {{ include "common.names.namespace" . | quote }} + {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceMonitor.additionalLabels .Values.commonLabels ) "context" . ) }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: - jobLabel: {{ .Release.Name }} + jobLabel: {{ include "common.names.fullname" . }} namespaceSelector: matchNames: - - {{ .Release.Namespace }} + - {{ include "common.names.namespace" . | quote }} selector: matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} diff --git a/charts/netbox/templates/worker-deployment.yaml b/charts/netbox/templates/worker-deployment.yaml index 63594fc7..51c11f70 100644 --- a/charts/netbox/templates/worker-deployment.yaml +++ b/charts/netbox/templates/worker-deployment.yaml @@ -2,14 +2,13 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "common.names.fullname" . }}-worker - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} + name: {{ printf "%s-worker" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: worker + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: {{- if not .Values.worker.autoscaling.enabled }} replicas: {{ .Values.worker.replicaCount }} diff --git a/charts/netbox/templates/worker-hpa.yaml b/charts/netbox/templates/worker-hpa.yaml index 1bc51c6e..82aa9a02 100644 --- a/charts/netbox/templates/worker-hpa.yaml +++ b/charts/netbox/templates/worker-hpa.yaml @@ -2,14 +2,13 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "common.names.fullname" . }}-worker - {{- with .Values.commonAnnotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} - labels: - {{- include "common.labels.standard" . | nindent 4 }} + name: {{ printf "%s-worker" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: worker + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: scaleTargetRef: apiVersion: apps/v1