Skip to content

Commit

Permalink
feat: add support for custom scripts (#6970)
Browse files Browse the repository at this point in the history
* feat: add support for custom scripts

* docs: fix type and add set the defaultMode to grant execute permission

Signed-off-by: Amro Misbah <amromisba7@gmail.com>

---------

Signed-off-by: Amro Misbah <amromisba7@gmail.com>
Co-authored-by: Amro Misbah <amromisba7@gmail.com>
  • Loading branch information
moabu and misba7 committed Dec 8, 2023
1 parent 44a893b commit 37b171d
Show file tree
Hide file tree
Showing 37 changed files with 245 additions and 38 deletions.
4 changes: 3 additions & 1 deletion charts/janssen-all-in-one/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ Kubernetes: `>=v1.22.0-0`
| adminPassword | string | `"Test1234#"` | Admin password to log in to the UI. |
| alb.ingress | bool | `false` | switches the service to Nodeport for ALB ingress |
| auth-server | object | `{"appLoggers":{"auditStatsLogLevel":"INFO","auditStatsLogTarget":"FILE","authLogLevel":"INFO","authLogTarget":"STDOUT","enableStdoutLogPrefix":"true","httpLogLevel":"INFO","httpLogTarget":"FILE","ldapStatsLogLevel":"INFO","ldapStatsLogTarget":"FILE","persistenceDurationLogLevel":"INFO","persistenceDurationLogTarget":"FILE","persistenceLogLevel":"INFO","persistenceLogTarget":"FILE","scriptLogLevel":"INFO","scriptLogTarget":"FILE"},"authEncKeys":"RSA1_5 RSA-OAEP","authSigKeys":"RS256 RS384 RS512 ES256 ES384 ES512 PS256 PS384 PS512","enabled":true,"ingress":{"authServerEnabled":true,"deviceCodeEnabled":true,"firebaseMessagingEnabled":true,"openidConfigEnabled":true,"u2fConfigEnabled":true,"uma2ConfigEnabled":true,"webdiscoveryEnabled":true,"webfingerEnabled":true}}` | Parameters used globally across all services helm charts. |
| auth-server-key-rotation | object | `{"additionalAnnotations":{},"additionalLabels":{},"dnsConfig":{},"dnsPolicy":"","enabled":true,"image":{"pullPolicy":"IfNotPresent","pullSecrets":[],"repository":"ghcr.io/janssenproject/jans/certmanager","tag":"1.0.21_dev"},"keysLife":48,"keysPushDelay":0,"keysPushStrategy":"NEWER","keysStrategy":"NEWER","lifecycle":{},"resources":{"limits":{"cpu":"300m","memory":"300Mi"},"requests":{"cpu":"300m","memory":"300Mi"}},"usrEnvs":{"normal":{},"secret":{}},"volumeMounts":[],"volumes":[]}` | Responsible for regenerating auth-keys per x hours |
| auth-server-key-rotation | object | `{"additionalAnnotations":{},"additionalLabels":{},"customScripts":[],"dnsConfig":{},"dnsPolicy":"","enabled":true,"image":{"pullPolicy":"IfNotPresent","pullSecrets":[],"repository":"ghcr.io/janssenproject/jans/certmanager","tag":"1.0.21_dev"},"keysLife":48,"keysPushDelay":0,"keysPushStrategy":"NEWER","keysStrategy":"NEWER","lifecycle":{},"resources":{"limits":{"cpu":"300m","memory":"300Mi"},"requests":{"cpu":"300m","memory":"300Mi"}},"usrEnvs":{"normal":{},"secret":{}},"volumeMounts":[],"volumes":[]}` | Responsible for regenerating auth-keys per x hours |
| auth-server-key-rotation.additionalAnnotations | object | `{}` | Additional annotations that will be added across the gateway in the format of {cert-manager.io/issuer: "letsencrypt-prod"} |
| auth-server-key-rotation.additionalLabels | object | `{}` | Additional labels that will be added across the gateway in the format of {mylabel: "myapp"} |
| auth-server-key-rotation.customScripts | list | `[]` | Add custom scripts that have been mounted to run before the entrypoint. - /tmp/custom.sh - /tmp/custom2.sh |
| auth-server-key-rotation.dnsConfig | object | `{}` | Add custom dns config |
| auth-server-key-rotation.dnsPolicy | string | `""` | Add custom dns policy |
| auth-server-key-rotation.enabled | bool | `true` | Boolean flag to enable/disable the auth-server-key rotation cronjob. |
Expand Down Expand Up @@ -170,6 +171,7 @@ Kubernetes: `>=v1.22.0-0`
| configmap.cnSqldbUserPassword | string | `"Test1234#"` | SQL password injected the secrets . |
| configmap.lbAddr | string | `""` | Load balancer address for AWS if the FQDN is not registered. |
| countryCode | string | `"US"` | Country code. Used for certificate creation. |
| customScripts | list | `[]` | Add custom scripts that have been mounted to run before the entrypoint. - /tmp/custom.sh - /tmp/custom2.sh |
| dnsConfig | object | `{}` | Add custom dns config |
| dnsPolicy | string | `""` | Add custom dns policy |
| email | string | `"support@jans.io"` | Email address of the administrator usually. Used for certificate creation. |
Expand Down
10 changes: 10 additions & 0 deletions charts/janssen-all-in-one/templates/cronjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ spec:
{{- end }}
containers:
- name: {{ include "janssen-all-in-one.name" . }}-as-key-rotation
{{- if .Values.customScripts }}
command:
- /bin/sh
- -c
- |
{{- with .Values.customScripts }}
{{- toYaml . | replace "- " "" | nindent 20}}
{{- end }}
/app/bin/entrypoint.sh
{{- end}}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
env:
{{- include "janssen-all-in-one.usr-envs" . | indent 16 }}
Expand Down
7 changes: 6 additions & 1 deletion charts/janssen-all-in-one/templates/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ spec:
securityContext:
runAsUser: 1000
runAsNonRoot: true
{{- if not .Values.isFqdnRegistered }}
{{- if or (not .Values.isFqdnRegistered) ( .Values.customScripts) }}
command:
- /bin/sh
- -c
- |
{{- with .Values.customScripts }}
{{- toYaml . | replace "- " "" | nindent 14}}
{{- end }}
{{- if not .Values.isFqdnRegistered }}
/usr/bin/python3 /scripts/updatelbip.py &
{{- end}}
/app/bin/entrypoint.sh
{{- end}}
ports:
Expand Down
9 changes: 8 additions & 1 deletion charts/janssen-all-in-one/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ auth-server-key-rotation:
additionalAnnotations: {}
# -- Boolean flag to enable/disable the auth-server-key rotation cronjob.
enabled: true

# -- Add custom scripts that have been mounted to run before the entrypoint.
# - /tmp/custom.sh
# - /tmp/custom2.sh
customScripts: [ ]
casa:
# -- App loggers can be configured to define where the logs will be redirected to and the level of each in which it should be displayed.
appLoggers:
Expand Down Expand Up @@ -647,3 +650,7 @@ lifecycle: {}
additionalLabels: { }
# -- Additional annotations that will be added across the gateway in the format of {cert-manager.io/issuer: "letsencrypt-prod"}
additionalAnnotations: { }
# -- Add custom scripts that have been mounted to run before the entrypoint.
# - /tmp/custom.sh
# - /tmp/custom2.sh
customScripts: [ ]
Loading

0 comments on commit 37b171d

Please sign in to comment.