chore: replace chart value from the _helpers.tpl and set it to bentopdf

This commit is contained in:
Tom Zaspel
2026-02-19 11:06:50 +01:00
parent 1c7cc36472
commit b4ff2f68f8
8 changed files with 33 additions and 34 deletions

View File

@@ -2,7 +2,7 @@
{{- if .Values.httpRoute.enabled }} {{- if .Values.httpRoute.enabled }}
{{- $defaultGatewayName := .Values.gateway.name -}} {{- $defaultGatewayName := .Values.gateway.name -}}
{{- if not $defaultGatewayName -}} {{- if not $defaultGatewayName -}}
{{- $defaultGatewayName = printf "%s-gateway" (include "chart.fullname" .) -}} {{- $defaultGatewayName = printf "%s-gateway" (include "bentopdf.fullname" .) -}}
{{- end -}} {{- end -}}
{{- $defaultGatewayNs := .Release.Namespace -}} {{- $defaultGatewayNs := .Release.Namespace -}}
{{- if .Values.gateway.enabled -}} {{- if .Values.gateway.enabled -}}
@@ -31,16 +31,16 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- else if contains "NodePort" .Values.service.type }} {{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "chart.fullname" . }}) export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "bentopdf.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }} {{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chart.fullname" . }}' You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "bentopdf.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bentopdf.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }} echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }} {{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chart.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 "bentopdf.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}") 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" echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT

View File

@@ -1,7 +1,7 @@
{{/* {{/*
Expand the name of the chart. Expand the name of the bentopdf
*/}} */}}
{{- define "chart.name" -}} {{- define "bentopdf.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }} {{- end }}
@@ -10,7 +10,7 @@ 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). 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. If release name contains chart name it will be used as a full name.
*/}} */}}
{{- define "chart.fullname" -}} {{- define "bentopdf.fullname" -}}
{{- if .Values.fullnameOverride }} {{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }} {{- else }}
@@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/* {{/*
Create chart name and version as used by the chart label. Create chart name and version as used by the chart label.
*/}} */}}
{{- define "chart.chart" -}} {{- define "bentopdf.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }} {{- end }}
{{/* {{/*
Common labels Common labels
*/}} */}}
{{- define "chart.labels" -}} {{- define "bentopdf.labels" -}}
helm.sh/chart: {{ include "chart.chart" . }} helm.sh/chart: {{ include "bentopdf.chart" . }}
{{ include "chart.selectorLabels" . }} {{ include "bentopdf.selectorLabels" . }}
{{- if .Chart.AppVersion }} {{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }} {{- end }}
@@ -45,8 +45,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/* {{/*
Selector labels Selector labels
*/}} */}}
{{- define "chart.selectorLabels" -}} {{- define "bentopdf.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }} app.kubernetes.io/name: {{ include "bentopdf.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }} {{- end }}

View File

