Merge pull request #493 from tzabbi/main

fix: httproute invalid syntax and tweak chart
This commit is contained in:
Alam
2026-02-19 20:50:17 +05:30
committed by GitHub
12 changed files with 52 additions and 89 deletions

View File

@@ -7,10 +7,10 @@ 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: 1.0.0
version: 1.0.1
# 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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2.1.0"
appVersion: "2.1.1"

View File

@@ -30,7 +30,7 @@ ingress:
```yaml
gateway:
enabled: true
gatewayClassName: "cloudflare" # or your gateway class
gatewayClassName: 'cloudflare' # or your gateway class
httpRoute:
enabled: true
@@ -74,7 +74,7 @@ httpRoute:
```yaml
env:
- name: DISABLE_IPV6
value: "true"
value: 'true'
```
## Publish this chart to GHCR (OCI) for testing/deploying

View File

@@ -2,7 +2,7 @@
{{- if .Values.httpRoute.enabled }}
{{- $defaultGatewayName := .Values.gateway.name -}}
{{- if not $defaultGatewayName -}}
{{- $defaultGatewayName = printf "%s-gateway" (include "chart.fullname" .) -}}
{{- $defaultGatewayName = printf "%s-gateway" (include "bentopdf.name" .) -}}
{{- end -}}
{{- $defaultGatewayNs := .Release.Namespace -}}
{{- if .Values.gateway.enabled -}}
@@ -31,16 +31,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 "chart.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "bentopdf.name" . }})
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 its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chart.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "bentopdf.name" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bentopdf.name" . }} --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 "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}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT

View File

@@ -1,41 +1,23 @@
{{/*
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 "-" }}
{{- 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 "chart.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 "chart.chart" -}}
{{- define "bentopdf.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "chart.labels" -}}
helm.sh/chart: {{ include "chart.chart" . }}
{{ include "chart.selectorLabels" . }}
{{- define "bentopdf.labels" -}}
helm.sh/chart: {{ include "bentopdf.chart" . }}
{{ include "bentopdf.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
@@ -45,8 +27,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }}
{{- define "bentopdf.selectorLabels" -}}
app.kubernetes.io/name: {{ include "bentopdf.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

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

View File

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

View File

@@ -1,20 +1,11 @@
{{- if .Values.httpRoute.enabled -}}
{{- $fullName := include "chart.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- $defaultGatewayName := .Values.gateway.name -}}
{{- if not $defaultGatewayName -}}
{{- $defaultGatewayName = printf "%s-gateway" $fullName -}}
{{- end -}}
{{- $defaultGatewayNs := .Release.Namespace -}}
{{- if .Values.gateway.enabled -}}
{{- $defaultGatewayNs = default .Release.Namespace .Values.gateway.namespace -}}
{{- end -}}
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ $fullName }}
name: {{ include "bentopdf.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "chart.labels" . | nindent 4 }}
{{- include "bentopdf.labels" . | nindent 4 }}
{{- with .Values.httpRoute.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
@@ -23,14 +14,9 @@ spec:
parentRefs:
{{- if .Values.httpRoute.parentRefs }}
{{- range $ref := .Values.httpRoute.parentRefs }}
- name: {{ default $defaultGatewayName $ref.name | quote }}
{{- $refNs := $ref.namespace | default $defaultGatewayNs -}}
namespace: {{ $refNs | quote }}
{{- with $ref.sectionName }}
sectionName: {{ . | quote }}
{{- else }}
sectionName: "http"
{{- end }}
- name: {{ $.Values.gateway.name | default $ref.name | quote }}
namespace: {{ $ref.namespace | default (default $.Release.Namespace $.Values.gateway.namespace) | quote }}
sectionName: {{ $ref.sectionName | default "http" | quote }}
{{- with $ref.kind }}
kind: {{ . | quote }}
{{- end }}
@@ -40,8 +26,8 @@ spec:
{{- end }}
{{- else }}
# Default parentRef when parentRefs is empty or not set
- name: {{ $defaultGatewayName | quote }}
namespace: {{ $defaultGatewayNs | quote }}
- name: {{ .Values.gateway.name | default (printf "%s-gateway" (include "bentopdf.name" $)) | quote }}
namespace: {{ .Values.gateway.namespace | default .Release.Namespace | quote }}
sectionName: "http"
{{- end }}
{{- with .Values.httpRoute.hostnames }}
@@ -52,15 +38,15 @@ spec:
{{- range .Values.httpRoute.rules }}
- {{- with .matches }}
matches:
{{- toYaml . | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .filters }}
filters:
{{- toYaml . | nindent 8 }}
{{- end }}
backendRefs:
- name: {{ $fullName }}
port: {{ $svcPort }}
- name: {{ include "bentopdf.name" $ }}
port: {{ $.Values.service.port }}
weight: 1
{{- end }}
{{- end }}

View File

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

View File

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

View File

@@ -1,4 +0,0 @@
# The service account was removed, as it's not necessary for a chart like this.
#
# There are no calls to the Kubernetes API - routing between services.
# It's a simple nginx static website deployment only.

View File

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

View File

@@ -5,11 +5,10 @@ image:
# Image built from this repo's `Dockerfile` (nginx serving static frontend).
repository: ghcr.io/alam00000/bentopdf-simple
pullPolicy: IfNotPresent
tag: ""
tag: ''
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
nameOverride: ''
podAnnotations: {}
podLabels: {}
@@ -25,7 +24,7 @@ env: []
ingress:
enabled: false
className: ""
className: ''
annotations: {}
hosts:
- host: bentopdf.local
@@ -37,10 +36,10 @@ ingress:
# Gateway API (optional)
gateway:
enabled: false
name: "" # default: release fullname + "-gateway" suffix
namespace: "" # to override the namespace
name: '' # default: release name + "-gateway" suffix
namespace: '' # to override the namespace
annotations: {}
gatewayClassName: "" # required when enabled=true
gatewayClassName: '' # required when enabled=true
listeners:
- name: http
protocol: HTTP
@@ -61,8 +60,6 @@ httpRoute:
rules:
- matches:
- path:
type: PathPrefix
value: /
resources: {}