diff --git a/RELEASE.md b/RELEASE.md index 106165b..0aa21bc 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -38,7 +38,7 @@ npm run release:major # Major: 1.0.0 → 2.0.0 (breaking changes) **What Happens:** - ✅ Your feature commit stays as-is -- ✅ Version gets bumped in `package.json` +- ✅ Version gets bumped in `package.json` and `chart/Chart.yaml` - ✅ New release commit is created - ✅ Git tag is created (e.g., `v1.0.1`) - ✅ Everything gets pushed to GitHub diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 812fd93..52152a1 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -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: 0.2.0 +version: 1.0.0 # 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: "1.15.4" +appVersion: "2.1.0" diff --git a/chart/README.md b/chart/README.md index 5199ab9..9897258 100644 --- a/chart/README.md +++ b/chart/README.md @@ -2,49 +2,17 @@ Deploys **BentoPDF** as a **single NGINX container** serving the static frontend. -## Prereqs +## Quickstart -- Kubernetes cluster -- Helm v3 with OCI support -- An image that serves BentoPDF via nginx (default chart expects the repo image, which listens on **8080** inside the container) - -## Quickstart (ClusterIP + port-forward) +### Option 1: Port-forward (testing) ```bash helm install bentopdf ./chart - kubectl port-forward deploy/bentopdf 8080:8080 # open http://127.0.0.1:8080 ``` -## Configuration - -### Image - -- **`image.repository`**: container image repo (default `bentopdf/bentopdf`) -- **`image.tag`**: image tag (default: `Chart.appVersion`) -- **`image.pullPolicy`**: default `IfNotPresent` - -### Ports - -- **`containerPort`**: container listen port (**8080** for the BentoPDF nginx image) -- **`service.port`**: Service port exposed in-cluster (default **80**) - -### Environment variables - -Use **`env`** for the container. - -Example (IPv4-only environments): - -```yaml -env: - - name: DISABLE_IPV6 - value: "true" -``` - -### Ingress (optional) - -Enable the built-in Kubernetes Ingress: +### Option 2: Ingress ```yaml ingress: @@ -57,38 +25,56 @@ ingress: pathType: Prefix ``` -### Gateway API: Gateway + HTTPRoute (optional) - -This chart can optionally: - -- Create a **Gateway** (`gateway.enabled=true`) -- Create an **HTTPRoute** (`httpRoute.enabled=true`) that points at the chart Service - -If your cluster uses a shared Gateway created elsewhere, set `gateway.enabled=false` and point `httpRoute.parentRefs` to that Gateway. - -Example (create both Gateway + HTTPRoute): +### Option 3: Gateway API (Gateway + HTTPRoute) ```yaml gateway: enabled: true - gatewayClassName: cloudflare # or nginx, istio, etc (controller-specific) - listeners: - - name: http - protocol: HTTP - port: 80 + gatewayClassName: "cloudflare" # or your gateway class httpRoute: enabled: true hostnames: - - bentopdf.example.com + - pdfs.example.com +``` + +**Note:** Both Gateway and HTTPRoute default to the release namespace. Omit `namespace` fields to use the release namespace automatically. + +If you have an existing Gateway, set `gateway.enabled=false` and configure `httpRoute.parentRefs`: + +```yaml +gateway: + enabled: false + +httpRoute: + enabled: true parentRefs: - - name: "" # default: release fullname (or gateway.name if set) + - name: existing-gateway + namespace: gateway-namespace sectionName: http - rules: - - matches: - - path: - type: PathPrefix - value: / + hostnames: + - pdfs.example.com +``` + +## Configuration + +### Image + +- **`image.repository`**: container image repo (default: `ghcr.io/alam00000/bentopdf-simple`) +- **`image.tag`**: image tag (default: `Chart.appVersion`) +- **`image.pullPolicy`**: default `IfNotPresent` + +### Ports + +- **`containerPort`**: container listen port (**8080** for the BentoPDF nginx image) +- **`service.port`**: Service port exposed in-cluster (default **80**) + +### Environment Variables + +```yaml +env: + - name: DISABLE_IPV6 + value: "true" ``` ## Publish this chart to GHCR (OCI) for testing/deploying @@ -110,5 +96,5 @@ This could be automated as part of a Github workflow. ### Deploy ```bash -helm upgrade --install bentopdf oci://ghcr.io/$GHCR_USERNAME/charts/bentopdf --version 0.1.0 +helm upgrade --install bentopdf oci://ghcr.io/$GHCR_USERNAME/charts/bentopdf --version 1.0.0 ``` diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt index 137f4f1..c99d3b0 100644 --- a/chart/templates/NOTES.txt +++ b/chart/templates/NOTES.txt @@ -1,17 +1,29 @@ 1. Get the application URL by running these commands: {{- if .Values.httpRoute.enabled }} +{{- $defaultGatewayName := .Values.gateway.name -}} +{{- if not $defaultGatewayName -}} +{{- $defaultGatewayName = printf "%s-gateway" (include "chart.fullname" .) -}} +{{- end -}} +{{- $defaultGatewayNs := .Release.Namespace -}} +{{- if .Values.gateway.enabled -}} +{{- $defaultGatewayNs = default .Release.Namespace .Values.gateway.namespace -}} +{{- end -}} +{{- $gatewayName := $defaultGatewayName -}} +{{- $gatewayNs := $defaultGatewayNs -}} +{{- if and .Values.httpRoute.parentRefs (first .Values.httpRoute.parentRefs) -}} +{{- $firstRef := first .Values.httpRoute.parentRefs -}} +{{- $gatewayName = default $defaultGatewayName $firstRef.name -}} +{{- $gatewayNs = default $defaultGatewayNs $firstRef.namespace -}} +{{- end -}} {{- if .Values.httpRoute.hostnames }} export APP_HOSTNAME={{ .Values.httpRoute.hostnames | first }} + echo "Visit http://$APP_HOSTNAME to use your application" {{- else }} - export APP_HOSTNAME=$(kubectl get --namespace {{(first .Values.httpRoute.parentRefs).namespace | default .Release.Namespace }} gateway/{{ (first .Values.httpRoute.parentRefs).name }} -o jsonpath="{.spec.listeners[0].hostname}") - {{- end }} -{{- if and .Values.httpRoute.rules (first .Values.httpRoute.rules).matches (first (first .Values.httpRoute.rules).matches).path.value }} - echo "Visit http://$APP_HOSTNAME{{ (first (first .Values.httpRoute.rules).matches).path.value }} to use your application" - + echo "HTTPRoute is enabled. Configure httpRoute.hostnames to see your URL here." +{{- end }} NOTE: Your HTTPRoute depends on the listener configuration of your gateway and your HTTPRoute rules. The rules can be set for path, method, header and query parameters. - You can check the gateway configuration with 'kubectl get --namespace {{(first .Values.httpRoute.parentRefs).namespace | default .Release.Namespace }} gateway/{{ (first .Values.httpRoute.parentRefs).name }} -o yaml' -{{- end }} + You can check the gateway configuration with 'kubectl get --namespace {{ $gatewayNs }} gateway/{{ $gatewayName }} -o yaml' {{- else if .Values.ingress.enabled }} {{- range $host := .Values.ingress.hosts }} {{- range .paths }} diff --git a/chart/templates/gateway.yaml b/chart/templates/gateway.yaml index b43028f..9914d0c 100644 --- a/chart/templates/gateway.yaml +++ b/chart/templates/gateway.yaml @@ -1,9 +1,14 @@ {{- if .Values.gateway.enabled -}} +{{- $gatewayName := .Values.gateway.name -}} +{{- if not $gatewayName -}} +{{- $gatewayName = printf "%s-gateway" (include "chart.fullname" .) -}} +{{- end -}} +{{- $gatewayNs := default .Release.Namespace .Values.gateway.namespace -}} apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: - name: {{ default (include "chart.fullname" .) .Values.gateway.name }} - namespace: {{ default .Release.Namespace .Values.gateway.namespace }} + name: {{ $gatewayName }} + namespace: {{ $gatewayNs }} labels: {{- include "chart.labels" . | nindent 4 }} {{- with .Values.gateway.annotations }} diff --git a/chart/templates/httproute.yaml b/chart/templates/httproute.yaml index 38a527a..5d656c8 100644 --- a/chart/templates/httproute.yaml +++ b/chart/templates/httproute.yaml @@ -1,7 +1,14 @@ {{- if .Values.httpRoute.enabled -}} {{- $fullName := include "chart.fullname" . -}} {{- $svcPort := .Values.service.port -}} -{{- $defaultGatewayName := (default $fullName .Values.gateway.name) -}} +{{- $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: @@ -14,13 +21,15 @@ metadata: {{- end }} 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 }} - {{- end }} - {{- with $ref.namespace }} - namespace: {{ . | quote }} + {{- else }} + sectionName: "http" {{- end }} {{- with $ref.kind }} kind: {{ . | quote }} @@ -29,20 +38,26 @@ spec: group: {{ . | quote }} {{- end }} {{- end }} + {{- else }} + # Default parentRef when parentRefs is empty or not set + - name: {{ $defaultGatewayName | quote }} + namespace: {{ $defaultGatewayNs | quote }} + sectionName: "http" + {{- end }} {{- with .Values.httpRoute.hostnames }} hostnames: {{- toYaml . | nindent 4 }} {{- end }} rules: {{- range .Values.httpRoute.rules }} - {{- with .matches }} - - matches: + - {{- with .matches }} + matches: {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .filters }} + {{- end }} + {{- with .filters }} filters: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} backendRefs: - name: {{ $fullName }} port: {{ $svcPort }} diff --git a/chart/values.yaml b/chart/values.yaml index 6670d22..9f5fa18 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -3,7 +3,7 @@ replicaCount: 1 image: # Image built from this repo's `Dockerfile` (nginx serving static frontend). - repository: alam00000/bentopdf-simple + repository: ghcr.io/alam00000/bentopdf-simple pullPolicy: IfNotPresent tag: "" @@ -37,21 +37,25 @@ ingress: # Gateway API (optional) gateway: enabled: false - name: "" # default: release fullname - namespace: "" # default: release namespace + name: "" # default: release fullname + "-gateway" suffix + namespace: "" # to override the namespace annotations: {} gatewayClassName: "" # required when enabled=true listeners: - name: http protocol: HTTP port: 80 + allowedRoutes: + namespaces: + from: Same # Allow routes from the same namespace httpRoute: enabled: false annotations: {} - parentRefs: - - name: "" # default: gateway.name (if set) else release fullname - sectionName: http + # 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: - bentopdf.local rules: