diff --git a/docs/modules/charts/nav.adoc b/docs/modules/charts/nav.adoc index 9fd46e8..86928f2 100644 --- a/docs/modules/charts/nav.adoc +++ b/docs/modules/charts/nav.adoc @@ -10,6 +10,7 @@ ** xref:headscale-ui.adoc[headscale-ui] ** xref:hydrogen-web.adoc[hydrogen-web] ** xref:jellyfin.adoc[jellyfin] +** xref:matrix-authentication-service.adoc[matrix-authentication-service] ** xref:matrix-sliding-sync.adoc[matrix-sliding-sync] ** xref:matrix-synapse.adoc[matrix-synapse] ** xref:mautrix-signal.adoc[mautrix-signal] diff --git a/docs/modules/charts/pages/matrix-authentication-service.adoc b/docs/modules/charts/pages/matrix-authentication-service.adoc new file mode 120000 index 0000000..7f372d3 --- /dev/null +++ b/docs/modules/charts/pages/matrix-authentication-service.adoc @@ -0,0 +1 @@ +../../../../matrix-authentication-service/README.adoc \ No newline at end of file diff --git a/matrix-authentication-service/.helmignore b/matrix-authentication-service/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/matrix-authentication-service/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/matrix-authentication-service/Chart.yaml b/matrix-authentication-service/Chart.yaml new file mode 100644 index 0000000..007b9fa --- /dev/null +++ b/matrix-authentication-service/Chart.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: v2 +name: matrix-authentication-service +description: OAuth2.0 + OpenID Provider for Matrix Homeservers (per MSC3861) +icon: https://matrix.org/images/matrix-logo.svg +type: application +version: 0.0.1 +# renovate: image=ghcr.io/matrix-org/matrix-authentication-service +appVersion: "0.8.0" +maintainers: + - name: WrenIX + url: https://wrenix.eu diff --git a/matrix-authentication-service/README.adoc b/matrix-authentication-service/README.adoc new file mode 100644 index 0000000..9359b91 --- /dev/null +++ b/matrix-authentication-service/README.adoc @@ -0,0 +1,1289 @@ + + += matrix-authentication-service + +image::https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square[Version: 0.0.1] +image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application] +image::https://img.shields.io/badge/AppVersion-0.8.0-informational?style=flat-square[AppVersion: 0.8.0] +== Maintainers + +.Maintainers +|=== +| Name | Email | Url + +| WrenIX +| +| +|=== + +== Usage + +Helm must be installed and setup to your kubernetes cluster to use the charts. +Refer to Helm's https://helm.sh/docs[documentation] to get started. +Once Helm has been set up correctly, fetch the charts as follows: + +[source,bash] +---- +helm pull oci://codeberg.org/wrenix/helm-charts/matrix-authentication-service +---- + +You can install a chart release using the following command: + +[source,bash] +---- +helm install matrix-authentication-service-release oci://codeberg.org/wrenix/helm-charts/matrix-authentication-service --values values.yaml +---- + +To uninstall a chart release use `helm`'s delete command: + +[source,bash] +---- +helm uninstall matrix-authentication-service-release +---- + +== Values + +.Values +|=== +| Key | Type | Default | Description + +| affinity +| object +| `{}` +| + +| autoscaling.enabled +| bool +| `false` +| + +| autoscaling.maxReplicas +| int +| `100` +| + +| autoscaling.minReplicas +| int +| `1` +| + +| autoscaling.targetCPUUtilizationPercentage +| int +| `80` +| + +| config.branding.imprint +| string +| `nil` +| + +| config.branding.logo_uri +| string +| `nil` +| + +| config.branding.policy_uri +| string +| `nil` +| + +| config.branding.service_name +| string +| `nil` +| + +| config.branding.tos_uri +| string +| `nil` +| + +| config.clients +| list +| `[]` +| + +| config.database.connect_timeout +| int +| `30` +| + +| config.database.database +| string +| `"sliding_sync"` +| + +| config.database.host +| string +| `"localhost"` +| + +| config.database.idle_timeout +| int +| `600` +| + +| config.database.max_connections +| int +| `10` +| + +| config.database.max_lifetime +| int +| `1800` +| + +| config.database.min_connections +| int +| `0` +| + +| config.database.password +| string +| `"secret"` +| + +| config.database.port +| int +| `5432` +| + +| config.database.username +| string +| `"sliding_sync"` +| + +| config.email.from +| string +| `"\"Authentication Service\" "` +| + +| config.email.reply_to +| string +| `"\"Authentication Service\" "` +| + +| config.email.transport +| string +| `"blackhole"` +| + +| config.experimental.access_token_ttl +| int +| `300` +| + +| config.experimental.compat_token_ttl +| int +| `300` +| + +| config.http.issuer +| string +| `"http://[::]:8080/"` +| + +| config.http.listeners[0].binds[0].address +| string +| `"[::]:8080"` +| + +| config.http.listeners[0].name +| string +| `"http"` +| + +| config.http.listeners[0].proxy_protocol +| bool +| `false` +| + +| config.http.listeners[0].resources[0].name +| string +| `"discovery"` +| + +| config.http.listeners[0].resources[1].name +| string +| `"human"` +| + +| config.http.listeners[0].resources[2].name +| string +| `"oauth"` +| + +| config.http.listeners[0].resources[3].name +| string +| `"compat"` +| + +| config.http.listeners[0].resources[4].name +| string +| `"graphql"` +| + +| config.http.listeners[0].resources[4].playground +| bool +| `true` +| + +| config.http.listeners[0].resources[5].name +| string +| `"assets"` +| + +| config.http.listeners[0].resources[5].path +| string +| `"/usr/local/share/mas-cli/assets/"` +| + +| config.http.listeners[1].binds[0].host +| string +| `"localhost"` +| + +| config.http.listeners[1].binds[0].port +| int +| `8081` +| + +| config.http.listeners[1].name +| string +| `"internal"` +| + +| config.http.listeners[1].proxy_protocol +| bool +| `false` +| + +| config.http.listeners[1].resources[0].name +| string +| `"health"` +| + +| config.http.listeners[2].binds[0].address +| string +| `"[::]:9100"` +| + +| config.http.listeners[2].name +| string +| `"metrics"` +| + +| config.http.listeners[2].resources[0].name +| string +| `"metrics"` +| + +| config.http.public_base +| string +| `"http://[::]:8080/"` +| + +| config.http.trusted_proxies[0] +| string +| `"192.128.0.0/16"` +| + +| config.http.trusted_proxies[1] +| string +| `"172.16.0.0/12"` +| + +| config.http.trusted_proxies[2] +| string +| `"10.0.0.0/10"` +| + +| config.http.trusted_proxies[3] +| string +| `"127.0.0.1/8"` +| + +| config.http.trusted_proxies[4] +| string +| `"fd00::/8"` +| + +| config.http.trusted_proxies[5] +| string +| `"::1/128"` +| + +| config.matrix.endpoint +| string +| `"http://localhost:8008/"` +| + +| config.matrix.homeserver +| string +| `"localhost:8008"` +| + +| config.matrix.secret +| string +| `"kPnqGbK9hmSRK41DZTgVJxfKVAiLrY6G"` +| + +| config.passwords.enabled +| bool +| `true` +| + +| config.passwords.schemes[0].algorithm +| string +| `"argon2id"` +| + +| config.passwords.schemes[0].version +| int +| `1` +| + +| config.policy.authorization_grant_entrypoint +| string +| `"authorization_grant/violation"` +| + +| config.policy.client_registration_entrypoint +| string +| `"client_registration/violation"` +| + +| config.policy.data +| string +| `nil` +| + +| config.policy.email_entrypoint +| string +| `"email/violation"` +| + +| config.policy.password_entrypoint +| string +| `"password/violation"` +| + +| config.policy.register_entrypoint +| string +| `"register/violation"` +| + +| config.policy.wasm_module +| string +| `"/usr/local/share/mas-cli/policy.wasm"` +| + +| config.secrets.encryption +| string +| `"5d3e33fa3c297d77b4c587cfc12b9adc03afe57ff36783fceceef2c0c1ba757d"` +| + +| config.secrets.keys +| list +| `[]` +| + +| config.telemetry.metrics.exporter +| string +| `"prometheus"` +| + +| config.telemetry.sentry.dsn +| string +| `nil` +| + +| config.telemetry.tracing.exporter +| string +| `"none"` +| + +| config.telemetry.tracing.propagators +| list +| `[]` +| + +| config.templates.assets_manifest +| string +| `"/usr/local/share/mas-cli/manifest.json"` +| + +| config.templates.path +| string +| `"/usr/local/share/mas-cli/templates/"` +| + +| config.templates.translations_path +| string +| `"/usr/local/share/mas-cli/translations/"` +| + +| config.upstream_oauth2.providers +| list +| `[]` +| + +| fullnameOverride +| string +| `""` +| + +| global.image.pullPolicy +| string +| `nil` +| if set it will overwrite all pullPolicy + +| global.image.registry +| string +| `nil` +| if set it will overwrite all registry entries + +| image.pullPolicy +| string +| `"IfNotPresent"` +| + +| image.registry +| string +| `"ghcr.io"` +| + +| image.repository +| string +| `"matrix-org/matrix-authentication-service"` +| + +| image.tag +| string +| `nil` +| Overrides the image tag whose default is the chart appVersion. + +| imagePullSecrets +| list +| `[]` +| + +| ingress.annotations +| object +| `{}` +| + +| ingress.className +| string +| `""` +| + +| ingress.enabled +| bool +| `false` +| + +| ingress.hosts[0].host +| string +| `"chart-example.local"` +| + +| ingress.hosts[0].paths[0].path +| string +| `"/_matrix/client/v3/login"` +| + +| ingress.hosts[0].paths[0].pathType +| string +| `"Exact"` +| + +| ingress.hosts[0].paths[1].path +| string +| `"/_matrix/client/v3/logout"` +| + +| ingress.hosts[0].paths[1].pathType +| string +| `"Exact"` +| + +| ingress.hosts[0].paths[2].path +| string +| `"/_matrix/client/v3/refresh"` +| + +| ingress.hosts[0].paths[2].pathType +| string +| `"Exact"` +| + +| ingress.tls +| list +| `[]` +| + +| livenessProbe.httpGet.path +| string +| `"/health"` +| + +| livenessProbe.httpGet.port +| string +| `"internal"` +| + +| nameOverride +| string +| `""` +| + +| nodeSelector +| object +| `{}` +| + +| podAnnotations +| object +| `{}` +| + +| podLabels +| object +| `{}` +| + +| podSecurityContext.fsGroup +| int +| `1000` +| + +| prometheus.servicemonitor.enabled +| bool +| `false` +| + +| prometheus.servicemonitor.labels +| object +| `{}` +| + +| readinessProbe.httpGet.path +| string +| `"/health"` +| + +| readinessProbe.httpGet.port +| string +| `"internal"` +| + +| replicaCount +| int +| `1` +| + +| resources +| object +| `{}` +| + +| securityContext.capabilities.drop[0] +| string +| `"ALL"` +| + +| securityContext.readOnlyRootFilesystem +| bool +| `true` +| + +| securityContext.runAsNonRoot +| bool +| `true` +| + +| securityContext.runAsUser +| int +| `1000` +| + +| service.port +| int +| `80` +| + +| service.type +| string +| `"ClusterIP"` +| + +| serviceAccount.annotations +| object +| `{}` +| + +| serviceAccount.automount +| bool +| `true` +| + +| serviceAccount.create +| bool +| `true` +| + +| serviceAccount.name +| string +| `""` +| + +| tolerations +| list +| `[]` +| + +| volumeMounts +| list +| `[]` +| + +| volumes +| list +| `[]` +| +|=== + +Autogenerated from chart metadata using https://github.com/norwoodj/helm-docs[helm-docs] += matrix-authentication-service + +image::https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square[Version: 0.0.1] +image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application] +image::https://img.shields.io/badge/AppVersion-0.8.0-informational?style=flat-square[AppVersion: 0.8.0] + +OAuth2.0 + OpenID Provider for Matrix Homeservers (per MSC3861) + +== Maintainers + +.Maintainers +|=== +| Name | Email | Url + +| WrenIX +| +| +|=== + +== Values + +.Values +|=== +| Key | Type | Default | Description + +| affinity +| object +| `{}` +| + +| autoscaling.enabled +| bool +| `false` +| + +| autoscaling.maxReplicas +| int +| `100` +| + +| autoscaling.minReplicas +| int +| `1` +| + +| autoscaling.targetCPUUtilizationPercentage +| int +| `80` +| + +| config.branding.imprint +| string +| `nil` +| + +| config.branding.logo_uri +| string +| `nil` +| + +| config.branding.policy_uri +| string +| `nil` +| + +| config.branding.service_name +| string +| `nil` +| + +| config.branding.tos_uri +| string +| `nil` +| + +| config.clients +| list +| `[]` +| + +| config.database.connect_timeout +| int +| `30` +| + +| config.database.database +| string +| `"sliding_sync"` +| + +| config.database.host +| string +| `"localhost"` +| + +| config.database.idle_timeout +| int +| `600` +| + +| config.database.max_connections +| int +| `10` +| + +| config.database.max_lifetime +| int +| `1800` +| + +| config.database.min_connections +| int +| `0` +| + +| config.database.password +| string +| `"secret"` +| + +| config.database.port +| int +| `5432` +| + +| config.database.username +| string +| `"sliding_sync"` +| + +| config.email.from +| string +| `"\"Authentication Service\" "` +| + +| config.email.reply_to +| string +| `"\"Authentication Service\" "` +| + +| config.email.transport +| string +| `"blackhole"` +| + +| config.experimental.access_token_ttl +| int +| `300` +| + +| config.experimental.compat_token_ttl +| int +| `300` +| + +| config.http.issuer +| string +| `"http://[::]:8080/"` +| + +| config.http.listeners[0].binds[0].address +| string +| `"[::]:8080"` +| + +| config.http.listeners[0].name +| string +| `"http"` +| + +| config.http.listeners[0].proxy_protocol +| bool +| `false` +| + +| config.http.listeners[0].resources[0].name +| string +| `"discovery"` +| + +| config.http.listeners[0].resources[1].name +| string +| `"human"` +| + +| config.http.listeners[0].resources[2].name +| string +| `"oauth"` +| + +| config.http.listeners[0].resources[3].name +| string +| `"compat"` +| + +| config.http.listeners[0].resources[4].name +| string +| `"graphql"` +| + +| config.http.listeners[0].resources[4].playground +| bool +| `true` +| + +| config.http.listeners[0].resources[5].name +| string +| `"assets"` +| + +| config.http.listeners[0].resources[5].path +| string +| `"/usr/local/share/mas-cli/assets/"` +| + +| config.http.listeners[1].binds[0].host +| string +| `"localhost"` +| + +| config.http.listeners[1].binds[0].port +| int +| `8081` +| + +| config.http.listeners[1].name +| string +| `"internal"` +| + +| config.http.listeners[1].proxy_protocol +| bool +| `false` +| + +| config.http.listeners[1].resources[0].name +| string +| `"health"` +| + +| config.http.listeners[2].binds[0].address +| string +| `"[::]:9100"` +| + +| config.http.listeners[2].name +| string +| `"metrics"` +| + +| config.http.listeners[2].resources[0].name +| string +| `"metrics"` +| + +| config.http.public_base +| string +| `"http://[::]:8080/"` +| + +| config.http.trusted_proxies[0] +| string +| `"192.128.0.0/16"` +| + +| config.http.trusted_proxies[1] +| string +| `"172.16.0.0/12"` +| + +| config.http.trusted_proxies[2] +| string +| `"10.0.0.0/10"` +| + +| config.http.trusted_proxies[3] +| string +| `"127.0.0.1/8"` +| + +| config.http.trusted_proxies[4] +| string +| `"fd00::/8"` +| + +| config.http.trusted_proxies[5] +| string +| `"::1/128"` +| + +| config.matrix.endpoint +| string +| `"http://localhost:8008/"` +| + +| config.matrix.homeserver +| string +| `"localhost:8008"` +| + +| config.matrix.secret +| string +| `"kPnqGbK9hmSRK41DZTgVJxfKVAiLrY6G"` +| + +| config.passwords.enabled +| bool +| `true` +| + +| config.passwords.schemes[0].algorithm +| string +| `"argon2id"` +| + +| config.passwords.schemes[0].version +| int +| `1` +| + +| config.policy.authorization_grant_entrypoint +| string +| `"authorization_grant/violation"` +| + +| config.policy.client_registration_entrypoint +| string +| `"client_registration/violation"` +| + +| config.policy.data +| string +| `nil` +| + +| config.policy.email_entrypoint +| string +| `"email/violation"` +| + +| config.policy.password_entrypoint +| string +| `"password/violation"` +| + +| config.policy.register_entrypoint +| string +| `"register/violation"` +| + +| config.policy.wasm_module +| string +| `"/usr/local/share/mas-cli/policy.wasm"` +| + +| config.secrets.encryption +| string +| `"5d3e33fa3c297d77b4c587cfc12b9adc03afe57ff36783fceceef2c0c1ba757d"` +| + +| config.secrets.keys +| list +| `[]` +| + +| config.telemetry.metrics.exporter +| string +| `"prometheus"` +| + +| config.telemetry.sentry.dsn +| string +| `nil` +| + +| config.telemetry.tracing.exporter +| string +| `"none"` +| + +| config.telemetry.tracing.propagators +| list +| `[]` +| + +| config.templates.assets_manifest +| string +| `"/usr/local/share/mas-cli/manifest.json"` +| + +| config.templates.path +| string +| `"/usr/local/share/mas-cli/templates/"` +| + +| config.templates.translations_path +| string +| `"/usr/local/share/mas-cli/translations/"` +| + +| config.upstream_oauth2.providers +| list +| `[]` +| + +| fullnameOverride +| string +| `""` +| + +| global.image.pullPolicy +| string +| `nil` +| if set it will overwrite all pullPolicy + +| global.image.registry +| string +| `nil` +| if set it will overwrite all registry entries + +| image.pullPolicy +| string +| `"IfNotPresent"` +| + +| image.registry +| string +| `"ghcr.io"` +| + +| image.repository +| string +| `"matrix-org/matrix-authentication-service"` +| + +| image.tag +| string +| `nil` +| Overrides the image tag whose default is the chart appVersion. + +| imagePullSecrets +| list +| `[]` +| + +| ingress.annotations +| object +| `{}` +| + +| ingress.className +| string +| `""` +| + +| ingress.enabled +| bool +| `false` +| + +| ingress.hosts[0].host +| string +| `"chart-example.local"` +| + +| ingress.hosts[0].paths[0].path +| string +| `"/_matrix/client/v3/login"` +| + +| ingress.hosts[0].paths[0].pathType +| string +| `"Exact"` +| + +| ingress.hosts[0].paths[1].path +| string +| `"/_matrix/client/v3/logout"` +| + +| ingress.hosts[0].paths[1].pathType +| string +| `"Exact"` +| + +| ingress.hosts[0].paths[2].path +| string +| `"/_matrix/client/v3/refresh"` +| + +| ingress.hosts[0].paths[2].pathType +| string +| `"Exact"` +| + +| ingress.tls +| list +| `[]` +| + +| livenessProbe.httpGet.path +| string +| `"/health"` +| + +| livenessProbe.httpGet.port +| string +| `"internal"` +| + +| nameOverride +| string +| `""` +| + +| nodeSelector +| object +| `{}` +| + +| podAnnotations +| object +| `{}` +| + +| podLabels +| object +| `{}` +| + +| podSecurityContext.fsGroup +| int +| `1000` +| + +| prometheus.servicemonitor.enabled +| bool +| `false` +| + +| prometheus.servicemonitor.labels +| object +| `{}` +| + +| readinessProbe.httpGet.path +| string +| `"/health"` +| + +| readinessProbe.httpGet.port +| string +| `"internal"` +| + +| replicaCount +| int +| `1` +| + +| resources +| object +| `{}` +| + +| securityContext.capabilities.drop[0] +| string +| `"ALL"` +| + +| securityContext.readOnlyRootFilesystem +| bool +| `true` +| + +| securityContext.runAsNonRoot +| bool +| `true` +| + +| securityContext.runAsUser +| int +| `1000` +| + +| service.port +| int +| `80` +| + +| service.type +| string +| `"ClusterIP"` +| + +| serviceAccount.annotations +| object +| `{}` +| + +| serviceAccount.automount +| bool +| `true` +| + +| serviceAccount.create +| bool +| `true` +| + +| serviceAccount.name +| string +| `""` +| + +| tolerations +| list +| `[]` +| + +| volumeMounts +| list +| `[]` +| + +| volumes +| list +| `[]` +| +|=== + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.11.2](https://github.com/norwoodj/helm-docs/releases/v1.11.2) diff --git a/matrix-authentication-service/templates/NOTES.txt b/matrix-authentication-service/templates/NOTES.txt new file mode 100644 index 0000000..eb6d3bb --- /dev/null +++ b/matrix-authentication-service/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- 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 "matrix-authentication-service.fullname" . }}) + 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 the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "matrix-authentication-service.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "matrix-authentication-service.fullname" . }} --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 "matrix-authentication-service.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/matrix-authentication-service/templates/_helpers.tpl b/matrix-authentication-service/templates/_helpers.tpl new file mode 100644 index 0000000..74b0985 --- /dev/null +++ b/matrix-authentication-service/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "matrix-authentication-service.name" -}} +{{- 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 "matrix-authentication-service.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. +*/}} +{{- define "matrix-authentication-service.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "matrix-authentication-service.labels" -}} +helm.sh/chart: {{ include "matrix-authentication-service.chart" . }} +{{ include "matrix-authentication-service.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "matrix-authentication-service.selectorLabels" -}} +app.kubernetes.io/name: {{ include "matrix-authentication-service.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "matrix-authentication-service.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "matrix-authentication-service.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/matrix-authentication-service/templates/deployment.yaml b/matrix-authentication-service/templates/deployment.yaml new file mode 100644 index 0000000..fb09f0f --- /dev/null +++ b/matrix-authentication-service/templates/deployment.yaml @@ -0,0 +1,90 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "matrix-authentication-service.fullname" . }} + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "matrix-authentication-service.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "matrix-authentication-service.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "matrix-authentication-service.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + {{- with .Values.image }} + image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag | default $.Chart.AppVersion }}" + imagePullPolicy: {{ coalesce $.Values.global.image.pullPolicy .pullPolicy }} + {{- end }} + env: + - name: "MAS_CONFIG" + value: "/etc/mas-config.yaml" + ports: + - name: http + containerPort: 8080 + protocol: TCP + - name: internal + containerPort: 8081 + protocol: TCP + - name: metrics + containerPort: 9100 + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: config + mountPath: "/etc" + subPath: "/etc/mas-config.yaml" + readOnly: true + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + - name: config + secret: + secretName: {{ include "matrix-authentication-service.fullname" . }} + items: + - key: "config.yaml" + path: "mas-config.yaml" + {{- with .Values.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/matrix-authentication-service/templates/hpa.yaml b/matrix-authentication-service/templates/hpa.yaml new file mode 100644 index 0000000..e361269 --- /dev/null +++ b/matrix-authentication-service/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "matrix-authentication-service.fullname" . }} + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "matrix-authentication-service.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/matrix-authentication-service/templates/ingress.yaml b/matrix-authentication-service/templates/ingress.yaml new file mode 100644 index 0000000..f8449a6 --- /dev/null +++ b/matrix-authentication-service/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "matrix-authentication-service.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/matrix-authentication-service/templates/secrets.yaml b/matrix-authentication-service/templates/secrets.yaml new file mode 100644 index 0000000..3da6550 --- /dev/null +++ b/matrix-authentication-service/templates/secrets.yaml @@ -0,0 +1,10 @@ +{{- $secretName := include "matrix-authentication-service.fullname" . }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ $secretName }} + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} +data: + config.yaml: |- + {{- .Values.config | nindent 4 }} diff --git a/matrix-authentication-service/templates/service.yaml b/matrix-authentication-service/templates/service.yaml new file mode 100644 index 0000000..fa006ca --- /dev/null +++ b/matrix-authentication-service/templates/service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "matrix-authentication-service.fullname" . }} + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + selector: + {{- include "matrix-authentication-service.selectorLabels" . | nindent 4 }} + ports: + - name: http + protocol: TCP + port: {{ .Values.service.port }} + targetPort: http + {{- with .Values.config.metrics }} + - name: metrics + protocol: TCP + port: {{ . }} + targetPort: metrics + {{- end }} diff --git a/matrix-authentication-service/templates/serviceaccount.yaml b/matrix-authentication-service/templates/serviceaccount.yaml new file mode 100644 index 0000000..7c9e8f8 --- /dev/null +++ b/matrix-authentication-service/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "matrix-authentication-service.serviceAccountName" . }} + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/matrix-authentication-service/templates/servicemonitor.yaml b/matrix-authentication-service/templates/servicemonitor.yaml new file mode 100644 index 0000000..4168407 --- /dev/null +++ b/matrix-authentication-service/templates/servicemonitor.yaml @@ -0,0 +1,18 @@ +{{- if .Values.prometheus.servicemonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "matrix-authentication-service.fullname" . }} + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} + {{- with .Values.prometheus.servicemonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: + {{- include "matrix-authentication-service.selectorLabels" . | nindent 6 }} + endpoints: + - port: metrics + path: "/metrics" +{{- end }} diff --git a/matrix-authentication-service/templates/tests/test-connection.yaml b/matrix-authentication-service/templates/tests/test-connection.yaml new file mode 100644 index 0000000..97fdcb4 --- /dev/null +++ b/matrix-authentication-service/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "matrix-authentication-service.fullname" . }}-test-connection" + labels: + {{- include "matrix-authentication-service.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "matrix-authentication-service.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/matrix-authentication-service/values.yaml b/matrix-authentication-service/values.yaml new file mode 100644 index 0000000..00e6151 --- /dev/null +++ b/matrix-authentication-service/values.yaml @@ -0,0 +1,218 @@ +--- +global: + image: + # -- if set it will overwrite all registry entries + registry: + # -- if set it will overwrite all pullPolicy + pullPolicy: + +image: + registry: ghcr.io + repository: matrix-org/matrix-authentication-service + pullPolicy: IfNotPresent + # -- Overrides the image tag whose default is the chart appVersion. + tag: + +replicaCount: 1 + +config: + clients: [] + http: + listeners: + - name: http + resources: + - name: discovery + - name: human + - name: oauth + - name: compat + - name: graphql + playground: true + - name: assets + path: /usr/local/share/mas-cli/assets/ + binds: + - address: '[::]:8080' + proxy_protocol: false + - name: internal + resources: + - name: health + binds: + - host: localhost + port: 8081 + proxy_protocol: false + - name: metrics + resources: + - name: metrics + binds: + - address: '[::]:9100' + trusted_proxies: + - 192.128.0.0/16 + - 172.16.0.0/12 + - 10.0.0.0/10 + - 127.0.0.1/8 + - fd00::/8 + - ::1/128 + public_base: http://[::]:8080/ + issuer: http://[::]:8080/ + database: + host: localhost + port: 5432 + username: sliding_sync + password: secret + database: sliding_sync + max_connections: 10 + min_connections: 0 + connect_timeout: 30 + idle_timeout: 600 + max_lifetime: 1800 + telemetry: + tracing: + exporter: none + propagators: [] + metrics: + exporter: prometheus + sentry: + dsn: null + templates: + path: /usr/local/share/mas-cli/templates/ + assets_manifest: /usr/local/share/mas-cli/manifest.json + translations_path: /usr/local/share/mas-cli/translations/ + email: + from: '"Authentication Service" ' + reply_to: '"Authentication Service" ' + transport: blackhole + secrets: + encryption: 5d3e33fa3c297d77b4c587cfc12b9adc03afe57ff36783fceceef2c0c1ba757d + keys: [] + passwords: + enabled: true + schemes: + - version: 1 + algorithm: argon2id + matrix: + homeserver: localhost:8008 + secret: kPnqGbK9hmSRK41DZTgVJxfKVAiLrY6G + endpoint: http://localhost:8008/ + policy: + wasm_module: /usr/local/share/mas-cli/policy.wasm + client_registration_entrypoint: client_registration/violation + register_entrypoint: register/violation + authorization_grant_entrypoint: authorization_grant/violation + password_entrypoint: password/violation + email_entrypoint: email/violation + data: null + upstream_oauth2: + providers: [] + branding: + service_name: null + policy_uri: null + tos_uri: null + imprint: null + logo_uri: null + experimental: + access_token_ttl: 300 + compat_token_ttl: 300 + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +prometheus: + servicemonitor: + enabled: false + labels: {} + +podAnnotations: {} +podLabels: {} + +podSecurityContext: + fsGroup: 1000 + +securityContext: + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: /_matrix/client/v3/login + pathType: Exact + - path: /_matrix/client/v3/logout + pathType: Exact + - path: /_matrix/client/v3/refresh + pathType: Exact + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +livenessProbe: + httpGet: + port: internal + path: /health +readinessProbe: + httpGet: + port: internal + path: /health + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {}