Skip to content

Commit

Permalink
Rafajpet/helm config improvements (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafajpet authored May 18, 2022
1 parent 1ae2916 commit ca2c858
Show file tree
Hide file tree
Showing 27 changed files with 224 additions and 48 deletions.
51 changes: 43 additions & 8 deletions charts/plgd-hub/README.md

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions charts/plgd-hub/templates/certificate-authority/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@
{{- end }}

{{- define "plgd-hub.certificateauthority.domainCertName" -}}
{{- $fullName := include "plgd-hub.certificateauthority.fullname" . -}}
{{- printf "%s-domain-crt" $fullName -}}
{{- if .Values.certificateauthority.ingress.secretName }}
{{- printf "%s" .Values.certificateauthority.ingress.secretName -}}
{{- else }}
{{- $fullName := include "plgd-hub.certificateauthority.fullname" . -}}
{{- printf "%s-domain-crt" $fullName -}}
{{- end }}
{{- end }}

{{- define "plgd-hub.certificateauthority.selectorLabels" -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ spec:
{{- with .Values.certificateauthority.extraVolumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.certificateauthority.extraContainers }}
{{- include "plgd-hub.tplvalues.render" ( dict "value" .Values.certificateauthority.extraContainers "context" $ ) | nindent 8 }}
{{- end }}
volumes:
- name: {{ .Values.resourcedirectory.config.volume }}
configMap:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- if .Values.certificateauthority.enabled }}
{{- $fullname := include "plgd-hub.certificateauthority.fullname" . }}
{{- $domainCrt := include "plgd-hub.certificateauthority.domainCertName" . }}
{{- $port := .Values.certificateauthority.port }}
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand Down
6 changes: 3 additions & 3 deletions charts/plgd-hub/templates/certificate-authority/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
type: {{ .Values.certificateauthority.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.certificateauthority.port }}
targetPort: grpc
protocol: TCP
name: grpc
targetPort: {{ .Values.certificateauthority.service.targetPort }}
protocol: {{ .Values.certificateauthority.service.protocol }}
name: {{ .Values.certificateauthority.service.name }}
selector:
{{- include "plgd-hub.certificateauthority.selectorLabels" . | nindent 4 }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/plgd-hub/templates/coap-gateway/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ spec:
mountPath: {{ printf "/secrets/%s" .name }}
{{- end }}
{{- end }}
{{- if .Values.coapgateway.extraContainers }}
{{- include "plgd-hub.tplvalues.render" ( dict "value" .Values.coapgateway.extraContainers "context" $ ) | nindent 8 }}
{{- end }}
volumes:
- name: {{ .Values.coapgateway.config.volume }}
configMap:
Expand Down
6 changes: 3 additions & 3 deletions charts/plgd-hub/templates/coap-gateway/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ spec:
{{- if $.Values.coapgateway.service.nodePort }}
nodePort: {{ $.Values.coapgateway.service.nodePort }}
{{- end }}
targetPort: coaps
protocol: TCP
name: coaps
targetPort: {{ .Values.coapgateway.service.targetPort }}
protocol: {{ .Values.coapgateway.service.protocol }}
name: {{ .Values.coapgateway.service.name }}
selector:
{{- include "plgd-hub.coapgateway.selectorLabels" . | nindent 4 }}
{{- end }}
8 changes: 6 additions & 2 deletions charts/plgd-hub/templates/grpc-gateway/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
{{- end }}

{{- define "plgd-hub.grpcgateway.domainCertName" -}}
{{- $fullName := include "plgd-hub.grpcgateway.fullname" . -}}
{{- printf "%s-domain-crt" $fullName -}}
{{- if .Values.grpcgateway.ingress.secretName }}
{{- printf "%s" .Values.grpcgateway.ingress.secretName -}}
{{- else }}
{{- $fullName := include "plgd-hub.grpcgateway.fullname" . -}}
{{- printf "%s-domain-crt" $fullName -}}
{{- end }}
{{- end }}


Expand Down
3 changes: 3 additions & 0 deletions charts/plgd-hub/templates/grpc-gateway/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ spec:
{{- with .Values.grpcgateway.extraVolumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.grpcgateway.extraContainers }}
{{- include "plgd-hub.tplvalues.render" ( dict "value" .Values.grpcgateway.extraContainers "context" $ ) | nindent 8 }}
{{- end }}
volumes:
- name: {{ .Values.grpcgateway.config.volume }}
configMap:
Expand Down
1 change: 0 additions & 1 deletion charts/plgd-hub/templates/grpc-gateway/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- if .Values.grpcgateway.enabled }}
{{- $fullname := include "plgd-hub.grpcgateway.fullname" . }}
{{- $domainCrt := include "plgd-hub.grpcgateway.domainCertName" . }}
{{- $port := .Values.grpcgateway.port }}
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand Down
6 changes: 3 additions & 3 deletions charts/plgd-hub/templates/grpc-gateway/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
type: {{ .Values.grpcgateway.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.grpcgateway.port }}
targetPort: grpc
protocol: TCP
name: grpc
targetPort: {{ .Values.grpcgateway.service.targetPort }}
protocol: {{ .Values.grpcgateway.service.protocol }}
name: {{ .Values.grpcgateway.service.name }}
selector:
{{- include "plgd-hub.grpcgateway.selectorLabels" . | nindent 4 }}
{{- end }}
17 changes: 15 additions & 2 deletions charts/plgd-hub/templates/http-gateway/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,22 @@
{{- end }}


