Service configuration moved to component

This commit is contained in:
Guillaume C committed 2026-11-17 15:12:09 +01:00
1 parent 4ab8a54bae
commit 9b7123af16
41 files changed
+555 -202

No files matched your search

+1 -1
View File
@@ -204,7 +204,7 @@ We are not going to expose every single application configuration option.
The chart changelog is built using `towncrier`. Every PR requires a newsfragment created using : `towncrier create`. The fragment number should match the PR number.
Each newsfragment accepts on type of ArtifactHub kind changes : `added`, `changed`, `removed`, `fixed`, `security`. The `internal` type
Each newsfragment accepts on type of ArtifactHub kind changes : `added`, `changed`, `deprecated`, `removed`, `fixed`, `security`. The `internal` type
is accepted but will not be shown in ArtifactHub.
The changelog is built on release time using `towncrier build` in the chart directory. The changelog is also injected into the `Chart.yaml` under the annotation `artifacthub.io/changes`.
@@ -23,41 +23,7 @@
]
},
"service": {
"type": "object",
"required": [
"type",
"internalTrafficPolicy"
],
"properties": {
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"type": {
"type": "string",
"enum": [
"ClusterIP",
"NodePort",
"LoadBalancer"
]
},
"internalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
}
}
"$ref": "file://common/service.json"
}
}
}
@@ -34,6 +34,7 @@ certManager: {}
# serverName: ess.localhost
{{ labels(global=true) }}
{{ ingress(global=true) }}
{{ httpService(global=true) }}
## Common image properties that are applied as defaults to all components.
image:
@@ -206,6 +207,34 @@ extraObjects: {}
pullSecrets: []
{%- endmacro %}
{% macro httpService(global=false, key='httpService') %}
{%- if global %}
## Default configuration of the Service handling inbound HTTP(S) traffic.
## `<component>.httpService` takes precedence, then `<component>.ingress.service`, then `ingress.service`.
{{ key }}:
type: ClusterIP
## Annotations to be added to all component Services. Will be merged with more specific Service annotations
annotations: {}
# External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
# External IPs addresses of this service.
# externalIPs: []
{%- else %}
## Configuration of the Service handling inbound HTTP(S) traffic for this component.
## Takes precedence over `ingress.service` and the global `httpService`. Leave empty to inherit `httpService`.
# {{ key }}:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
{{ key }}: {}
{%- endif %}
{%- endmacro %}
{% macro ingress(global=false, key='ingress') %}
{%- if global %}
## How all ingresses should be constructed by default, unless overridden
@@ -229,16 +258,8 @@ extraObjects: {}
## The name of the Secret containing the TLS certificate and the key that should be used for {{ 'all Ingresses by default' if global else 'this Ingress' }}
# tlsSecret:
## How the {{ 'Services' if global else 'Service' }} behind {{ 'all Ingresses' if global else 'this Ingress' }} is constructed{{ ' by default' if global else '' }}
{%- if global %}
service:
type: ClusterIP
## Annotations to be added to {{ 'all Ingresses services. Will be merged with component specific Ingress services annotations' if global else 'this Ingress' }}
annotations: {}
# External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
{%- else %}
## Optional Service override for {{ 'all Ingresses' if global else 'this Ingress' }}.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
@@ -248,7 +269,6 @@ extraObjects: {}
# # External IPs addresses of this service.
# externalIPs: []
service: {}
{%- endif %}
## If set, some tweaks will be applied automatically to ingresses based on the controller type here.
## This can be set to `ingress-nginx`.
# controllerType:
@@ -16,6 +16,9 @@
"inboundTrafficHandler": {
"$ref": "file://common/inboundTrafficHandler.json"
},
"httpService": {
"$ref": "file://common/service.json"
},
"ingress": {
"$ref": "file://common/ingress.json"
},
@@ -13,6 +13,7 @@ enabled: true
# Number of Element Admin replicas to start up
replicas: 1
{{- sub_schema_values.image(registry='oci.element.io', repository='element-admin', tag='0.1.18') -}}
{{- sub_schema_values.httpService() -}}
{{- sub_schema_values.ingress() -}}
{{- sub_schema_values.labels() -}}
{{- sub_schema_values.workloadAnnotations() -}}
@@ -31,6 +31,9 @@
"inboundTrafficHandler": {
"$ref": "file://common/inboundTrafficHandler.json"
},
"httpService": {
"$ref": "file://common/service.json"
},
"ingress": {
"$ref": "file://common/ingress.json"
},
@@ -21,6 +21,7 @@ additional: {}
# Number of Element Web replicas to start up
replicas: 1
{{- sub_schema_values.image(registry='oci.element.io', repository='element-web', tag='v1.12.34') -}}
{{- sub_schema_values.httpService() -}}
{{- sub_schema_values.ingress() -}}
{{- sub_schema_values.labels() -}}
{{- sub_schema_values.workloadAnnotations() -}}
+3
View File
@@ -59,6 +59,9 @@
"inboundTrafficHandler": {
"$ref": "file://common/inboundTrafficHandler.json"
},
"httpService": {
"$ref": "file://common/service.json"
},
"ingress": {
"$ref": "file://common/ingress.json"
},
@@ -26,6 +26,7 @@ replicas: 1
{{ sub_schema_values.credential("Hookshot registration file to connect to a remote Synapse instance", "appserviceRegistration", initIfAbsent=True) }}
{{ sub_schema_values.credential("Hookshot passkey used to encrypt stored tokens", "passkey", initIfAbsent=True) }}
{{ sub_schema_values.redisOrValkey() }}
{{ sub_schema_values.httpService() }}
{{ sub_schema_values.ingress() }}
## Additional configuration to provide to Hookshot.
@@ -61,6 +61,9 @@
"inboundTrafficHandler": {
"$ref": "file://common/inboundTrafficHandler.json"
},
"httpService": {
"$ref": "file://common/service.json"
},
"ingress": {
"$ref": "file://common/ingress.json"
},
@@ -34,6 +34,7 @@ user:
# Use 0 replicas to stop the MatrixRTC authoriser
replicas: 1
{{- sub_schema_values.httpService() }}
{{- sub_schema_values.ingress() }}
{{- sub_schema_values.image(registry='oci.element.io', repository='lk-jwt-service', tag='0.10.0') }}
{{- sub_schema_values.labels() }}
@@ -124,6 +124,9 @@
"inboundTrafficHandler": {
"$ref": "file://common/inboundTrafficHandler.json"
},
"httpService": {
"$ref": "file://common/service.json"
},
"ingress": {
"$ref": "file://common/ingress.json"
},
@@ -26,6 +26,7 @@ privateKeys: {}
{{ sub_schema_values.credential("ECDSA Secp256k1 Private Key", "ecdsaSecp256k1") | indent(2) }}
{{ sub_schema_values.credential("ECDSA Secp384r1 Private Key", "ecdsaSecp384r1") | indent(2) }}
{{ sub_schema_values.httpService() }}
{{ sub_schema_values.ingress() }}
{{ sub_schema_values.resources(requests_memory='50Mi', requests_cpu='50m', limits_memory='350Mi') }}
{{ sub_schema_values.labels() }}
+3
View File
@@ -155,6 +155,9 @@
"inboundTrafficHandler": {
"$ref": "file://common/inboundTrafficHandler.json"
},
"httpService": {
"$ref": "file://common/service.json"
},
"ingress": {
"$ref": "file://synapse/ingress_with_additional_paths.json"
},
@@ -96,6 +96,7 @@ replicas: 1
{{- sub_schema_values.extraVolumes("Synapse", with_context=true) }}
{{- sub_schema_values.extraVolumeMounts("Synapse", with_context=true) }}
{{- sub_schema_values.extraInitContainers("Synapse") }}
{{- sub_schema_values.httpService() }}
{{- sub_schema_values.ingress() }}
{{- sub_schema_values.labels() }}
{{- sub_schema_values.workloadAnnotations() }}
@@ -101,6 +101,49 @@
"ingress": {
"$ref": "file://common/ingress_global.json"
},
"httpService": {
"type": "object",
"required": [
"type",
"internalTrafficPolicy"
],
"properties": {
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"type": {
"type": "string",
"enum": [
"ClusterIP",
"NodePort",
"LoadBalancer"
]
},
"internalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalIPs": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"storage": {
"$ref": "file://common/storage_global.json"
},
@@ -9,6 +9,9 @@
"inboundTrafficHandler": {
"$ref": "file://common/inboundTrafficHandler.json"
},
"httpService": {
"$ref": "file://common/service.json"
},
"ingress": {
"$ref": "file://common/ingress_without_host.json"
},
@@ -9,6 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
enabled: true
{{ sub_schema_values.labels() }}
{{ sub_schema_values.httpService() }}
{{ sub_schema_values.ingress() }}
## If ElementWeb is deployed, the base domain will redirect to it's ingress host by default
@@ -9,13 +9,13 @@ SPDX-License-Identifier: AGPL-3.0-only
apiVersion: v1
kind: Service
metadata:
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" .) | nindent 2 }}
labels:
{{- include "element-io.element-admin.labels" (dict "root" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-element-admin
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.ingress-service.spec" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.spec" (dict "root" $ "context" .) | nindent 2 }}
ports:
- port: 8080
targetPort: http
@@ -9,13 +9,13 @@ SPDX-License-Identifier: AGPL-3.0-only
apiVersion: v1
kind: Service
metadata:
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" .) | nindent 2 }}
labels:
{{- include "element-io.element-web.labels" (dict "root" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-element-web
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.ingress-service.spec" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.spec" (dict "root" $ "context" .) | nindent 2 }}
ports:
- port: 80
targetPort: element
@@ -31,45 +31,6 @@ annotations:
{{- end -}}
{{- end -}}
{{- define "element-io.ess-library.ingress-service.annotations" -}}
{{- $root := .root -}}
{{- with required "element-io.ess-library.ingress-service.annotations missing context" .context -}}
{{- $ingressService := .service -}}
{{- $annotations := .extraAnnotations | default dict -}}
{{- $annotations = mustMergeOverwrite $annotations ($root.Values.ingress.service.annotations | deepCopy) -}}
{{- if $ingressService.annotations }}
{{- $annotations = mustMergeOverwrite $annotations ($ingressService.annotations | deepCopy) -}}
{{- end -}}
{{- with $annotations -}}
annotations:
{{- toYaml . | nindent 2 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "element-io.ess-library.ingress-service.spec" -}}
{{- $root := .root -}}
{{- with required "element-io.ess-library.ingress-service.spec missing context" .context -}}
{{- $headlessService := .headlessService | default false -}}
{{- $ingressService := .service -}}
{{ with $ingressService.type | default $root.Values.ingress.service.type }}
type: {{ . }}
{{ if and $headlessService (eq . "ClusterIP") }}
clusterIP: None
{{- end }}
{{- if (list "LoadBalancer" "NodePort") | has . }}
externalTrafficPolicy: {{ $ingressService.externalTrafficPolicy | default $root.Values.ingress.service.externalTrafficPolicy }}
{{- end }}
{{- end }}
{{- if hasKey $ingressService "externalIPs" }}
externalIPs: {{ $ingressService.externalIPs | toYaml | nindent 4 }}
{{- end }}
internalTrafficPolicy: {{ $ingressService.internalTrafficPolicy | default $root.Values.ingress.service.internalTrafficPolicy }}
ipFamilyPolicy: PreferDualStack
{{- end }}
{{- end }}
{{- define "element-io.ess-library.ingress.tls" -}}
{{- $root := .root -}}
{{- with required "element-io.ess-library.ingress.tls missing context" .context -}}
@@ -4,7 +4,7 @@ Copyright 2026 Element Creations Ltd
SPDX-License-Identifier: AGPL-3.0-only
*/ -}}
{{- define "element-io.ess-library.service.spec" -}}
{{- define "element-io.ess-library.exposed-service.spec" -}}
{{- $root := .root -}}
{{- $exposedService := .exposedService -}}
type: {{ $exposedService.portType }}
@@ -21,3 +21,70 @@ internalTrafficPolicy: {{ $exposedService.internalTrafficPolicy }}
externalTrafficPolicy: {{ $exposedService.externalTrafficPolicy }}
{{- end }}
{{- end -}}
{{- define "element-io.ess-library.http-service.spec" -}}
{{- $root := .root -}}
{{- $context := required "element-io.ess-library.http-service.spec missing context" .context -}}
{{- $httpService := $context.httpService | default dict -}}
{{- $legacyService := dict -}}
{{- if $context.ingress -}}
{{- $legacyService = $context.ingress.service | default dict -}}
{{- end -}}
{{- $globalIngressService := $root.Values.ingress.service | default dict -}}
{{- $globalHttpService := $root.Values.httpService | default dict -}}
{{- $type := coalesce $httpService.type $legacyService.type $globalIngressService.type $globalHttpService.type -}}
{{- $internalTrafficPolicy := coalesce $httpService.internalTrafficPolicy $legacyService.internalTrafficPolicy $globalIngressService.internalTrafficPolicy $globalHttpService.internalTrafficPolicy -}}
{{- $externalTrafficPolicy := "" -}}
{{- $emitExternalTrafficPolicy := false -}}
{{- $externalIPs := list -}}
{{- $emitExternalIPs := false -}}
{{- $clusterIP := "" -}}
{{- if and ($context.headlessService | default false) (eq $type "ClusterIP") -}}
{{- $clusterIP = "None" -}}
{{- end -}}
{{- if list "LoadBalancer" "NodePort" | has $type -}}
{{- $externalTrafficPolicy = coalesce $httpService.externalTrafficPolicy $legacyService.externalTrafficPolicy $globalIngressService.externalTrafficPolicy $globalHttpService.externalTrafficPolicy -}}
{{- $emitExternalTrafficPolicy = true -}}
{{- end -}}
{{- range $source := list $globalHttpService $globalIngressService $legacyService $httpService -}}
{{- if hasKey $source "externalIPs" -}}
{{- $externalIPs = $source.externalIPs -}}
{{- $emitExternalIPs = true -}}
{{- end -}}
{{- end -}}
type: {{ $type }}
{{- if $clusterIP }}
clusterIP: {{ $clusterIP }}
{{- end }}
{{- if $emitExternalTrafficPolicy }}
externalTrafficPolicy: {{ $externalTrafficPolicy }}
{{- end }}
{{- if $emitExternalIPs }}
externalIPs: {{ $externalIPs | toYaml | nindent 2 }}
{{- end }}
ipFamilyPolicy: PreferDualStack
internalTrafficPolicy: {{ $internalTrafficPolicy }}
{{- end -}}
{{- define "element-io.ess-library.http-service.annotations" -}}
{{- $root := .root -}}
{{- with required "element-io.ess-library.http-service.annotations missing context" .context -}}
{{- $httpService := .httpService | default dict -}}
{{- $legacyService := dict -}}
{{- with .ingress -}}
{{- $legacyService = .service | default dict -}}
{{- end -}}
{{- $globalIngressService := $root.Values.ingress.service | default dict -}}
{{- $globalHttpService := $root.Values.httpService | default dict -}}
{{- $annotations := .extraAnnotations | default dict -}}
{{- range $source := list $globalHttpService $globalIngressService $legacyService $httpService -}}
{{- with $source.annotations -}}
{{- $annotations = mustMergeOverwrite $annotations (. | deepCopy) -}}
{{- end -}}
{{- end -}}
{{- with $annotations -}}
annotations:
{{- toYaml . | nindent 2 }}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -12,7 +12,7 @@ kind: Service
metadata:
name: {{ $.Release.Name }}-hookshot-appservice
namespace: {{ $.Release.Namespace }}
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" .) | nindent 2 }}
labels:
{{- include "element-io.hookshot.labels" (dict "root" $ "context" (set (. | deepCopy) "appservice" true)) | nindent 4 }}
spec:
@@ -12,11 +12,11 @@ kind: Service
metadata:
name: {{ $.Release.Name }}-hookshot
namespace: {{ $.Release.Namespace }}
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" .) | nindent 2 }}
labels:
{{- include "element-io.hookshot.labels" (dict "root" $ "context" .) | nindent 4 }}
spec:
{{- include "element-io.ess-library.ingress-service.spec" (dict "root" $ "context" (mustMergeOverwrite (dict "headlessService" true) .ingress)) | nindent 2 }}
{{- include "element-io.ess-library.http-service.spec" (dict "root" $ "context" (dict "headlessService" true "httpService" (.httpService | default dict) "ingress" (.ingress | default dict))) | nindent 2 }}
ports:
- port: 7775
name: webhooks
@@ -12,11 +12,11 @@ kind: Service
metadata:
name: {{ $.Release.Name }}-matrix-authentication-service
namespace: {{ $.Release.Namespace }}
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" .) | nindent 2 }}
labels:
{{- include "element-io.matrix-authentication-service.labels" (dict "root" $ "context" .) | nindent 4 }}
spec:
{{- include "element-io.ess-library.ingress-service.spec" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.spec" (dict "root" $ "context" .) | nindent 2 }}
ports:
- port: 8080
protocol: TCP
@@ -10,13 +10,13 @@ SPDX-License-Identifier: AGPL-3.0-only
apiVersion: v1
kind: Service
metadata:
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" .) | nindent 2 }}
labels:
{{- include "element-io.matrix-rtc-authorisation.labels" (dict "root" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-matrix-rtc-authorisation
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.ingress-service.spec" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.spec" (dict "root" $ "context" .) | nindent 2 }}
ports:
- name: http
port: 8080
@@ -21,7 +21,7 @@ metadata:
name: {{ $.Release.Name }}-matrix-rtc-sfu-tcp
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.service.spec" (dict "root" $ "exposedService" .exposedServices.rtcTcp) | nindent 2 }}
{{- include "element-io.ess-library.exposed-service.spec" (dict "root" $ "exposedService" .exposedServices.rtcTcp) | nindent 2 }}
ports:
- name: "rtc-tcp"
protocol: "TCP"
@@ -21,7 +21,7 @@ metadata:
name: {{ $.Release.Name }}-matrix-rtc-sfu-muxed-udp
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.service.spec" (dict "root" $ "exposedService" .exposedServices.rtcMuxedUdp) | nindent 2 }}
{{- include "element-io.ess-library.exposed-service.spec" (dict "root" $ "exposedService" .exposedServices.rtcMuxedUdp) | nindent 2 }}
ports:
- name: "rtc-muxed-udp"
protocol: "UDP"
@@ -27,7 +27,7 @@ metadata:
name: {{ $.Release.Name }}-matrix-rtc-sfu-udp-range-{{ $port_segment }}
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.service.spec" (dict "root" $ "exposedService" $.Values.matrixRTC.sfu.exposedServices.rtcUdp) | nindent 2 }}
{{- include "element-io.ess-library.exposed-service.spec" (dict "root" $ "exposedService" $.Values.matrixRTC.sfu.exposedServices.rtcUdp) | nindent 2 }}
ports:
{{- $segment_start := ((add $range_start (mul 250 $port_segment)) | int) }}
{{- $segment_end := ((min (add $range_end 1) (add $segment_start 250)) | int) }}
@@ -12,13 +12,13 @@ SPDX-License-Identifier: AGPL-3.0-only
apiVersion: v1
kind: Service
metadata:
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" $.Values.matrixRTC.ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" $.Values.matrixRTC) | nindent 2 }}
labels:
{{- include "element-io.matrix-rtc-sfu.labels" (dict "root" $ "context" .) | nindent 4 }}
name: {{ $.Release.Name }}-matrix-rtc-sfu
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.ingress-service.spec" (dict "root" $ "context" $.Values.matrixRTC.ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.spec" (dict "root" $ "context" $.Values.matrixRTC) | nindent 2 }}
ports:
- name: http
port: 7880
@@ -21,7 +21,7 @@ metadata:
name: {{ $.Release.Name }}-matrix-rtc-sfu-turn
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.service.spec" (dict "root" $ "exposedService" .exposedServices.turn) | nindent 2 }}
{{- include "element-io.ess-library.exposed-service.spec" (dict "root" $ "exposedService" .exposedServices.turn) | nindent 2 }}
ports:
- name: "turn-udp"
protocol: "UDP"
@@ -21,7 +21,7 @@ metadata:
name: {{ $.Release.Name }}-matrix-rtc-sfu-turn-tls
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.service.spec" (dict "root" $ "exposedService" .exposedServices.turnTLS) | nindent 2 }}
{{- include "element-io.ess-library.exposed-service.spec" (dict "root" $ "exposedService" .exposedServices.turnTLS) | nindent 2 }}
ports:
- name: "turn-tls-tcp"
protocol: "TCP"
@@ -10,13 +10,13 @@ SPDX-License-Identifier: AGPL-3.0-only
apiVersion: v1
kind: Service
metadata:
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" .) | nindent 2 }}
labels:
{{- include "element-io.synapse-ingress.labels" (dict "root" $ "context" $.Values.haproxy) | nindent 4 }}
name: {{ $.Release.Name }}-synapse
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.ingress-service.spec" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.spec" (dict "root" $ "context" .) | nindent 2 }}
ports:
- name: haproxy-synapse
port: 8008
@@ -10,13 +10,13 @@ SPDX-License-Identifier: AGPL-3.0-only
apiVersion: v1
kind: Service
metadata:
{{- include "element-io.ess-library.ingress-service.annotations" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.annotations" (dict "root" $ "context" .) | nindent 2 }}
labels:
{{- include "element-io.well-known-delegation-ingress.labels" (dict "root" $ "context" $.Values.haproxy) | nindent 4 }}
name: {{ $.Release.Name }}-well-known
namespace: {{ $.Release.Namespace }}
spec:
{{- include "element-io.ess-library.ingress-service.spec" (dict "root" $ "context" .ingress) | nindent 2 }}
{{- include "element-io.ess-library.http-service.spec" (dict "root" $ "context" .) | nindent 2 }}
ports:
- name: haproxy-wkd
port: 8010
@@ -29,6 +29,18 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ $deprecations = append $deprecations "matrixRTC.restrictRoomCreationToLocalUsers will be removed when MatrixRTC authoriser removes the legacy endpoints." -}}
{{- end }}
{{- with $root.Values.ingress.service }}
{{ $deprecations = append $deprecations "ingress.service is deprecated in favour of httpService. All user values should be moved to httpService" -}}
{{- end }}
{{- range $componentName := list "elementAdmin" "elementWeb" "hookshot" "matrixAuthenticationService" "matrixRTC" "synapse" "wellKnownDelegation" }}
{{- with (index $root.Values $componentName).ingress }}
{{- with .service }}
{{ $deprecations = append $deprecations (printf "%s.ingress.service is deprecated in favour of %s.httpService. All user values should be moved across" $componentName $componentName) -}}
{{- end }}
{{- end }}
{{- end }}
{{- if gt (len $deprecations) 0 }}
DEPRECATIONS. Please read me and update
{{- printf "\n- %s" ($deprecations | join "\n- " ) }}
+108 -78
View File
@@ -107,6 +107,50 @@
"ingress": {
"$ref": "#/$defs/common_ingress_global"
},
"httpService": {
"type": "object",
"required": [
"type",
"internalTrafficPolicy"
],
"properties": {
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"type": {
"type": "string",
"enum": [
"ClusterIP",
"NodePort",
"LoadBalancer"
]
},
"internalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalIPs": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"storage": {
"$ref": "#/$defs/common_storage_global"
},
@@ -379,42 +423,50 @@
]
},
"service": {
"$ref": "#/$defs/common_service"
}
},
"additionalProperties": false
},
"common_service": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"ClusterIP",
"NodePort",
"LoadBalancer"
]
},
"annotations": {
"type": "object",
"required": [
"type",
"internalTrafficPolicy"
],
"properties": {
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"type": {
"type": "string",
"enum": [
"ClusterIP",
"NodePort",
"LoadBalancer"
]
},
"internalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
}
},
"additionalProperties": false
"additionalProperties": {
"type": [
"string",
"null"
]
}
},
"internalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalIPs": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
@@ -1231,6 +1283,9 @@
"inboundTrafficHandler": {
"$ref": "#/$defs/common_inboundTrafficHandler"
},
"httpService": {
"$ref": "#/$defs/common_service"
},
"ingress": {
"$ref": "#/$defs/common_ingress"
},
@@ -1589,49 +1644,6 @@
},
"additionalProperties": false
},
"common_service": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"ClusterIP",
"NodePort",
"LoadBalancer"
]
},
"annotations": {
"type": "object",
"additionalProperties": {
"type": [
"string",
"null"
]
}
},
"internalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalTrafficPolicy": {
"type": "string",
"enum": [
"Cluster",
"Local"
]
},
"externalIPs": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"common_hostAliases": {
"type": "array",
"items": {
@@ -2183,6 +2195,9 @@
"inboundTrafficHandler": {
"$ref": "#/$defs/common_inboundTrafficHandler"
},
"httpService": {
"$ref": "#/$defs/common_service"
},
"ingress": {
"$ref": "#/$defs/common_ingress"
},
@@ -2296,6 +2311,9 @@
"inboundTrafficHandler": {
"$ref": "#/$defs/common_inboundTrafficHandler"
},
"httpService": {
"$ref": "#/$defs/common_service"
},
"ingress": {
"$ref": "#/$defs/common_ingress"
},
@@ -2514,6 +2532,9 @@
"inboundTrafficHandler": {
"$ref": "#/$defs/common_inboundTrafficHandler"
},
"httpService": {
"$ref": "#/$defs/common_service"
},
"ingress": {
"$ref": "#/$defs/common_ingress"
},
@@ -2762,6 +2783,9 @@
"inboundTrafficHandler": {
"$ref": "#/$defs/common_inboundTrafficHandler"
},
"httpService": {
"$ref": "#/$defs/common_service"
},
"ingress": {
"$ref": "#/$defs/common_ingress"
},
@@ -3444,6 +3468,9 @@
"inboundTrafficHandler": {
"$ref": "#/$defs/common_inboundTrafficHandler"
},
"httpService": {
"$ref": "#/$defs/common_service"
},
"ingress": {
"$ref": "#/$defs/synapse_ingress_with_additional_paths"
},
@@ -3863,6 +3890,9 @@
"inboundTrafficHandler": {
"$ref": "#/$defs/common_inboundTrafficHandler"
},
"httpService": {
"$ref": "#/$defs/common_service"
},
"ingress": {
"$ref": "#/$defs/common_ingress_without_host"
},
+117 -15
View File
@@ -107,18 +107,33 @@ ingress:
## The name of the Secret containing the TLS certificate and the key that should be used for all Ingresses by default
# tlsSecret:
## How the Services behind all Ingresses is constructed by default
service:
type: ClusterIP
## Annotations to be added to all Ingresses services. Will be merged with component specific Ingress services annotations
annotations: {}
# External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
## Optional Service override for all Ingresses.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
service: {}
## If set, some tweaks will be applied automatically to ingresses based on the controller type here.
## This can be set to `ingress-nginx`.
# controllerType:
## Default configuration of the Service handling inbound HTTP(S) traffic.
## `<component>.httpService` takes precedence, then `<component>.ingress.service`, then `ingress.service`.
httpService:
type: ClusterIP
## Annotations to be added to all component Services. Will be merged with more specific Service annotations
annotations: {}
# External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
# External IPs addresses of this service.
# externalIPs: []
## Common image properties that are applied as defaults to all components.
image:
## The pullPolicy to use for all images. This overrides the pullPolicy used by the templates
@@ -725,6 +740,17 @@ matrixRTC:
# Use 0 replicas to stop the MatrixRTC authoriser
replicas: 1
## Configuration of the Service handling inbound HTTP(S) traffic for this component.
## Takes precedence over `ingress.service` and the global `httpService`. Leave empty to inherit `httpService`.
# httpService:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
httpService: {}
## How this ingress should be constructed
ingress:
## What hostname should be used for this Ingress
@@ -742,7 +768,8 @@ matrixRTC:
## The name of the Secret containing the TLS certificate and the key that should be used for this Ingress
# tlsSecret:
## How the Service behind this Ingress is constructed
## Optional Service override for this Ingress.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
@@ -1570,6 +1597,17 @@ elementAdmin:
## pullSecrets:
## - name: dockerhub
pullSecrets: []
## Configuration of the Service handling inbound HTTP(S) traffic for this component.
## Takes precedence over `ingress.service` and the global `httpService`. Leave empty to inherit `httpService`.
# httpService:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
httpService: {}
## How this ingress should be constructed
ingress:
## What hostname should be used for this Ingress
@@ -1587,7 +1625,8 @@ elementAdmin:
## The name of the Secret containing the TLS certificate and the key that should be used for this Ingress
# tlsSecret:
## How the Service behind this Ingress is constructed
## Optional Service override for this Ingress.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
@@ -1879,6 +1918,17 @@ elementWeb:
## pullSecrets:
## - name: dockerhub
pullSecrets: []
## Configuration of the Service handling inbound HTTP(S) traffic for this component.
## Takes precedence over `ingress.service` and the global `httpService`. Leave empty to inherit `httpService`.
# httpService:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
httpService: {}
## How this ingress should be constructed
ingress:
## What hostname should be used for this Ingress
@@ -1896,7 +1946,8 @@ elementWeb:
## The name of the Secret containing the TLS certificate and the key that should be used for this Ingress
# tlsSecret:
## How the Service behind this Ingress is constructed
## Optional Service override for this Ingress.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
@@ -2526,6 +2577,18 @@ hookshot:
## Enable TLS for Redis/Valkey connection
# tls: false
## Configuration of the Service handling inbound HTTP(S) traffic for this component.
## Takes precedence over `ingress.service` and the global `httpService`. Leave empty to inherit `httpService`.
# httpService:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
httpService: {}
## How this ingress should be constructed
ingress:
## What hostname should be used for this Ingress
@@ -2543,7 +2606,8 @@ hookshot:
## The name of the Secret containing the TLS certificate and the key that should be used for this Ingress
# tlsSecret:
## How the Service behind this Ingress is constructed
## Optional Service override for this Ingress.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
@@ -3041,6 +3105,18 @@ matrixAuthenticationService:
# ecdsaSecp384r1: {}
## Configuration of the Service handling inbound HTTP(S) traffic for this component.
## Takes precedence over `ingress.service` and the global `httpService`. Leave empty to inherit `httpService`.
# httpService:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
httpService: {}
## How this ingress should be constructed
ingress:
## What hostname should be used for this Ingress
@@ -3058,7 +3134,8 @@ matrixAuthenticationService:
## The name of the Secret containing the TLS certificate and the key that should be used for this Ingress
# tlsSecret:
## How the Service behind this Ingress is constructed
## Optional Service override for this Ingress.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
@@ -6065,6 +6142,17 @@ synapse:
# Extra initContainers to add to Synapse, as a yaml array
extraInitContainers: []
## Configuration of the Service handling inbound HTTP(S) traffic for this component.
## Takes precedence over `ingress.service` and the global `httpService`. Leave empty to inherit `httpService`.
# httpService:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
httpService: {}
## How this ingress should be constructed
ingress:
## What hostname should be used for this Ingress
@@ -6082,7 +6170,8 @@ synapse:
## The name of the Secret containing the TLS certificate and the key that should be used for this Ingress
# tlsSecret:
## How the Service behind this Ingress is constructed
## Optional Service override for this Ingress.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
@@ -6363,6 +6452,18 @@ wellKnownDelegation:
## Labels to add to all manifest for this component
labels: {}
## Configuration of the Service handling inbound HTTP(S) traffic for this component.
## Takes precedence over `ingress.service` and the global `httpService`. Leave empty to inherit `httpService`.
# httpService:
# type: ClusterIP
# annotations: {}
# # External traffic policy will be configured on services of type `NodePort` and `LoadBalancer`
# externalTrafficPolicy: Cluster
# internalTrafficPolicy: Cluster
# # External IPs addresses of this service.
# externalIPs: []
httpService: {}
## How this ingress should be constructed
ingress:
## What hostname should be used for this Ingress
@@ -6380,7 +6481,8 @@ wellKnownDelegation:
## The name of the Secret containing the TLS certificate and the key that should be used for this Ingress
# tlsSecret:
## How the Service behind this Ingress is constructed
## Optional Service override for this Ingress.
## When a field is set, it overrides `httpService`. `<component>.httpService` takes precedence over this.
# service:
# type: ClusterIP
# annotations: {}
+3
View File
@@ -0,0 +1,3 @@
Component Services default to `httpService` and `<component>.httpService`. Precedence is `<component>.httpService`, then `<component>.ingress.service`, then `ingress.service`, then the global `httpService`.
Renamed template variable "element-io.ess-library.ingress-service.annotations" to "element-io.ess-library.http-service.annotations". Exposed Service specs render through "element-io.ess-library.exposed-service.spec". Component Service specs render through "element-io.ess-library.http-service.spec".
+1
View File
@@ -0,0 +1 @@
Deprecated `ingress.service` and `<component>.ingress.service` in favour of `httpService` and `<component>.httpService`.
+1
View File
@@ -35,6 +35,7 @@ class PropertyType(Enum):
PriorityClassName = "priorityClassName"
RuntimeClassName = "runtimeClassName"
SchedulerName = "schedulerName"
HttpService = "httpService"
Replicas = "replicas"
ReadinessProbe = "readinessProbe"
Resources = "resources"
+119
View File
@@ -210,3 +210,122 @@ async def test_ingress_services_local_service_properties(values, make_templates)
assert "clusterIP" not in found_service["spec"], (
f"{template_id(template)} has a clusterIP defined for a non-ClusterIP service"
)
@pytest.mark.parametrize("values_file", values_files_to_test)
@pytest.mark.asyncio_cooperative
async def test_component_http_service_overrides_ingress_service(values, make_templates):
values["httpService"] = {
"type": "NodePort",
"internalTrafficPolicy": "Cluster",
"externalTrafficPolicy": "Cluster",
"annotations": {
"lowest": "set",
"merged": "from_http_service",
},
}
values.setdefault("ingress", {}).setdefault("service", {})["type"] = "ClusterIP"
values.setdefault("ingress", {}).setdefault("service", {})["internalTrafficPolicy"] = "Cluster"
values.setdefault("ingress", {}).setdefault("service", {})["annotations"] = {
"global": "set",
"merged": "from_global",
}
def set_services(deployable_details: DeployableDetails):
deployable_details.set_helm_values(
values,
PropertyType.Ingress,
{
"service": {
"type": "NodePort",
"internalTrafficPolicy": "Local",
"annotations": {
"legacy": "set",
"merged": "from_ingress",
},
}
},
)
deployable_details.set_helm_values(
values,
PropertyType.HttpService,
{
"type": "LoadBalancer",
"externalTrafficPolicy": "Local",
"annotations": {
"component": "set",
"merged": "from_component",
"global": None,
},
},
)
iterate_deployables_ingress_parts(set_services)
templates = await make_templates(values)
services_by_name = dict[str, dict]()
for template in templates:
if template["kind"] == "Service":
services_by_name[template["metadata"]["name"]] = template
for ingress in templates:
if ingress["kind"] != "Ingress":
continue
for rule in ingress["spec"]["rules"]:
for path in rule["http"]["paths"]:
backend_service = path["backend"]["service"]
found_service = services_by_name[backend_service["name"]]
assert found_service["spec"].get("type") == "LoadBalancer", (
f"Service {backend_service['name']} is not a LoadBalancer despite setting .httpService.type"
)
assert found_service["spec"].get("internalTrafficPolicy") == "Local"
assert found_service["spec"].get("externalTrafficPolicy") == "Local"
annotations = found_service["metadata"]["annotations"]
assert annotations["component"] == "set"
assert annotations["legacy"] == "set"
assert annotations["lowest"] == "set"
assert annotations["merged"] == "from_component"
assert annotations["global"] is None
@pytest.mark.parametrize("values_file", values_files_to_test)
@pytest.mark.asyncio_cooperative
async def test_global_http_service_is_lowest_priority(values, make_templates):
ingress_service = values.setdefault("ingress", {}).setdefault("service", {})
ingress_service["type"] = "LoadBalancer"
ingress_service["internalTrafficPolicy"] = "Local"
ingress_service["annotations"] = {
"global": "set",
"merged": "from_ingress",
}
values["httpService"] = {
"type": "ClusterIP",
"internalTrafficPolicy": "Cluster",
"externalTrafficPolicy": "Local",
"annotations": {
"lowest": "set",
"merged": "from_http_service",
"global": "from_http_service",
},
}
templates = await make_templates(values)
services_by_name = dict[str, dict]()
for template in templates:
if template["kind"] == "Service":
services_by_name[template["metadata"]["name"]] = template
for ingress in templates:
if ingress["kind"] != "Ingress":
continue
for rule in ingress["spec"]["rules"]:
for path in rule["http"]["paths"]:
backend_service = path["backend"]["service"]
found_service = services_by_name[backend_service["name"]]
assert found_service["spec"].get("type") == "LoadBalancer"
assert found_service["spec"].get("internalTrafficPolicy") == "Local"
assert found_service["spec"].get("externalTrafficPolicy") == "Local"
annotations = found_service["metadata"]["annotations"]
assert annotations["lowest"] == "set"
assert annotations["merged"] == "from_ingress"
assert annotations["global"] == "set"