-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb466b1
commit 068f064
Showing
22 changed files
with
1,209 additions
and
4 deletions.
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
charts/plgd-hub/templates/device-provisioning-service/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{{- define "plgd-hub.deviceprovisioningservice.fullname" -}} | ||
{{- if .Values.deviceprovisioningservice.fullnameOverride }} | ||
{{- .Values.deviceprovisioningservice.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Values.deviceprovisioningservice.name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s-%s" .Release.Name $name .Values.deviceprovisioningservice.name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.configName" -}} | ||
{{- $fullName := include "plgd-hub.deviceprovisioningservice.fullname" . -}} | ||
{{- printf "%s-cfg" $fullName }} | ||
{{- end -}} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.apiDomain" -}} | ||
{{- if .Values.deviceprovisioningservice.apiDomain }} | ||
{{- printf "%s" .Values.deviceprovisioningservice.apiDomain }} | ||
{{- else }} | ||
{{- printf "api.%s" .Values.global.domain }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.image" -}} | ||
{{- $registryName := .Values.deviceprovisioningservice.image.registry | default "" -}} | ||
{{- $repositoryName := .Values.deviceprovisioningservice.image.repository -}} | ||
{{- $tag := .Values.deviceprovisioningservice.image.tag | default .Chart.AppVersion | toString -}} | ||
{{- printf "%s%s:%s" $registryName $repositoryName $tag -}} | ||
{{- end -}} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.serviceCertificateMountPath" }} | ||
{{- .Values.deviceprovisioningservice.service.certificate.mountPath | default "/certs" }} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.clientCertName" -}} | ||
{{- $fullName := include "plgd-hub.deviceprovisioningservice.fullname" . }} | ||
{{- printf "%s-client-crt" $fullName -}} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.serviceCertName" -}} | ||
{{- $fullName := include "plgd-hub.deviceprovisioningservice.fullname" . }} | ||
{{- printf "%s-crt" $fullName -}} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.domainCertName" -}} | ||
{{- $fullName := include "plgd-hub.deviceprovisioningservice.fullname" . }} | ||
{{- if .Values.deviceprovisioningservice.ingress.domainCertName }} | ||
{{- .Values.deviceprovisioningservice.ingress.domainCertName }} | ||
{{- else }} | ||
{{- printf "%s-domain-crt" $fullName -}} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ .Values.deviceprovisioningservice.name }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.labels" -}} | ||
helm.sh/chart: {{ include "plgd-hub.chart" . }} | ||
{{ include "plgd-hub.deviceprovisioningservice.selectorLabel" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
|
||
{{- define "plgd-hub.deviceprovisioningservice.authority" }} | ||
{{- $ := index . 0 }} | ||
{{- $authProvider := index . 1 }} | ||
{{- $authority := required "Authorization authority is required. Set global.authority or authority per enrollment group or in case you use the DPS with the mock OAuth Server, make sure global.domain is set." ( $authProvider.authority | default ( $.Values.global.authority | default $.Values.global.domain )) }} | ||
{{- if hasPrefix "http" $authority }} | ||
{{- $authority }} | ||
{{- else }} | ||
{{- printf "https://%s" $authority }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.coapGateway" }} | ||
{{- $ := index . 0 }} | ||
{{- $hub := index . 1 }} | ||
{{- $_ := required "CoAP Gateway address is required. Use global.domain or deviceprovisioningservice.enrollmentGroups[].hub.coapGateway. In case of using global domain, default port 5684 or coapgateway.service.nodePort.port if specified is used" ( $hub.coapGateway | default $.Values.global.domain ) }} | ||
{{- if $hub.coapGateway }} | ||
{{- $hub.coapGateway }} | ||
{{- else }} | ||
{{- printf "%s:%v" $.Values.global.domain ( $.Values.coapgateway.service.nodePort | default 5684 ) }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "plgd-hub.deviceprovisioningservice.certificateAuthority" }} | ||
{{- $ := index . 0 }} | ||
{{- $certificateAuthority := index . 1 }} | ||
{{- $ret := "" }} | ||
{{- if $certificateAuthority }} | ||
{{- if $certificateAuthority.grpc }} | ||
{{- if $certificateAuthority.grpc.address }} | ||
{{- $ret = $certificateAuthority.grpc.address }} | ||
{{- end}} | ||
{{- end }} | ||
{{- end }} | ||
{{- if and (empty $ret) $.Values.certificateauthority }} | ||
{{- if $.Values.certificateauthority.domain }} | ||
{{- $ret = printf "%s:443" $.Values.certificateauthority.domain }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if empty $ret }} | ||
{{- $ret = printf "api.%s:443" $.Values.global.domain }} | ||
{{- end }} | ||
{{- $ret }} | ||
{{- end }} |
31 changes: 31 additions & 0 deletions
31
charts/plgd-hub/templates/device-provisioning-service/client-crt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{- $clientCertName := include "plgd-hub.deviceprovisioningservice.clientCertName" . }} | ||
{{- if and $clientCertName .Values.certmanager.enabled }} | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ $clientCertName }}-client | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "plgd-hub.deviceprovisioningservice.labels" . | nindent 4 }} | ||
{{- with .Values.certmanager.internal.labels }} | ||
{{- . | toYaml | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.certmanager.internal.annotations }} | ||
annotations: | ||
{{- . | toYaml | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
secretName: {{ $clientCertName }} | ||
commonName: {{ $clientCertName | quote }} | ||
privateKey: | ||
algorithm: {{ .Values.certmanager.internal.cert.key.algorithm | default .Values.certmanager.default.cert.key.algorithm }} | ||
size: {{ .Values.certmanager.internal.cert.key.size | default .Values.certmanager.default.cert.key.size }} | ||
usages: | ||
- client auth | ||
duration: {{ .Values.certmanager.internal.cert.duration | default .Values.certmanager.default.cert.duration }} | ||
renewBefore: {{ .Values.certmanager.internal.cert.renewBefore | default .Values.certmanager.default.cert.renewBefore }} | ||
issuerRef: | ||
name: {{ .Values.certmanager.internal.issuer.name | default .Values.certmanager.default.issuer.name }} | ||
kind: {{ .Values.certmanager.internal.issuer.kind | default .Values.certmanager.default.issuer.kind }} | ||
group: {{ .Values.certmanager.internal.issuer.group | default .Values.certmanager.default.issuer.group }} | ||
{{- end }} |
Oops, something went wrong.