diff --git a/parcellab/common/Chart.yaml b/parcellab/common/Chart.yaml index a614875..d408d3b 100644 --- a/parcellab/common/Chart.yaml +++ b/parcellab/common/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: common description: A Helm chart library for parcelLab charts type: library -version: 1.2.3 +version: 1.3.0 maintainers: - name: parcelLab email: engineering@parcellab.com diff --git a/parcellab/common/templates/_httproute.tpl b/parcellab/common/templates/_httproute.tpl new file mode 100644 index 0000000..4c4f758 --- /dev/null +++ b/parcellab/common/templates/_httproute.tpl @@ -0,0 +1,41 @@ +{{/* vim: set filetype=mustache: */}} +{{/* + Common httproute definition: + {{ include "common.httproute" ( + dict + "Values" "the values scope" + ) }} +*/}} + +{{- define "common.httproute" -}} +{{- $envoy := .Values.envoy | default dict -}} +{{- $httproute := $envoy.httpRoute | default dict -}} +{{- if $httproute.enabled }} +{{- $name := include "common.fullname" . }} +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "common.labels" . | nindent 4 }} +spec: + parentRefs: + - name: {{ required "httproute.parentGateway is required" $httproute.parentGateway }} + namespace: {{ $httproute.parentGatewayNamespace | default "envoy-gateway" }} + {{- with $httproute.hosts }} + hostnames: + {{- range . }} + - {{ . | quote }} + {{- end }} + {{- end }} + rules: + - matches: + - path: + type: PathPrefix + value: {{ $httproute.path | default "/" }} + backendRefs: + - name: {{ include "common.fullname" . }} + port: {{ .Values.service.port }} +{{- end }} +{{- end -}} diff --git a/parcellab/common/templates/_referencegrant.tpl b/parcellab/common/templates/_referencegrant.tpl new file mode 100644 index 0000000..8072bc6 --- /dev/null +++ b/parcellab/common/templates/_referencegrant.tpl @@ -0,0 +1,58 @@ +{{/* vim: set filetype=mustache: */}} +{{/* + Common ReferenceGrant definition: + {{ include "common.referencegrant" ( + dict + "Values" "the values scope" + "Release" .Release + ) }} +*/}} + +{{- define "common.referencegrant" -}} +{{- $envoy := .Values.envoy | default dict -}} +{{- $referenceGrant := $envoy.referenceGrant | default dict -}} +{{- if $referenceGrant.enabled }} +{{- $name := include "common.fullname" . }} +--- +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: ReferenceGrant +metadata: + name: {{ $referenceGrant.name | default (printf "%s-grant" $name) }} + namespace: {{ $referenceGrant.namespace | default .Release.Namespace }} + labels: + {{- include "common.labels" . | nindent 4 }} + {{- with $referenceGrant.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + from: + {{- if $referenceGrant.from }} + {{- range $referenceGrant.from }} + - group: {{ .group | default "gateway.networking.k8s.io" | quote }} + kind: {{ required "referenceGrant.from.kind is required" .kind | quote }} + namespace: {{ .namespace | default $.Release.Namespace | quote }} + {{- with .name }} + name: {{ . | quote }} + {{- end }} + {{- end }} + {{- else }} + - group: gateway.networking.k8s.io + kind: HTTPRoute + namespace: {{ .Release.Namespace | quote }} + {{- end }} + to: + {{- if $referenceGrant.to }} + {{- range $referenceGrant.to }} + - group: {{ .group | default "" | quote }} + kind: {{ required "referenceGrant.to.kind is required" .kind | quote }} + {{- with .name }} + name: {{ . | quote }} + {{- end }} + {{- end }} + {{- else }} + - group: "" + kind: Service + {{- end }} +{{- end }} +{{- end -}} diff --git a/parcellab/common/templates/_routing.tpl b/parcellab/common/templates/_routing.tpl new file mode 100644 index 0000000..b89cc80 --- /dev/null +++ b/parcellab/common/templates/_routing.tpl @@ -0,0 +1,12 @@ +{{- define "common.routing" -}} +{{- $envoy := .Values.envoy | default dict -}} +{{- $httproute := $envoy.httpRoute | default dict -}} +{{- $ingress := .Values.ingress | default dict -}} + +{{- if $httproute.enabled }} + {{- include "common.httproute" . }} +{{- else if $ingress.enabled }} + {{- include "common.ingress" . }} +{{- end }} + +{{- end -}} diff --git a/parcellab/common/values.yaml b/parcellab/common/values.yaml index 5940732..e5382ea 100644 --- a/parcellab/common/values.yaml +++ b/parcellab/common/values.yaml @@ -23,6 +23,40 @@ image: tag: stable ingress: enabled: false + +## +## Envoy Gateway Resources +## + +# Configure Envoy Gateway resources under a single parent: +# +# envoy: +# httpRoute: {...} +# referenceGrant: {...} + +envoy: + httpRoute: + enabled: false + # parentGateway: gateway-api + # parentGatewayNamespace: envoy-gateway + # hosts: + # - myapp.gateway.test.parcellab.dev + # path: / + + referenceGrant: + enabled: false + # name: custom-grant # Optional: custom name + # namespace: envoy-gateway # Optional: where to create the grant (default: current namespace) + # from: # Optional: specify what can reference (default: HTTPRoute from current namespace) + # - group: gateway.networking.k8s.io + # kind: HTTPRoute + # namespace: myapp + # to: # Optional: specify what can be referenced (default: Service) + # - group: "" + # kind: Service + # - group: "" + # kind: Secret + name: common terminationGracePeriodSeconds: 30 nodeSelector: {} diff --git a/parcellab/cronjob/Chart.yaml b/parcellab/cronjob/Chart.yaml index 7eff6a0..3ba4d4c 100644 --- a/parcellab/cronjob/Chart.yaml +++ b/parcellab/cronjob/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: cronjob description: Single cron job -version: 0.4.1 +version: 0.4.2 dependencies: - name: common version: "*" diff --git a/parcellab/microservice/Chart.yaml b/parcellab/microservice/Chart.yaml index 9da39b9..dfd2797 100644 --- a/parcellab/microservice/Chart.yaml +++ b/parcellab/microservice/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: microservice description: Simple microservice -version: 0.4.2 +version: 0.5.0 dependencies: - name: common version: "*" diff --git a/parcellab/microservice/README.md b/parcellab/microservice/README.md index 5e268d3..a53956d 100644 --- a/parcellab/microservice/README.md +++ b/parcellab/microservice/README.md @@ -31,6 +31,8 @@ needs. Its generated secret's data values will be loaded as environment variables to the target pod. - `hpa` - Horizontal automatic scaling rules of pods. Can be defined with the `autoscaling` setting. +- `envoy` + - Envoy Gateway resources (HTTPRoute, ReferenceGrant). Defined under `envoy.*`. - `ingress` - Rules to open external access to the workload. Can be defined with `ingress`. - `poddisruptionbudget` diff --git a/parcellab/microservice/templates/httproute.yaml b/parcellab/microservice/templates/httproute.yaml new file mode 100644 index 0000000..56066a7 --- /dev/null +++ b/parcellab/microservice/templates/httproute.yaml @@ -0,0 +1 @@ +{{- include "common.httproute" . }} diff --git a/parcellab/microservice/templates/referencegrant.yaml b/parcellab/microservice/templates/referencegrant.yaml new file mode 100644 index 0000000..d64fae3 --- /dev/null +++ b/parcellab/microservice/templates/referencegrant.yaml @@ -0,0 +1 @@ +{{- include "common.referencegrant" . }} diff --git a/parcellab/microservice/values.yaml b/parcellab/microservice/values.yaml index befc739..6127232 100644 --- a/parcellab/microservice/values.yaml +++ b/parcellab/microservice/values.yaml @@ -46,6 +46,33 @@ ingress: # hosts: # - chart-example.local +## +## Envoy Gateway Resources +## + +envoy: + httpRoute: + enabled: false + # parentGateway: gateway-api + # parentGatewayNamespace: envoy-gateway + # hosts: + # - myapp.gateway.test.parcellab.dev + # path: / + + referenceGrant: + enabled: false + # name: custom-grant # Optional: custom name + # namespace: envoy-gateway # Optional: where to create the grant (default: current namespace) + # from: # Optional: specify what can reference (default: HTTPRoute from current namespace) + # - group: gateway.networking.k8s.io + # kind: HTTPRoute + # namespace: myapp + # to: # Optional: specify what can be referenced (default: Service) + # - group: "" + # kind: Service + # - group: "" + # kind: Secret + ## ## Cronjob ## diff --git a/parcellab/monolith/Chart.yaml b/parcellab/monolith/Chart.yaml index 5eb84d1..1de13c6 100644 --- a/parcellab/monolith/Chart.yaml +++ b/parcellab/monolith/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: monolith description: Application that may define multiple services and cronjobs -version: 0.4.1 +version: 0.5.0 dependencies: - name: common version: "*" diff --git a/parcellab/monolith/README.md b/parcellab/monolith/README.md index 678dee3..f9e2713 100644 --- a/parcellab/monolith/README.md +++ b/parcellab/monolith/README.md @@ -31,6 +31,8 @@ needs. Its generated secret's data values will be loaded as environment variables to the target pod. - `hpa` - Horizontal automatic scaling rules of pods. Can be defined with the `autoscaling` setting. +- `envoy` + - Envoy Gateway resources (HTTPRoute, ReferenceGrant). Defined under `envoy.*`. - `ingress` - Rules to open external access to the workload. Can be defined with `ingress`. - `poddisruptionbudget` diff --git a/parcellab/monolith/templates/httproute.yaml b/parcellab/monolith/templates/httproute.yaml new file mode 100644 index 0000000..56066a7 --- /dev/null +++ b/parcellab/monolith/templates/httproute.yaml @@ -0,0 +1 @@ +{{- include "common.httproute" . }} diff --git a/parcellab/monolith/templates/referencegrant.yaml b/parcellab/monolith/templates/referencegrant.yaml new file mode 100644 index 0000000..d64fae3 --- /dev/null +++ b/parcellab/monolith/templates/referencegrant.yaml @@ -0,0 +1 @@ +{{- include "common.referencegrant" . }} diff --git a/parcellab/monolith/values.yaml b/parcellab/monolith/values.yaml index d51738e..253c8d3 100644 --- a/parcellab/monolith/values.yaml +++ b/parcellab/monolith/values.yaml @@ -75,6 +75,33 @@ ingress: # hosts: # - chart-example.local +## +## Envoy Gateway Resources +## + +envoy: + httpRoute: + enabled: false + # parentGateway: gateway-api + # parentGatewayNamespace: envoy-gateway + # hosts: + # - myapp.gateway.test.parcellab.dev + # path: / + + referenceGrant: + enabled: false + # name: custom-grant # Optional: custom name + # namespace: envoy-gateway # Optional: where to create the grant (default: current namespace) + # from: # Optional: specify what can reference (default: HTTPRoute from current namespace) + # - group: gateway.networking.k8s.io + # kind: HTTPRoute + # namespace: myapp + # to: # Optional: specify what can be referenced (default: Service) + # - group: "" + # kind: Service + # - group: "" + # kind: Secret + ## ## Cronjob ## diff --git a/parcellab/worker-group/Chart.yaml b/parcellab/worker-group/Chart.yaml index 533d6ed..da9c592 100644 --- a/parcellab/worker-group/Chart.yaml +++ b/parcellab/worker-group/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: worker-group description: Set of workers that do not expose a service -version: 0.3.1 +version: 0.3.2 dependencies: - name: common version: "*"