{{- define "plgd-hub.httpgateway.domainCertName" -}}
{{- define "plgd-hub.httpgateway.uiDomainSecretName" -}}
{{- if .Values.httpgateway.ingress.ui.secretName }}
{{- printf "%s" .Values.httpgateway.ingress.ui.secretName -}}
{{- else -}}
{{- $fullName := include "plgd-hub.httpgateway.fullname" . -}}
{{- printf "%s-domain-crt" $fullName -}}
{{- printf "%s-ui-domain-crt" $fullName -}}
{{- end }}
{{- end }}

{{- define "plgd-hub.httpgateway.apiDomainSecretName" -}}
{{- if .Values.httpgateway.ingress.api.secretName }}
{{- printf "%s" .Values.httpgateway.ingress.api.secretName -}}
{{- else -}}
{{- $fullName := include "plgd-hub.httpgateway.fullname" . -}}
{{- printf "%s-api-domain-crt" $fullName -}}
{{- end }}
{{- end }}

{{- define "plgd-hub.httpgateway.apiDomain" -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $createServiceCert := include "plgd-hub.httpgateway.domainCertName" . }}
{{- if and $createServiceCert .Values.certmanager.enabled .Values.httpgateway.enabled (not $.Values.global.enableWildCartCert ) }}
{{- $createServiceCert := include "plgd-hub.httpgateway.apiDomainSecretName" . }}
{{- if and .Values.certmanager.enabled .Values.httpgateway.enabled .Values.httpgateway.ingress.api.enabled (not $.Values.global.enableWildCartCert ) }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
Expand All @@ -24,7 +24,6 @@ spec:
- client auth
dnsNames:
- {{ include "plgd-hub.httpgateway.apiDomain" . | quote }}
- {{ include "plgd-hub.httpgateway.uiDomain" . | quote }}
duration: {{ .Values.certmanager.external.cert.duration | default .Values.certmanager.default.cert.duration }}
renewBefore: {{ .Values.certmanager.external.cert.renewBefore | default .Values.certmanager.default.cert.renewBefore }}
issuerRef:
Expand Down
3 changes: 1 addition & 2 deletions charts/plgd-hub/templates/http-gateway/api-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- if .Values.httpgateway.enabled }}
{{- $fullname := include "plgd-hub.httpgateway.fullname" . }}
{{- $domainCrt := include "plgd-hub.httpgateway.domainCertName" . }}
{{- $port := .Values.httpgateway.port }}
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand All @@ -23,7 +22,7 @@ spec:
{{- if $.Values.global.enableWildCartCert }}
secretName: {{ include "plgd-hub.wildCardCertName" . | quote }}
{{- else }}
secretName: {{ include "plgd-hub.httpgateway.domainCertName" . | quote }}
secretName: {{ include "plgd-hub.httpgateway.apiDomainSecretName" . | quote }}
{{- end }}
rules:
- host: {{ include "plgd-hub.httpgateway.apiDomain" . | quote }}
Expand Down
3 changes: 3 additions & 0 deletions charts/plgd-hub/templates/http-gateway/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ spec:
{{- with .Values.httpgateway.extraVolumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.httpgateway.extraContainers }}
{{- include "plgd-hub.tplvalues.render" ( dict "value" .Values.httpgateway.extraContainers "context" $ ) | nindent 8 }}
{{- end }}
volumes:
- name: {{ .Values.httpgateway.config.volume }}
configMap:
Expand Down
6 changes: 3 additions & 3 deletions charts/plgd-hub/templates/http-gateway/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
type: {{ .Values.httpgateway.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.httpgateway.port }}
targetPort: http
protocol: TCP
name: http
targetPort: {{ .Values.httpgateway.service.targetPort }}
protocol: {{ .Values.httpgateway.service.protocol }}
name: {{ .Values.httpgateway.service.name }}
selector:
{{- include "plgd-hub.httpgateway.selectorLabels" . | nindent 4 }}
{{- end }}
33 changes: 33 additions & 0 deletions charts/plgd-hub/templates/http-gateway/ui-domain-crt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- $createServiceCert := include "plgd-hub.httpgateway.uiDomainSecretName" . }}
{{- if and .Values.certmanager.enabled .Values.httpgateway.enabled .Values.httpgateway.ui.enabled .Values.httpgateway.ingress.ui.enabled (not $.Values.global.enableWildCartCert ) }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ $createServiceCert }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "plgd-hub.labels" . | nindent 4 }}
{{- with .Values.certmanager.external.labels }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.certmanager.external.annotations }}
annotations:
{{- . | toYaml | nindent 4 }}
{{- end }}
spec:
secretName: {{ $createServiceCert }}
privateKey:
algorithm: {{ .Values.certmanager.external.cert.key.algorithm | default .Values.certmanager.default.cert.key.algorithm }}
size: {{ .Values.certmanager.external.cert.key.size | default .Values.certmanager.default.cert.key.size }}
usages:
- server auth
- client auth
dnsNames:
- {{ include "plgd-hub.httpgateway.uiDomain" . | quote }}
duration: {{ .Values.certmanager.external.cert.duration | default .Values.certmanager.default.cert.duration }}
renewBefore: {{ .Values.certmanager.external.cert.renewBefore | default .Values.certmanager.default.cert.renewBefore }}
issuerRef:
name: {{ .Values.certmanager.external.issuer.name | default .Values.certmanager.default.issuer.name }}
kind: {{ .Values.certmanager.external.issuer.kind | default .Values.certmanager.default.issuer.kind }}
group: cert-manager.io
{{- end }}
3 changes: 1 addition & 2 deletions charts/plgd-hub/templates/http-gateway/ui-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- if and .Values.httpgateway.enabled .Values.httpgateway.ui.enabled }}
{{- $fullname := include "plgd-hub.httpgateway.fullname" . }}
{{- $domainCrt := include "plgd-hub.httpgateway.domainCertName" . }}
{{- $port := .Values.httpgateway.port }}
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand All @@ -23,7 +22,7 @@ spec:
{{- if $.Values.global.enableWildCartCert }}
secretName: {{ include "plgd-hub.wildCardCertName" . | quote }}
{{- else }}
secretName: {{ include "plgd-hub.httpgateway.domainCertName" . | quote }}
secretName: {{ include "plgd-hub.httpgateway.uiDomainSecretName" . | quote }}
{{- end }}
rules:
- host: {{ include "plgd-hub.httpgateway.uiDomain" . | quote }}
Expand Down
3 changes: 3 additions & 0 deletions charts/plgd-hub/templates/identity-store/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ spec:
{{- with .Values.identitystore.extraVolumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.identitystore.extraContainers }}
{{- include "plgd-hub.tplvalues.render" ( dict "value" .Values.identitystore.extraContainers "context" $ ) | nindent 8 }}
{{- end }}
volumes:
{{- if ( include "plgd-hub.identitystore.createServiceCertByCm" . ) }}
- name: service-crt
Expand Down
6 changes: 3 additions & 3 deletions charts/plgd-hub/templates/identity-store/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
type: {{ .Values.identitystore.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.identitystore.port }}
targetPort: grpc
protocol: TCP
name: grpc
targetPort: {{ .Values.identitystore.service.targetPort }}
protocol: {{ .Values.identitystore.service.protocol }}
name: {{ .Values.identitystore.service.name }}
selector:
{{- include "plgd-hub.identitystore.selectorLabels" . | nindent 4 }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/plgd-hub/templates/mock-oauth-server/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
type: {{ .Values.mockoauthserver.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.mockoauthserver.port }}
targetPort: http
protocol: TCP
name: http
targetPort: {{ .Values.mockoauthserver.service.targetPort }}
protocol: {{ .Values.mockoauthserver.service.protocol }}
name: {{ .Values.mockoauthserver.service.name }}
selector:
{{- include "plgd-hub.mockoauthserver.selectorLabels" . | nindent 4 }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/plgd-hub/templates/resource-aggregate/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ spec:
{{- with .Values.resourceaggregate.extraVolumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.resourceaggregate.extraContainers }}
{{- include "plgd-hub.tplvalues.render" ( dict "value" .Values.resourceaggregate.extraContainers "context" $ ) | nindent 8 }}
{{- end }}
volumes:
- name: {{ .Values.resourcedirectory.config.volume }}
configMap:
Expand Down
6 changes: 3 additions & 3 deletions charts/plgd-hub/templates/resource-aggregate/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
type: {{ .Values.resourceaggregate.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.resourceaggregate.port }}
targetPort: grpc
protocol: TCP
name: grpc
targetPort: {{ .Values.resourceaggregate.service.targetPort }}
protocol: {{ .Values.resourceaggregate.service.protocol }}
name: {{ .Values.resourceaggregate.service.name }}
selector:
{{- include "plgd-hub.resourceaggregate.selectorLabels" . | nindent 4 }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/plgd-hub/templates/resource-directory/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ data:
publicConfiguration:
caPool: {{ .publicConfiguration.caPool | default "/certs/ca.crt" | quote }}
{{- if not $.Values.mockoauthserver.enabled }}
authorizationServer: {{ required "resourcedirectory.publicConfiguration.authorizationServer or global.authority is required" ( .publicConfiguration.authorizationServer | default $.Values.global.authority ) | quote }}
authorizationServer: {{ required "resourcedirectory.publicConfiguration.authorizationServer or global.authority is required" ( tpl (( .publicConfiguration.authorizationServer | default $.Values.global.authority ) | default "" ) $ ) | quote }}
{{- else }}
authorizationServer: {{ include "plgd-hub.mockoauthserver.uri" $ | quote }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions charts/plgd-hub/templates/resource-directory/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ spec:
{{- with .Values.resourcedirectory.extraVolumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.resourcedirectory.extraContainers }}
{{- include "plgd-hub.tplvalues.render" ( dict "value" .Values.resourcedirectory.extraContainers "context" $ ) | nindent 8 }}
{{- end }}
volumes:
- name: {{ .Values.resourcedirectory.config.volume }}
configMap:
Expand Down
6 changes: 3 additions & 3 deletions charts/plgd-hub/templates/resource-directory/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ spec:
type: {{ .Values.resourcedirectory.service.type | default "ClusterIP" }}
ports:
- port: {{ .Values.resourcedirectory.port }}
targetPort: grpc
protocol: TCP
name: grpc
targetPort: {{ .Values.resourcedirectory.service.targetPort }}
protocol: {{ .Values.resourcedirectory.service.protocol }}
name: {{ .Values.resourcedirectory.service.name }}
selector:
{{- include "plgd-hub.resourcedirectory.selectorLabels" . | nindent 4 }}
{{- end }}
Loading

0 comments on commit ca2c858

Please sign in to comment.