diff --git a/charts/spire/charts/tornjak-frontend/README.md b/charts/spire/charts/tornjak-frontend/README.md index 23fb07e..63a0373 100644 --- a/charts/spire/charts/tornjak-frontend/README.md +++ b/charts/spire/charts/tornjak-frontend/README.md @@ -87,7 +87,7 @@ port forwarding. See the chart NOTES output for more details. | `startupProbe.timeoutSeconds` | Timeout seconds for startupProbe | `5` | | `startupProbe.failureThreshold` | Failure threshold count for startupProbe | `6` | | `startupProbe.successThreshold` | Success threshold count for startupProbe | `1` | -| `workingDir` | Path containing the Tornjak frontend within the image | `/usr/src/app` | +| `workingDir` | Set to override the default path containing the Tornjak frontend within the image | `""` | | `ingress.enabled` | Flag to enable ingress for Tornjak frontend service | `false` | | `ingress.className` | Ingress class name for Tornjak frontend service | `""` | | `ingress.controllerType` | Specify what type of ingress controller you're using to add the necessary annotations accordingly. If blank, autodetection is attempted. If other, no annotations will be added. Must be one of [ingress-nginx, openshift, other, ""]. | `""` | diff --git a/charts/spire/charts/tornjak-frontend/templates/_helpers.tpl b/charts/spire/charts/tornjak-frontend/templates/_helpers.tpl index fd7a92b..535df2b 100644 --- a/charts/spire/charts/tornjak-frontend/templates/_helpers.tpl +++ b/charts/spire/charts/tornjak-frontend/templates/_helpers.tpl @@ -84,3 +84,13 @@ Create URL for accessing Tornjak APIs {{- print "http://localhost:" .Values.service.port }} {{- end }} {{- end }} + +{{- define "tornjak-frontend.workingDir" }} +{{- if .Values.workingDir }} +{{- .Values.workingDir }} +{{- else if (dig "openshift" false .Values.global) }} +{{- printf "/opt/app-root/src" }} +{{- else }} +{{- printf "/usr/src/app" }} +{{- end }} +{{- end }} diff --git a/charts/spire/charts/tornjak-frontend/templates/deployment.yaml b/charts/spire/charts/tornjak-frontend/templates/deployment.yaml index 5cc188a..79fe5dd 100644 --- a/charts/spire/charts/tornjak-frontend/templates/deployment.yaml +++ b/charts/spire/charts/tornjak-frontend/templates/deployment.yaml @@ -53,9 +53,9 @@ spec: {{- end }} volumeMounts: - name: cache - mountPath: {{ .Values.workingDir }}/node_modules/.cache + mountPath: {{ include "tornjak-frontend.workingDir" . }}/node_modules/.cache - name: env - mountPath: {{ .Values.workingDir }}/build/tmp + mountPath: {{ include "tornjak-frontend.workingDir" . }}/build/tmp - name: logs mountPath: /opt/app-root/src/.npm/ {{- with .Values.nodeSelector }} diff --git a/charts/spire/charts/tornjak-frontend/values.yaml b/charts/spire/charts/tornjak-frontend/values.yaml index e5220e4..9c6eb22 100644 --- a/charts/spire/charts/tornjak-frontend/values.yaml +++ b/charts/spire/charts/tornjak-frontend/values.yaml @@ -113,8 +113,8 @@ startupProbe: failureThreshold: 6 successThreshold: 1 -## @param workingDir Path containing the Tornjak frontend within the image -workingDir: /usr/src/app +## @param workingDir Set to override the default path containing the Tornjak frontend within the image +workingDir: "" ## @param ingress.enabled Flag to enable ingress for Tornjak frontend service ## @param ingress.className Ingress class name for Tornjak frontend service diff --git a/examples/openshift/openshift-values.yaml b/examples/openshift/openshift-values.yaml index cef5b03..44efaca 100644 --- a/examples/openshift/openshift-values.yaml +++ b/examples/openshift/openshift-values.yaml @@ -50,7 +50,6 @@ spiffe-oidc-discovery-provider: fsGroup: null tornjak-frontend: - workingDir: /opt/app-root/src podSecurityContext: runAsUser: null runAsGroup: null