Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kubernetes-ingress/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ apiVersion: v2
name: kubernetes-ingress
description: A Helm chart for HAProxy Kubernetes Ingress Controller
type: application
version: 1.52.1
version: 1.53.0
appVersion: 3.2.12
kubeVersion: ">=1.23.0-0"
keywords:
Expand Down
8 changes: 8 additions & 0 deletions kubernetes-ingress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,14 @@ A Helm `post-install` / `pre-upgrade` hook Job that applies the controller's CRD
| `crdjob.nodeSelector` / `.tolerations` / `.affinity` | Scheduling controls for the Job pod. | `{}` / `[]` / `{}` |
| `crdjob.resources.requests` / `.limits` | CPU/memory requests and (optional) limits for the Job container. | `cpu: 250m`, `memory: 400Mi` (no limits) |

### Extra Objects

Declare additional arbitrary raw CR manifests to deploy as a part of the helm release.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

table is missing its header row

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, my bad, added missing table header

| Key | Description | Default |
|---|---|---|
| `extraObjects` | Extra raw objects to template. | `[]` |

### Migration notes (1.50.0)

- **Prometheus / pprof decoupled from `admin` port.** Previously, setting `controller.service.enablePorts.admin=false` implicitly disabled the controller's `/metrics` and `/debug/pprof` endpoints. Starting in 1.50.0, the dedicated toggles `controller.prometheus.enabled` and `controller.pprof.enabled` control these (both default `true`). If you were relying on the old coupling, set the new toggles to `false` explicitly.
Expand Down
16 changes: 16 additions & 0 deletions kubernetes-ingress/ci/deployment-extraobjects-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extraObjects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: extra-conf-1
data:
extra.conf: |
example_config_1
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-extra-conf-2
data:
extra.conf: |
example_config_2
68 changes: 68 additions & 0 deletions kubernetes-ingress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,72 @@ Create a name for the auxiliary configmap.
{{- printf "%s-%s" (include "kubernetes-ingress.fullname" . | trunc 54 | trimSuffix "-") "auxiliary" }}
{{- end -}}

{{/*
Create extra raw objects labels.
*/}}
{{- define "kubernetes-ingress.extraRawLabels" -}}
metadata:
labels:
{{- include "kubernetes-ingress.labels" $ | nindent 4 }}
{{- end }}

{{/*
Ensure an extra object is a Kubernetes CR.
It must be a map with at least apiVersion, kind, metadata.name, spec or data keys.
*/}}
{{- define "kubernetes-ingress.validateExtraObject" -}}
{{- $obj := . -}}
{{- $tplName := "kubernetes-ingress.validateExtraObject" -}}
{{- if not (kindIs "map" $obj) -}}
{{- fail (printf "%s: expected a map, got %s" $tplName (kindOf $obj)) -}}
{{- end -}}
{{- if not (hasKey $obj "apiVersion") -}}
{{- fail (printf "%s: object is missing required key 'apiVersion'" $tplName) -}}
{{- end -}}
{{- if not (kindIs "string" $obj.apiVersion) -}}
{{- fail (printf "%s: 'apiVersion' must be a string, got %s" $tplName (kindOf $obj.apiVersion)) -}}
{{- end -}}
{{- $_ := required (printf "%s: 'apiVersion' must not be empty" $tplName) $obj.apiVersion -}}
{{- if not (hasKey $obj "kind") -}}
{{- fail (printf "%s: object is missing required key 'kind'" $tplName) -}}
{{- end -}}
{{- if not (kindIs "string" $obj.kind) -}}
{{- fail (printf "%s: 'kind' must be a string, got %s" $tplName (kindOf $obj.kind)) -}}
{{- end -}}
{{- $_ := required (printf "%s: 'kind' must not be empty" $tplName) $obj.kind -}}
{{- if not (hasKey $obj "metadata") -}}
{{- fail (printf "%s: object is missing required key 'metadata'" $tplName) -}}
{{- end -}}
{{- if not (kindIs "map" $obj.metadata) -}}
{{- fail (printf "%s: 'metadata' must be a map, got %s" $tplName (kindOf $obj.metadata)) -}}
{{- end -}}
{{- if not (hasKey $obj.metadata "name") -}}
{{- fail (printf "%s: object is missing required key 'metadata.name'" $tplName) -}}
{{- end -}}
{{- if not (kindIs "string" $obj.metadata.name) -}}
{{- fail (printf "%s: 'metadata.name' must be a string, got %s" $tplName (kindOf $obj.metadata.name)) -}}
{{- end -}}
{{- $_ := required (printf "%s: 'metadata.name' must not be empty" $tplName) $obj.metadata.name -}}
{{- if not (or (hasKey $obj "spec") (hasKey $obj "data")) -}}
{{- fail (printf "%s: object must have either 'spec' or 'data' key" $tplName) -}}
{{- end -}}
{{- end }}

{{/*
Render an extra object that might contain templates.
*/}}
{{- define "kubernetes-ingress.renderExtraObject" -}}
{{- $labels := fromYaml (include "kubernetes-ingress.extraRawLabels" .context) -}}
{{- if typeIs "string" .value }}
{{- /* string form is an explicit opt-in to templating */ -}}
{{- $templatedValue := fromYaml (tpl .value .context) -}}
{{- include "kubernetes-ingress.validateExtraObject" $templatedValue }}
{{- toYaml (merge $templatedValue $labels) }}
{{- else }}
{{- /* map form is emitted verbatim; foreign {{ }} left untouched */ -}}
{{- include "kubernetes-ingress.validateExtraObject" .value }}
{{- toYaml (merge (deepCopy .value) $labels) }}
{{- end }}
{{- end -}}

{{/* vim: set filetype=mustache: */}}
4 changes: 4 additions & 0 deletions kubernetes-ingress/templates/extra-objects.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- range .Values.extraObjects }}
---
{{ include "kubernetes-ingress.renderExtraObject" (dict "value" . "context" $) }}
{{- end }}
24 changes: 24 additions & 0 deletions kubernetes-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -735,3 +735,27 @@ crdjob:
requests:
cpu: 250m
memory: 400Mi

## Extra raw objects to template
## Note: this manifest is not capability-gated; if specific CRDs are
## missing, helm install will fail; this being said, this manifest
## is not intended to be used to deploy ingress.v3.haproxy.org/v3 CRs
## since their CRDs are installed/upgraded via a post-install/pre-upgrade job
extraObjects: []
## Use maps to declare raw manifests
# - apiVersion: v1
# kind: ConfigMap
# metadata:
# name: extra-conf-1
# data:
# extra.conf: |
# example_config_1
## Use multiline strings to declare templated manifests
# - |
# apiVersion: v1
# kind: ConfigMap
# metadata:
# name: {{ .Release.Name }}-extra-conf-2
# data:
# extra.conf: |
# example_config_2