diff --git a/chart/README.md b/chart/README.md index 9897258..18b6367 100644 --- a/chart/README.md +++ b/chart/README.md @@ -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 diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt index caf2882..fc3864e 100644 --- a/chart/templates/NOTES.txt +++ b/chart/templates/NOTES.txt @@ -2,7 +2,7 @@ {{- if .Values.httpRoute.enabled }} {{- $defaultGatewayName := .Values.gateway.name -}} {{- if not $defaultGatewayName -}} -{{- $defaultGatewayName = printf "%s-gateway" (include "bentopdf.fullname" .) -}} +{{- $defaultGatewayName = printf "%s-gateway" (include "bentopdf.name" .) -}} {{- end -}} {{- $defaultGatewayNs := .Release.Namespace -}} {{- if .Values.gateway.enabled -}} @@ -31,13 +31,13 @@ {{- 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 "bentopdf.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 "bentopdf.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bentopdf.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 "bentopdf.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 8e9fada..ba10597 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -5,24 +5,6 @@ Expand the name of the bentopdf {{- 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 "bentopdf.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. */}} diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 1d10c17..737e68f 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -1,7 +1,8 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "bentopdf.fullname" . }} + name: {{ include "bentopdf.name" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "bentopdf.labels" . | nindent 4 }} spec: diff --git a/chart/templates/gateway.yaml b/chart/templates/gateway.yaml index 3d2d378..9d0d6e9 100644 --- a/chart/templates/gateway.yaml +++ b/chart/templates/gateway.yaml @@ -1,7 +1,7 @@ {{- if .Values.gateway.enabled -}} {{- $gatewayName := .Values.gateway.name -}} {{- if not $gatewayName -}} -{{- $gatewayName = printf "%s-gateway" (include "bentopdf.fullname" .) -}} +{{- $gatewayName = printf "%s-gateway" (include "bentopdf.name" .) -}} {{- end -}} {{- $gatewayNs := default .Release.Namespace .Values.gateway.namespace -}} apiVersion: gateway.networking.k8s.io/v1 diff --git a/chart/templates/httproute.yaml b/chart/templates/httproute.yaml index 1a68e74..70e033a 100644 --- a/chart/templates/httproute.yaml +++ b/chart/templates/httproute.yaml @@ -2,7 +2,8 @@ apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: - name: {{ include "bentopdf.fullname" . }} + name: {{ include "bentopdf.name" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "bentopdf.labels" . | nindent 4 }} {{- with .Values.httpRoute.annotations }} @@ -14,7 +15,7 @@ spec: {{- if .Values.httpRoute.parentRefs }} {{- range $ref := .Values.httpRoute.parentRefs }} - name: {{ $.Values.gateway.name | default $ref.name | quote }} - namespace: {{ $ref.namespace | default (default .Release.Namespace .Values.gateway.namespace) | quote }} + namespace: {{ $ref.namespace | default (default $.Release.Namespace $.Values.gateway.namespace) | quote }} sectionName: {{ $ref.sectionName | default "http" | quote }} {{- with $ref.kind }} kind: {{ . | quote }} @@ -25,8 +26,8 @@ spec: {{- end }} {{- else }} # Default parentRef when parentRefs is empty or not set - - name: {{ .Values.gateway.name | default (printf "%s-gateway" (include "bentopdf.fullName" .)) | quote }} - namespace: {{ default .Release.Namespace .Values.gateway.namespace | 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 }} @@ -37,14 +38,14 @@ spec: {{- range .Values.httpRoute.rules }} - {{- with .matches }} matches: - {{- toYaml . | nindent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} {{- with .filters }} filters: {{- toYaml . | nindent 8 }} {{- end }} backendRefs: - - name: {{ include "bentopdf.fullname" }} + - name: {{ include "bentopdf.name" $ }} port: {{ $.Values.service.port }} weight: 1 {{- end }} diff --git a/chart/templates/ingress.yaml b/chart/templates/ingress.yaml index 0483758..04b8240 100644 --- a/chart/templates/ingress.yaml +++ b/chart/templates/ingress.yaml @@ -2,7 +2,8 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ include "bentopdf.fullname" . }} + name: {{ include "bentopdf.name" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "bentopdf.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} @@ -35,7 +36,7 @@ spec: {{- end }} backend: service: - name: {{ include "bentopdf.fullname" $ }} + name: {{ include "bentopdf.name" $ }} port: number: {{ $.Values.service.port }} {{- end }} diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml index b146567..04c36d0 100644 --- a/chart/templates/service.yaml +++ b/chart/templates/service.yaml @@ -1,7 +1,8 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "bentopdf.fullname" . }} + name: {{ include "bentopdf.name" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "bentopdf.labels" . | nindent 4 }} spec: diff --git a/chart/templates/serviceaccount.yaml b/chart/templates/serviceaccount.yaml deleted file mode 100644 index ff2b900..0000000 --- a/chart/templates/serviceaccount.yaml +++ /dev/null @@ -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. diff --git a/chart/templates/tests/test-connection.yaml b/chart/templates/tests/test-connection.yaml index 583ff07..474132a 100644 --- a/chart/templates/tests/test-connection.yaml +++ b/chart/templates/tests/test-connection.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "bentopdf.fullname" . }}-test-connection" + name: "{{ include "bentopdf.name" . }}-test-connection" labels: {{- include "bentopdf.labels" . | nindent 4 }} annotations: @@ -11,5 +11,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['-qO-', 'http://{{ include "bentopdf.fullname" . }}:{{ .Values.service.port }}/'] + args: ['-qO-', 'http://{{ include "bentopdf.name" . }}:{{ .Values.service.port }}/'] restartPolicy: Never diff --git a/chart/values.yaml b/chart/values.yaml index 2801907..505dc26 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -9,7 +9,6 @@ image: imagePullSecrets: [] nameOverride: '' -fullnameOverride: '' podAnnotations: {} podLabels: {} @@ -37,7 +36,7 @@ ingress: # Gateway API (optional) gateway: enabled: false - name: '' # default: release fullname + "-gateway" suffix + name: '' # default: release name + "-gateway" suffix namespace: '' # to override the namespace annotations: {} gatewayClassName: '' # required when enabled=true @@ -50,18 +49,17 @@ gateway: from: Same # Allow routes from the same namespace httpRoute: - enabled: true - parentRefs: - - name: existing-gateway - namespace: gateway-namespace - sectionName: http + enabled: false + annotations: {} + # parentRefs: # Omit entirely to use default (auto-references gateway in same namespace) + # - name: "" # default: gateway.name or {release-name}-gateway + # namespace: "" # to override the namespace + # sectionName: "http" hostnames: - - pdfs.example.com + - bentopdf.local rules: - matches: - path: - type: PathPrefix - value: / resources: {}