Make service dns domain configurable (#164)

Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: Marco Franssen <[email protected]>
This commit is contained in:
kfox1111
2023-04-03 19:52:36 +02:00
committed by GitHub
co-authored by Marco Franssen
parent ec236e9762
commit c661d0bc7e
11 changed files with 30 additions and 3 deletions
+1
View File
@@ -105,6 +105,7 @@ Kubernetes: `>=1.21.0-0`
| Key | Type | Default | Description | | Key | Type | Default | Description |
|-----|------|---------|-------------| |-----|------|---------|-------------|
| fullnameOverride | string | `""` | | | fullnameOverride | string | `""` | |
| global.k8s.clusterDomain | string | `"cluster.local"` | |
| global.spire.bundleConfigMap | string | `""` | Override all instances of bundleConfigMap | | global.spire.bundleConfigMap | string | `""` | Override all instances of bundleConfigMap |
| global.spire.clusterName | string | `"example-cluster"` | Set the name of the Kubernetes cluster | | global.spire.clusterName | string | `"example-cluster"` | Set the name of the Kubernetes cluster |
| global.spire.trustDomain | string | `"example.org"` | Set the trust domain to use for the spiffe identifiers | | global.spire.trustDomain | string | `"example.org"` | Set the trust domain to use for the spiffe identifiers |
@@ -21,6 +21,7 @@ A Helm chart to install the SPIFFE OIDC discovery provider.
| autoscaling.minReplicas | int | `1` | | | autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | | | autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| autoscaling.targetMemoryUtilizationPercentage | int | `80` | | | autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| clusterDomain | string | `"cluster.local"` | |
| config.acme.cacheDir | string | `"/run/spire"` | | | config.acme.cacheDir | string | `"/run/spire"` | |
| config.acme.directoryUrl | string | `"https://acme-v02.api.letsencrypt.org/directory"` | | | config.acme.directoryUrl | string | `"https://acme-v02.api.letsencrypt.org/directory"` | |
| config.acme.emailAddress | string | `"[email protected]"` | | | config.acme.emailAddress | string | `"[email protected]"` | |
@@ -103,3 +103,11 @@ Create the name of the service account to use
{{- .Values.trustDomain }} {{- .Values.trustDomain }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- define "spiffe-oidc-discovery-provider.cluster-domain" }}
{{- if ne (len (dig "k8s" "clusterDomain" "" .Values.global)) 0 }}
{{- .Values.global.k8s.clusterDomain }}
{{- else }}
{{- .Values.clusterDomain }}
{{- end }}
{{- end }}
@@ -11,7 +11,7 @@ data:
domains = [ domains = [
"{{ include "spiffe-oidc-discovery-provider.fullname" . }}", "{{ include "spiffe-oidc-discovery-provider.fullname" . }}",
"{{ include "spiffe-oidc-discovery-provider.fullname" . }}.{{ include "spiffe-oidc-discovery-provider.namespace" . }}", "{{ include "spiffe-oidc-discovery-provider.fullname" . }}.{{ include "spiffe-oidc-discovery-provider.namespace" . }}",
"{{ include "spiffe-oidc-discovery-provider.fullname" . }}.{{ include "spiffe-oidc-discovery-provider.namespace" . }}.svc.cluster.local", "{{ include "spiffe-oidc-discovery-provider.fullname" . }}.{{ include "spiffe-oidc-discovery-provider.namespace" . }}.svc.{{ include "spiffe-oidc-discovery-provider.cluster-domain" . }}",
{{- if gt (len .Values.config.domains) 0 }} {{- if gt (len .Values.config.domains) 0 }}
"{{- join "\",\n \"" .Values.config.domains }}" "{{- join "\",\n \"" .Values.config.domains }}"
{{- end }} {{- end }}
@@ -26,7 +26,7 @@ spec:
- name: curl-service-name-namespace-svc-cluster-local - name: curl-service-name-namespace-svc-cluster-local
image: cgr.dev/chainguard/bash:latest image: cgr.dev/chainguard/bash:latest
command: ['curl'] command: ['curl']
args: ['-s', '-f', 'http://{{ include "spiffe-oidc-discovery-provider.fullname" . }}.{{ include "spiffe-oidc-discovery-provider.namespace" . }}.svc.cluster.local:{{ .Values.service.port }}/.well-known/openid-configuration'] args: ['-s', '-f', 'http://{{ include "spiffe-oidc-discovery-provider.fullname" . }}.{{ include "spiffe-oidc-discovery-provider.namespace" . }}.svc.{{ include "spiffe-oidc-discovery-provider.cluster-domain" . }}:{{ .Values.service.port }}/.well-known/openid-configuration']
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 8 }} {{- toYaml .Values.securityContext | nindent 8 }}
{{- if .Values.ingress.enabled }} {{- if .Values.ingress.enabled }}
@@ -113,6 +113,8 @@ tolerations: []
affinity: {} affinity: {}
trustDomain: example.org trustDomain: example.org
# -- This is the value of your clusters `kubeadm init --service-dns-domain` flag
clusterDomain: cluster.local
telemetry: telemetry:
prometheus: prometheus:
@@ -28,6 +28,7 @@ A Helm chart to install the SPIRE server.
| ca_subject.common_name | string | `"example.org"` | | | ca_subject.common_name | string | `"example.org"` | |
| ca_subject.country | string | `"NL"` | | | ca_subject.country | string | `"NL"` | |
| ca_subject.organization | string | `"Example"` | | | ca_subject.organization | string | `"Example"` | |
| clusterDomain | string | `"cluster.local"` | |
| clusterName | string | `"example-cluster"` | | | clusterName | string | `"example-cluster"` | |
| controllerManager.enabled | bool | `false` | | | controllerManager.enabled | bool | `false` | |
| controllerManager.identities.dnsNameTemplates | list | `[]` | | | controllerManager.identities.dnsNameTemplates | list | `[]` | |
@@ -130,3 +130,11 @@ Create the name of the service account to use
{{- .Values.bundleConfigMap }} {{- .Values.bundleConfigMap }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- define "spire-server.cluster-domain" -}}
{{- if ne (len (dig "k8s" "clusterDomain" "" .Values.global)) 0 }}
{{- .Values.global.k8s.clusterDomain }}
{{- else }}
{{- .Values.clusterDomain }}
{{- end }}
{{- end }}
@@ -33,7 +33,7 @@ spec:
- name: curl-federation-bundle-endpoint - name: curl-federation-bundle-endpoint
image: cgr.dev/chainguard/bash:latest image: cgr.dev/chainguard/bash:latest
command: ['curl'] command: ['curl']
args: ['-k', '-s', '-f', 'https://{{ include "spire-server.fullname" . }}.{{ include "spire-server.namespace" . }}.svc.cluster.local:{{ .Values.federation.bundleEndpoint.port }}'] args: ['-k', '-s', '-f', 'https://{{ include "spire-server.fullname" . }}.{{ include "spire-server.namespace" . }}.svc.{{ include "spire-server.cluster-domain" . }}:{{ .Values.federation.bundleEndpoint.port }}']
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 8 }} {{- toYaml .Values.securityContext | nindent 8 }}
{{- end }} {{- end }}
@@ -87,6 +87,9 @@ trustDomain: example.org
bundleConfigMap: spire-bundle bundleConfigMap: spire-bundle
# -- This is the value of your clusters `kubeadm init --service-dns-domain` flag
clusterDomain: cluster.local
federation: federation:
enabled: false enabled: false
bundleEndpoint: bundleEndpoint:
+3
View File
@@ -1,5 +1,8 @@
# You can enable config/features that affect all services here. # You can enable config/features that affect all services here.
global: global:
k8s:
# -- This is the value of your clusters `kubeadm init --service-dns-domain` flag
clusterDomain: "cluster.local"
spire: spire:
# -- Set the name of the Kubernetes cluster # -- Set the name of the Kubernetes cluster
clusterName: "example-cluster" clusterName: "example-cluster"