Skip to content

Commit c1e0134

Browse files
rafajpetRap
andauthored
Helm chart improve docs (#521)
Co-authored-by: Rap <peter.rafaj@kistler.com>
1 parent e08021b commit c1e0134

34 files changed

Lines changed: 923 additions & 113 deletions

charts/plgd-hub/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type: application
66

77
version: 0.0.1
88

9-
appVersion: v2next
9+
appVersion: vnext
1010

1111
dependencies:
1212
- name: "nats"

charts/plgd-hub/README.md

Lines changed: 115 additions & 28 deletions
Large diffs are not rendered by default.

charts/plgd-hub/README.md.gotmpl

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Install [cert-manager](https://cert-manager.io/) via [https://artifacthub.io/pac
1717
global:
1818
# -- Global domain
1919
domain:
20-
# -- Hub ID. Used by coap-gateway. It must be unique
20+
# -- HubID. Used by coap-gateway. It must be unique
2121
hubId:
2222
# -- OAuth owner Claim
2323
ownerClaim: "sub"
@@ -31,14 +31,14 @@ global:
3131
oauth:
3232
# -- List of OAuth client's configurations
3333
device:
34-
# -- Name of client
34+
# -- Name of provider
3535
- name:
3636
# -- Client ID
3737
clientID:
3838
# -- clientSecret or clientSecretFile
3939
clientSecret:
40-
clientSecretFile:
41-
# -- Redirect URL
40+
#clientSecretFile:
41+
# -- Redirect URL. In case you are using mobile app, redirectURL should be in format cloud.plgd.mobile://login-callback
4242
redirectURL:
4343
# -- Use in httpgateway.ui.webConfiguration.deviceOAuthClient configuration. Default first item in list
4444
useInUi: true
@@ -47,8 +47,35 @@ global:
4747
clientID:
4848
```
4949

50+
### Setup with OAuth Mock server:
51+
52+
```
53+
# -- Global config variables
54+
global:
55+
# -- Global domain
56+
domain: "domain.com"
57+
# -- CloudID. Used by coap-gateway. It must be unique
58+
hubId: 1c10a3b6-287c-11ec-ac2d-13054959c274
59+
mockoauthserver:
60+
enabled: true
61+
```
62+
63+
### NodePort for coap-gateway
64+
65+
In case you install plgd-hub into [microk8s.io/](https://microk8s.io/), it's required to enable also
66+
nodePort for coap-gateway. For enable nodePort for coap-gateway add config below:
67+
68+
```
69+
coapgateway:
70+
service:
71+
nodePort: 5684
72+
```
73+
74+
> This configuration should be applied only to test environment !!!
75+
5076
{{ template "chart.requirementsSection" . }}
5177

5278
{{ template "chart.valuesSection" . }}
5379

5480
{{ template "helm-docs.versionFooter" . }}
81+
Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
Thank you for installing {{ .Chart.Name }}.
1+
{{ .Chart.Description }}
22

3-
For more information about plgd-hub. Please follow: [plgd.dev](https://plgd.dev/)
3+
For more information about plgd-hub, follow: https://github.com/plgd-dev/hub/
44

5-
coap-gateway domain: {{ printf "%s:%v" ( required "global.domain is required" ( $.Values.coapgateway.apis.coap.externalAddress | default $.Values.global.domain )) $.Values.coapgateway.port }}
6-
Web UI domain: {{ printf "https://%s" ( include "plgd-hub.httpgateway.apiDomain" . ) }}
7-
API domain: {{ printf "https://%s" ( include "plgd-hub.httpgateway.apiDomain" . ) }}
5+
PARAMETERS:
6+
----------------------------------------------------------
7+
{{- if $.Values.coapgateway.enabled }}
8+
coap-gateway uri: {{ printf "coap+tcp://%s:%v" ( required "global.domain is required" ( $.Values.coapgateway.apis.coap.externalAddress | default $.Values.global.domain )) $.Values.coapgateway.port }}
9+
{{- end }}
10+
{{- if $.Values.httpgateway.enabled }}
11+
Web UI uri: {{ printf "https://%s" ( include "plgd-hub.httpgateway.uiDomain" . ) }}
12+
http-gateway uri: {{ printf "https://%s" ( include "plgd-hub.httpgateway.apiDomain" . ) }}
13+
{{- end }}
14+
{{- if $.Values.mockoauthserver.enabled }}
15+
------- Mock OAuth server enabled !!!!! ------------------
16+
You enabled mocked version of OAuth Server used only for test/development purpose. Use with extra care. Could not
17+
be used for production environment !!!
18+
Mock OAuth server: {{ include "plgd-hub.mockoauthserver.uri" . }}
19+
----------------------------------------------------------
20+
{{- else }}
21+
OAuth server: {{ $.Values.global.authority }}
22+
{{- end }}

charts/plgd-hub/templates/_helpers.tpl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 }}

charts/plgd-hub/templates/certificate-authority/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ spec:
104104
{{- if and ( not $customCaDefined ) .Values.certificateauthority.enabled }}
105105
- name: {{ .Values.certificateauthority.ca.volume.name }}
106106
secret:
107-
secretName: {{ .Values.certificateauthority.ca.secret.name | default .Values.certificateauthority.ca.default.secret.name }}
107+
secretName: {{ .Values.certificateauthority.ca.secret.name | default $.Values.certmanager.default.ca.secret.name }}
108108
{{- end }}
109109
{{- with .Values.certificateauthority.extraVolumeMounts }}
110110
{{- toYaml . | nindent 8 }}

charts/plgd-hub/templates/certificate-authority/domain-crt.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- $domainCrt := include "plgd-hub.certificateauthority.domainCertName" . }}
2-
{{- if and $domainCrt .Values.certmanager.enabled .Values.certificateauthority.enabled }}
2+
{{- if and $domainCrt .Values.certmanager.enabled .Values.certificateauthority.enabled (not $.Values.global.enableWildCartCert ) }}
33
{{- $serviceDns := include "plgd-hub.certificateauthority.fullname" . }}
44
apiVersion: cert-manager.io/v1
55
kind: Certificate

charts/plgd-hub/templates/certificate-authority/ingress.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ metadata:
1010
labels:
1111
{{- include "plgd-hub.labels" . | nindent 4 }}
1212
annotations:
13+
{{/* kubernetes.io/ingress.class: "nginx"*/}}
1314
nginx.org/grpc-services: {{ $fullname | quote }}
1415
nginx.ingress.kubernetes.io/backend-protocol: "GRPCS"
1516
ingress.kubernetes.io/force-ssl-redirect: "true"
@@ -21,7 +22,11 @@ spec:
2122
tls:
2223
- hosts:
2324
- {{ include "plgd-hub.certificateauthority.domain" . | quote }}
25+
{{- if $.Values.global.enableWildCartCert }}
26+
secretName: {{ include "plgd-hub.wildCardCertName" . | quote }}
27+
{{- else }}
2428
secretName: {{ include "plgd-hub.certificateauthority.domainCertName" . | quote }}
29+
{{- end }}
2530
rules:
2631
- host: {{ include "plgd-hub.certificateauthority.domain" . | quote }}
2732
http:

charts/plgd-hub/templates/certs/coap/certificate-authority.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- if and ( include "plgd-hub.enableDefaultIssuer" . ) ( $.Values.certmanager.default.ca.issuer.enabled ) }}
2+
apiVersion: cert-manager.io/v1
3+
kind: {{ .Values.certmanager.default.ca.issuer.kind }}
4+
metadata:
5+
name: {{ .Values.certmanager.default.ca.issuer.name }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "plgd-hub.labels" . | nindent 4 }}
9+
{{- if .Values.certmanager.default.ca.issuer.annotations }}
10+
annotations:
11+
{{- range $key, $value := .Values.certmanager.default.ca.issuer.annotations }}
12+
{{ $key }}: {{ $value | quote }}
13+
{{- end }}
14+
{{- end }}
15+
spec:
16+
{{- .Values.certmanager.default.ca.issuer.spec | toYaml | nindent 2 }}
17+
{{- end }}

0 commit comments

Comments
 (0)