@@ -1,14 +1,14 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ include "chart.fullname" . }} name: {{ include "bentopdf.fullname" . }}
labels: labels:
{{- include "chart.labels" . | nindent 4 }} {{- include "bentopdf.labels" . | nindent 4 }}
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
selector: selector:
matchLabels: matchLabels:
{{- include "chart.selectorLabels" . | nindent 6 }} {{- include "bentopdf.selectorLabels" . | nindent 6 }}
template: template:
metadata: metadata:
{{- with .Values.podAnnotations }} {{- with .Values.podAnnotations }}
@@ -16,7 +16,7 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
labels: labels:
{{- include "chart.labels" . | nindent 8 }} {{- include "bentopdf.labels" . | nindent 8 }}
{{- with .Values.podLabels }} {{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}

View File

@@ -1,7 +1,7 @@
{{- if .Values.gateway.enabled -}} {{- if .Values.gateway.enabled -}}
{{- $gatewayName := .Values.gateway.name -}} {{- $gatewayName := .Values.gateway.name -}}
{{- if not $gatewayName -}} {{- if not $gatewayName -}}
{{- $gatewayName = printf "%s-gateway" (include "chart.fullname" .) -}} {{- $gatewayName = printf "%s-gateway" (include "bentopdf.fullname" .) -}}
{{- end -}} {{- end -}}
{{- $gatewayNs := default .Release.Namespace .Values.gateway.namespace -}} {{- $gatewayNs := default .Release.Namespace .Values.gateway.namespace -}}
apiVersion: gateway.networking.k8s.io/v1 apiVersion: gateway.networking.k8s.io/v1
@@ -10,7 +10,7 @@ metadata:
name: {{ $gatewayName }} name: {{ $gatewayName }}
namespace: {{ $gatewayNs }} namespace: {{ $gatewayNs }}
labels: labels:
{{- include "chart.labels" . | nindent 4 }} {{- include "bentopdf.labels" . | nindent 4 }}
{{- with .Values.gateway.annotations }} {{- with .Values.gateway.annotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}

View File

@@ -2,9 +2,9 @@
apiVersion: gateway.networking.k8s.io/v1 apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute kind: HTTPRoute
metadata: metadata:
name: {{ include "chart.fullname" . }} name: {{ include "bentopdf.fullname" . }}
labels: labels:
{{- include "chart.labels" . | nindent 4 }} {{- include "bentopdf.labels" . | nindent 4 }}
{{- with .Values.httpRoute.annotations }} {{- with .Values.httpRoute.annotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
@@ -25,7 +25,7 @@ spec:
{{- end }} {{- end }}
{{- else }} {{- else }}
# Default parentRef when parentRefs is empty or not set # Default parentRef when parentRefs is empty or not set
- name: {{ .Values.gateway.name | default (printf "%s-gateway" (include "chart.fullName" .)) | quote }} - name: {{ .Values.gateway.name | default (printf "%s-gateway" (include "bentopdf.fullName" .)) | quote }}
namespace: {{ default .Release.Namespace .Values.gateway.namespace | quote }} namespace: {{ default .Release.Namespace .Values.gateway.namespace | quote }}
sectionName: "http" sectionName: "http"
{{- end }} {{- end }}
@@ -44,7 +44,7 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
backendRefs: backendRefs:
- name: {{ include "chart.fullname" }} - name: {{ include "bentopdf.fullname" }}
port: {{ $.Values.service.port }} port: {{ $.Values.service.port }}
weight: 1 weight: 1
{{- end }} {{- end }}

View File

@@ -2,9 +2,9 @@
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ include "chart.fullname" . }} name: {{ include "bentopdf.fullname" . }}
labels: labels:
{{- include "chart.labels" . | nindent 4 }} {{- include "bentopdf.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }} {{- with .Values.ingress.annotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
@@ -35,7 +35,7 @@ spec:
{{- end }} {{- end }}
backend: backend:
service: service:
name: {{ include "chart.fullname" $ }} name: {{ include "bentopdf.fullname" $ }}
port: port:
number: {{ $.Values.service.port }} number: {{ $.Values.service.port }}
{{- end }} {{- end }}

View File

@@ -1,9 +1,9 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ include "chart.fullname" . }} name: {{ include "bentopdf.fullname" . }}
labels: labels:
{{- include "chart.labels" . | nindent 4 }} {{- include "bentopdf.labels" . | nindent 4 }}
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
@@ -12,4 +12,4 @@ spec:
protocol: TCP protocol: TCP
name: http name: http
selector: selector:
{{- include "chart.selectorLabels" . | nindent 4 }} {{- include "bentopdf.selectorLabels" . | nindent 4 }}

View File

@@ -1,9 +1,9 @@
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: "{{ include "chart.fullname" . }}-test-connection" name: "{{ include "bentopdf.fullname" . }}-test-connection"
labels: labels:
{{- include "chart.labels" . | nindent 4 }} {{- include "bentopdf.labels" . | nindent 4 }}
annotations: annotations:
"helm.sh/hook": test "helm.sh/hook": test
spec: spec:
@@ -11,5 +11,5 @@ spec:
- name: wget - name: wget
image: busybox image: busybox
command: ['wget'] command: ['wget']
args: ['-qO-', 'http://{{ include "chart.fullname" . }}:{{ .Values.service.port }}/'] args: ['-qO-', 'http://{{ include "bentopdf.fullname" . }}:{{ .Values.service.port }}/']
restartPolicy: Never restartPolicy: Never