@@ -102,11 +102,30 @@ If release name contains chart name it will be used as a full name.
102102 {{- $authoriztion := index . 1 }}
103103 {{- $prefix := index . 2 }}
104104 ownerClaim:{{ printf " " }}{{ required (printf " %s .apis.grpc.authorization.ownerClaim or global.ownerClaim is required " $prefix ) ( $authoriztion .ownerClaim | default $ .Values.global.ownerClaim ) | quote }}
105+ {{- if not $ .Values.mockoauthserver.enabled }}
105106 authority:{{ printf " " }}{{ required (printf " %s .apis.grpc.authorization.authority or global.authority is required " $prefix ) ( $authoriztion .authority | default $ .Values.global.authority ) | quote }}
106107 audience:{{ printf " " }}{{ ( $authoriztion .audience | default $ .Values.global.audience ) | quote }}
108+ {{- else }}
109+ authority:{{ printf " " }}{{ include " plgd-hub.mockoauthserver.uri" $ }}
110+ audience:{{ printf " " }}{{ printf " " | quote }}
111+ {{- end }}
112+ {{- end }}
113+
114+ {{- define " plgd-hub.baseAthorizationConfig" }}
115+ {{- $ := index . 0 }}
116+ {{- $authoriztion := index . 1 }}
117+ {{- $prefix := index . 2 }}
118+ {{- if not $ .Values.mockoauthserver.enabled }}
119+ authority:{{ printf " " }}{{ required (printf " %s .apis.grpc.authorization.authority or global.authority is required " $prefix ) ( $authoriztion .authority | default $ .Values.global.authority ) | quote }}
120+ audience:{{ printf " " }}{{ ( $authoriztion .audience | default $ .Values.global.audience ) | quote }}
121+ {{- else }}
122+ authority:{{ printf " " }}{{ include " plgd-hub.mockoauthserver.uri" $ }}
123+ audience:{{ printf " " }}{{ printf " " | quote }}
124+ {{- end }}
107125{{- end }}
108126
109127
128+
110129{{- define " plgd-hub.createInternalCertByCm" }}
111130 {{- $natsTls := .Values.coapgateway.clients.eventBus.nats.tls.certFile }}
112131 {{- $authClientTls := .Values.coapgateway.clients.identityStore.grpc.tls.certFile }}
@@ -272,3 +291,35 @@ app.kubernetes.io/instance: {{ .Release.Name }}
272291 {{ required " clientSecret or clientSecretFile for oauth provider is required " ( $provider .clientSecret | default $provider .clientSecretFile ) }}
273292 {{- end }}
274293{{- end }}
294+
295+ {{- define " plgd-hub.enableDefaultIssuer" }}
296+ {{- if and .Values.certmanager.enabled .Values.certmanager.default.issuer.enabled }}
297+ {{- $nameInternal := .Values.certmanager.internal.issuer.name }}
298+ {{- $kindInternal := .Values.certmanager.internal.issuer.kind }}
299+ {{- $specInternal := .Values.certmanager.internal.issuer.spec }}
300+
301+ {{- $nameCoap := .Values.certmanager.coap.issuer.name }}
302+ {{- $kindCoap := .Values.certmanager.coap.issuer.kind }}
303+ {{- $specCoap := .Values.certmanager.coap.issuer.spec }}
304+
305+ {{- $nameExternal := .Values.certmanager.external.issuer.name }}
306+ {{- $kindExternal := .Values.certmanager.external.issuer.kind }}
307+ {{- $specExternal := .Values.certmanager.external.issuer.spec }}
308+
309+ {{- $internalIssuer := or ( and $nameInternal $kindInternal ) $specInternal }}
310+ {{- $coapIssuer := or ( and $nameCoap $kindCoap ) $specCoap }}
311+ {{- $externalIssuer := or ( and $nameExternal $kindExternal ) $specExternal }}
312+ {{- printf " %t " ( not ( and $internalIssuer $coapIssuer $externalIssuer )) }}
313+ {{- else }}
314+ {{- printf " false" }}
315+ {{- end }}
316+ {{- end }}
317+
318+ {{- define " plgd-hub.wildCardCertDomain" -}}
319+ {{- printf " *.%s " .Values.global.domain }}
320+ {{- end }}
321+
322+ {{- define " plgd-hub.wildCardCertName" -}}
323+ {{- $fullName := include " plgd-hub.fullname" . -}}
324+ {{- printf " %s -wildcard-crt" $fullName -}}
325+ {{- end }}
0 commit comments