From 597afa2b405ea1106c77a1b27ba19dc806a32898 Mon Sep 17 00:00:00 2001
From: firmansyahn <80936459+firmansyahn@users.noreply.github.com>
Date: Thu, 13 Jun 2024 15:22:27 +0700
Subject: [PATCH 1/2] Fix external-db secret

---
 charts/netbox/templates/Deployment.yaml              | 4 ++--
 charts/netbox/templates/HorizontalPodAutoscaler.yaml | 2 +-
 charts/netbox/templates/Secret/external-db.yaml      | 2 +-
 charts/netbox/templates/ServiceAccount.yaml          | 6 +++---
 charts/netbox/templates/istio/Gateway.yaml           | 4 ++--
 charts/netbox/templates/istio/VirtualService.yaml    | 4 ++--
 charts/netbox/values.yaml                            | 8 ++++++--
 7 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/charts/netbox/templates/Deployment.yaml b/charts/netbox/templates/Deployment.yaml
index 6c6af30..235a5f3 100644
--- a/charts/netbox/templates/Deployment.yaml
+++ b/charts/netbox/templates/Deployment.yaml
@@ -4,7 +4,7 @@ metadata:
   name: {{ include "netbox.fullname" . }}
   namespace: {{ include "common.names.namespace" . | quote }}
   {{- $versionLabel := dict "app.kubernetes.io/version" ( include "netbox.images.version" (dict "imageRoot" .Values.image "global" .Values.global "chart" .Chart) ) }}  
-  {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
+  {{- $labels := include "common.tplvalues.merge" ( dict "values" (list .Values.commonLabels $versionLabel) "context" . ) }}
   labels: {{- include "common.labels.standard" (dict "customLabels" $labels "context" $) | nindent 4 }}
     app.kubernetes.io/component: server
     app.kubernetes.io/part-of: netbox
@@ -44,7 +44,7 @@ spec:
         {{- end }}
     spec:
       {{- if .Values.affinity }}
-      affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }}
+      affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
       {{- else }}
       affinity:
         podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }}
diff --git a/charts/netbox/templates/HorizontalPodAutoscaler.yaml b/charts/netbox/templates/HorizontalPodAutoscaler.yaml
index 6a9fb0e..44f16b2 100644
--- a/charts/netbox/templates/HorizontalPodAutoscaler.yaml
+++ b/charts/netbox/templates/HorizontalPodAutoscaler.yaml
@@ -8,7 +8,7 @@ metadata:
     app.kubernetes.io/component: server
     app.kubernetes.io/part-of: netbox
   {{- if .Values.commonAnnotations }}
-  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
+  annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
   {{- end }}
 spec:
   scaleTargetRef:
diff --git a/charts/netbox/templates/Secret/external-db.yaml b/charts/netbox/templates/Secret/external-db.yaml
index 40b5fff..fa84063 100644
--- a/charts/netbox/templates/Secret/external-db.yaml
+++ b/charts/netbox/templates/Secret/external-db.yaml
@@ -10,5 +10,5 @@ metadata:
   {{- end }}
 type: Opaque
 data:
-  {{ include "netbox.databaseSecretPasswordKey" . }}: {{ include "netbox.databasePassword" }}
+  {{ include "netbox.databaseSecretPasswordKey" . }}: {{ include "netbox.databasePassword" . }}
 {{- end }}
diff --git a/charts/netbox/templates/ServiceAccount.yaml b/charts/netbox/templates/ServiceAccount.yaml
index eaf81c7..1ab5084 100644
--- a/charts/netbox/templates/ServiceAccount.yaml
+++ b/charts/netbox/templates/ServiceAccount.yaml
@@ -5,10 +5,10 @@ automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountT
 metadata:
   name: {{ include "netbox.serviceAccountName" . }}
   namespace: {{ include "common.names.namespace" . | quote }}
-  labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
+  labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
   {{- if or .Values.commonAnnotations .Values.serviceAccount.annotations }}
