From ee31633822131a8b667eacfdc8c5a8465702d35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Zubcevic?= Date: Thu, 23 Dec 2021 17:07:23 +0100 Subject: [PATCH] paramterized additional things and tested on developer sandbox --- platformQuickStarts/helm/Readme.md | 11 +++++++++++ platformQuickStarts/helm/webgoat/Chart.yaml | 2 +- .../helm/webgoat/templates/configmap.yaml | 2 +- .../helm/webgoat/templates/deployment.yaml | 8 ++++---- .../helm/webgoat/templates/persistent-storage-claim | 2 +- platformQuickStarts/helm/webgoat/values.yaml | 5 +++++ 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/platformQuickStarts/helm/Readme.md b/platformQuickStarts/helm/Readme.md index 4dabb89b5..1f2339a24 100644 --- a/platformQuickStarts/helm/Readme.md +++ b/platformQuickStarts/helm/Readme.md @@ -5,6 +5,9 @@ This helm chart can be used on a OpenShift Code Ready Container environment or a With the OpenShift CRC (Code Ready Container) cluster you run an entire environment on your local machine. (> 4 vCPU, >8GB mem) See the Red Hat documentation for general understanding of OpenShift. Make sure helm is installed as well. + +https://developers.redhat.com/developer-sandbox + ## CRC commands crc config set cpus 6 @@ -22,6 +25,14 @@ The example without modification uses *demo-project* as the project/namespace fo helm install goat1 ./webgoat +## Helm install on single node Developer Sandbox (cloud) + + oc login --token=sha256~phDWy6Wm_oJQW6kmOHEbLkRdDIXU6b70hRVmdSYWolM --server=https://api.sandbox-m2.rz9k.p1.openshiftapps.com:6443 + helm install --set namespace=renezubcevic-dev --set accessMode=ReadWriteOnce --set urlpostfix=.apps.sandbox-m2.rz9k.p1.openshiftapps.com goat1 ./webgoat + +A code ready container looks the same for all developers on their local machine, but a developer sandbox requires other credentials from your account in the cloud and different namespace and urlpostfix and also a different access mode for the persistent storage. +Of course the token here is a fake. + ## uninstall helm uninstall goat1 diff --git a/platformQuickStarts/helm/webgoat/Chart.yaml b/platformQuickStarts/helm/webgoat/Chart.yaml index c2fb4b327..5c633f2f1 100644 --- a/platformQuickStarts/helm/webgoat/Chart.yaml +++ b/platformQuickStarts/helm/webgoat/Chart.yaml @@ -6,4 +6,4 @@ type: application version: 0.1.0 -appVersion: "openshift" \ No newline at end of file +appVersion: "8.2.3-SNAPSHOT" diff --git a/platformQuickStarts/helm/webgoat/templates/configmap.yaml b/platformQuickStarts/helm/webgoat/templates/configmap.yaml index 635028e95..069984017 100644 --- a/platformQuickStarts/helm/webgoat/templates/configmap.yaml +++ b/platformQuickStarts/helm/webgoat/templates/configmap.yaml @@ -9,5 +9,5 @@ data: TZ: 'Europe/Amsterdam' EXCLUDE_CATEGORIES: 'CLIENT_SIDE' EXCLUDE_LESSONS: 'SqlInjectionAdvanced' - WEBWOLF_HOST: 'webwolf-1-wolf-demo-project.apps-crc.testing' + WEBWOLF_HOST: '{{ .Values.webwolf_server.name }}-wolf-{{ .Values.namespace }}{{ .Values.urlpostfix }}' WEBWOLF_PORT: '80' diff --git a/platformQuickStarts/helm/webgoat/templates/deployment.yaml b/platformQuickStarts/helm/webgoat/templates/deployment.yaml index f98822c03..098c132f7 100644 --- a/platformQuickStarts/helm/webgoat/templates/deployment.yaml +++ b/platformQuickStarts/helm/webgoat/templates/deployment.yaml @@ -56,14 +56,14 @@ spec: "--add-opens","java.desktop/java.awt.font=ALL-UNNAMED", "--add-opens","java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens","java.base/java.io=ALL-UNNAMED", - "-Djava.io.tmpdir=/home/webgoat/.webgoat-8.2.3-SNAPSHOT", + "-Djava.io.tmpdir=/home/webgoat/.webgoat-{{ .Chart.AppVersion }}", "-Dfile.encoding=UTF-8", "-jar","/home/webgoat/webgoat.jar", "--server.address=0.0.0.0"] imagePullPolicy: Always volumeMounts: - name: webgoat-volume-1 - mountPath: /home/webgoat/.webgoat-8.2.3-SNAPSHOT + mountPath: /home/webgoat/.webgoat-{{ .Chart.AppVersion }} terminationMessagePolicy: File envFrom: - configMapRef: @@ -133,14 +133,14 @@ spec: command: - 'java' args: ["-Duser.home=/home/webgoat", - "-Djava.io.tmpdir=/home/webgoat/.webgoat-8.2.3-SNAPSHOT", + "-Djava.io.tmpdir=/home/webgoat/.webgoat-{{ .Chart.AppVersion }}", "-Dfile.encoding=UTF-8", "-jar","/home/webgoat/webwolf.jar", "--server.address=0.0.0.0"] imagePullPolicy: Always volumeMounts: - name: webgoat-volume-1 - mountPath: /home/webgoat/.webgoat-8.2.3-SNAPSHOT + mountPath: /home/webgoat/.webgoat-{{ .Chart.AppVersion }} terminationMessagePolicy: File envFrom: - configMapRef: diff --git a/platformQuickStarts/helm/webgoat/templates/persistent-storage-claim b/platformQuickStarts/helm/webgoat/templates/persistent-storage-claim index 115d85205..fa1551b4f 100644 --- a/platformQuickStarts/helm/webgoat/templates/persistent-storage-claim +++ b/platformQuickStarts/helm/webgoat/templates/persistent-storage-claim @@ -5,7 +5,7 @@ metadata: namespace: '{{ .Values.namespace }}' spec: accessModes: - - ReadWriteMany + - '{{ .Values.accessMode }}' resources: requests: storage: 1Gi diff --git a/platformQuickStarts/helm/webgoat/values.yaml b/platformQuickStarts/helm/webgoat/values.yaml index fa9e07c3f..d6adbca72 100644 --- a/platformQuickStarts/helm/webgoat/values.yaml +++ b/platformQuickStarts/helm/webgoat/values.yaml @@ -1,4 +1,6 @@ namespace: demo-project +urlpostfix: .apps-crc.testing +accessMode: ReadWriteMany webgoat_server: name: webgoat-1 @@ -7,3 +9,6 @@ webgoat_server: webwolf_server: name: webwolf-1 image: docker.io/webgoat/goatandwolf:openshift + + +