-  {{- $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 }}
+  {{- $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/istio/Gateway.yaml b/charts/netbox/templates/istio/Gateway.yaml
index 1df970d..a78f2ba 100644
--- a/charts/netbox/templates/istio/Gateway.yaml
+++ b/charts/netbox/templates/istio/Gateway.yaml
@@ -7,7 +7,7 @@ metadata:
   namespace: {{ include "common.names.namespace" . | quote }}
   labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
   {{- if or .Values.ingress.annotations .Values.commonAnnotations }}
-  {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.ingress.annotations .Values.commonAnnotations ) "context" . ) }}
+  {{- $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:
@@ -38,7 +38,7 @@ spec:
         - {{ .name | quote }}
         {{- end }}
       tls:
-        credentialName: {{ printf "%s-tls" (include "netbox.fullname" .) }}
+        credentialName: {{ printf "%s-%s" (include "netbox.fullname" .) "tls" }}
         mode: SIMPLE
     {{- end }}
 {{- end -}}
diff --git a/charts/netbox/templates/istio/VirtualService.yaml b/charts/netbox/templates/istio/VirtualService.yaml
index 060f578..2dcbbdd 100644
--- a/charts/netbox/templates/istio/VirtualService.yaml
+++ b/charts/netbox/templates/istio/VirtualService.yaml
@@ -28,7 +28,7 @@ spec:
         {{- end }}            
       route:
         - destination:
-            host: {{ printf "%s.%s.svc.%s" (include "netbox.fullname" $) (include "common.names.namespace" .) .Values.clusterDomain }}
+            host: {{ printf "%s.%s.svc.%s" (include "netbox.fullname" $) (include "common.names.namespace" .) .Values.gateway.clusterDomain }}
             port:
               number: {{ .Values.service.ports.http }}
   {{- if or .Values.tls.enabled .Values.ingress.tls }}
@@ -42,7 +42,7 @@ spec:
             {{- end }}
       route:
         - destination:
-            host: {{ printf "%s.%s.svc.%s" (include "netbox.fullname" .) (include "common.names.namespace" .) .Values.clusterDomain }}
+            host: {{ printf "%s.%s.svc.%s" (include "netbox.fullname" .) (include "common.names.namespace" .) .Values.gateway.clusterDomain }}
   {{- end }}
 {{- end -}}
 {{- end -}}
diff --git a/charts/netbox/values.yaml b/charts/netbox/values.yaml
index c2e5676..5b813bf 100644
--- a/charts/netbox/values.yaml
+++ b/charts/netbox/values.yaml
@@ -150,12 +150,13 @@ extraEnvVars: []
 ##        name: secret-resource
 ##
 extraEnvs: []
-## @param extraEnvVarsCM Name of existing ConfigMap containing extra env vars for Netbox nodes
+## @param extraEnvVarsCM Name of existing ConfigMap containing extra env vars for Netbox server nodes
 ##
 extraEnvVarsCM: ""
-## @param extraEnvVarsSecret Name of existing Secret containing extra env vars for Netbox nodes
+## @param extraEnvVarsSecrets List of existing Secret containing extra env vars for Netbox server nodes
 ##
 extraEnvVarsSecret: ""
+extraEnvVarsSecrets: []
 ## @param containerPorts.http Container port to open on Netbox nodes
 ##
 containerPorts:
@@ -2699,6 +2700,9 @@ gateway:
     ## @param gateway.gatewayApi.create  Create Kubernetes Gateway API gateway HTTPRoute
     ## 
     create: false
+  ## @param gateway.clusterDomain  Name of gateway cluster domain
+  ##
+  clusterDomain: cluster.local
   ## @param gateway.name  Name of the Gateway resource
   ## e.g.
   ## name: istio-ingressgateway

From c71e11b808b2b493eb76ac4d4384f65533918f74 Mon Sep 17 00:00:00 2001
From: firmansyahn <80936459+firmansyahn@users.noreply.github.com>
Date: Thu, 13 Jun 2024 15:25:52 +0700
Subject: [PATCH 2/2] Bump version to 5.0.10

---
 charts/netbox/Chart.yaml | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/charts/netbox/Chart.yaml b/charts/netbox/Chart.yaml
index f9913ad..1a76e5e 100644
--- a/charts/netbox/Chart.yaml
+++ b/charts/netbox/Chart.yaml
@@ -1,20 +1,10 @@
 annotations:
   artifacthub.io/changes: |
     - kind: fixed
-      description: Add missing import if allowedHostsIncludesPodIp is true
+      description: Add missing parameter on external-db secret
       links:
-        - name: GitHub Pull Request
-          url: https://github.com/startechnica/apps/pull/68
-    - kind: changed
-      description: Update Netbox Docker to v2.8.0
-      links:
-        - name: GitHub Releases
-          url: https://github.com/netbox-community/netbox-docker/releases/tag/2.8.0
-    - kind: changed
-      description: Update Netbox v3.7.8
-      links:
-        - name: GitHub Releases
-          url: https://github.com/netbox-community/netbox/releases/tag/v3.7.8
+        - name: GitHub Issue
+          url: https://github.com/startechnica/apps/issues/71
   licenses: Apache-2.0
   images: |
     - name: netbox
@@ -53,4 +43,4 @@ keywords:
   - ipam
   - netbox
 type: application
-version: 5.0.9
\ No newline at end of file
+version: 5.0.10
\ No newline at end of file