From e86470e141e97c878f899b6ea2a2459b7ead6a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Zubcevic?= Date: Thu, 14 Apr 2022 12:01:37 +0200 Subject: [PATCH] refacrired --- .../webgoat/templates/configmap-wolf.yaml | 11 --- .../helm/webgoat/templates/configmap.yaml | 3 +- .../helm/webgoat/templates/deployment.yaml | 92 +++---------------- .../helm/webgoat/templates/route-goat.yml | 19 +++- .../helm/webgoat/templates/route-wolf.yml | 16 ---- .../helm/webgoat/templates/service.yaml | 10 +- platformQuickStarts/helm/webgoat/values.yaml | 7 +- 7 files changed, 37 insertions(+), 121 deletions(-) delete mode 100644 platformQuickStarts/helm/webgoat/templates/configmap-wolf.yaml delete mode 100644 platformQuickStarts/helm/webgoat/templates/route-wolf.yml diff --git a/platformQuickStarts/helm/webgoat/templates/configmap-wolf.yaml b/platformQuickStarts/helm/webgoat/templates/configmap-wolf.yaml deleted file mode 100644 index c3285cef3..000000000 --- a/platformQuickStarts/helm/webgoat/templates/configmap-wolf.yaml +++ /dev/null @@ -1,11 +0,0 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: {{ .Values.webwolf_server.name }}-configmap - namespace: {{ .Values.namespace }} - labels: - app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }} -data: - TZ: 'Europe/Amsterdam' - WEBGOAT_HOST: {{ .Values.webgoat_server.name }}-service - diff --git a/platformQuickStarts/helm/webgoat/templates/configmap.yaml b/platformQuickStarts/helm/webgoat/templates/configmap.yaml index 069984017..552a30af3 100644 --- a/platformQuickStarts/helm/webgoat/templates/configmap.yaml +++ b/platformQuickStarts/helm/webgoat/templates/configmap.yaml @@ -9,5 +9,6 @@ data: TZ: 'Europe/Amsterdam' EXCLUDE_CATEGORIES: 'CLIENT_SIDE' EXCLUDE_LESSONS: 'SqlInjectionAdvanced' - WEBWOLF_HOST: '{{ .Values.webwolf_server.name }}-wolf-{{ .Values.namespace }}{{ .Values.urlpostfix }}' + WEBWOLF_HOST: '{{ .Values.webgoat_server.name }}-wolf-{{ .Values.namespace }}{{ .Values.urlpostfix }}' WEBWOLF_PORT: '80' + WEBGOAT_HOST: {{ .Values.webgoat_server.name }}-service diff --git a/platformQuickStarts/helm/webgoat/templates/deployment.yaml b/platformQuickStarts/helm/webgoat/templates/deployment.yaml index 098c132f7..51cf319d4 100644 --- a/platformQuickStarts/helm/webgoat/templates/deployment.yaml +++ b/platformQuickStarts/helm/webgoat/templates/deployment.yaml @@ -22,15 +22,17 @@ spec: containers: - resources: limits: - memory: "2Gi" - cpu: "1" - requests: memory: "1Gi" - cpu: "0.5" + cpu: "500m" + requests: + memory: "200Mi" + cpu: "100m" name: webgoat ports: - containerPort: 8080 protocol: TCP + - containerPort: 9090 + protocol: TCP #livenessProbe: # failureThreshold: 3 # periodSeconds: 10 @@ -58,8 +60,13 @@ spec: "--add-opens","java.base/java.io=ALL-UNNAMED", "-Djava.io.tmpdir=/home/webgoat/.webgoat-{{ .Chart.AppVersion }}", "-Dfile.encoding=UTF-8", + "-Drunning.in.docker=true", + "-Dwebgoat.host=0.0.0.0", + "-Dwebwolf.landingpage.url=http://{{ .Values.webgoat_server.name }}-wolf-{{ .Values.namespace }}{{ .Values.urlpostfix }}/landing", + "-Dwebwolf.mail.url=http://{{ .Values.webgoat_server.name }}-wolf-{{ .Values.namespace }}{{ .Values.urlpostfix }}/mail", "-jar","/home/webgoat/webgoat.jar", - "--server.address=0.0.0.0"] + "--server.address=0.0.0.0" + ] imagePullPolicy: Always volumeMounts: - name: webgoat-volume-1 @@ -82,78 +89,3 @@ spec: maxSurge: 25% revisionHistoryLimit: 10 progressDeadlineSeconds: 600 ---- -kind: Deployment -apiVersion: apps/v1 -metadata: - labels: - app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }} - name: {{ .Values.webwolf_server.name }} - namespace: {{ .Values.namespace }} -spec: - replicas: 1 - selector: - matchLabels: - app: {{ .Values.webwolf_server.name }} - template: - metadata: - labels: - app: {{ .Values.webwolf_server.name }} - spec: - volumes: - - name: webgoat-volume-1 - persistentVolumeClaim: - claimName: {{ .Values.webgoat_server.name }}-pvc - containers: - - resources: - limits: - memory: "2Gi" - cpu: "1" - requests: - memory: "1Gi" - cpu: "0.5" - name: webwolf - ports: - - containerPort: 9090 - protocol: TCP - #livenessProbe: - # failureThreshold: 3 - # periodSeconds: 10 - # httpGet: - # path: /WebWolf - # port: 9090 - #readinessProbe: - #failureThreshold: 3 - #periodSeconds: 10 - #initialDelaySeconds: 100 - #httpGet: - # path: /WebWolf - # port: 9090 - image: {{ .Values.webwolf_server.image }} - command: - - 'java' - args: ["-Duser.home=/home/webgoat", - "-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-{{ .Chart.AppVersion }} - terminationMessagePolicy: File - envFrom: - - configMapRef: - name: {{ .Values.webwolf_server.name }}-configmap - restartPolicy: Always - terminationGracePeriodSeconds: 30 - dnsPolicy: ClusterFirst - securityContext: {} - schedulerName: default-scheduler - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 25% - maxSurge: 25% - revisionHistoryLimit: 10 - progressDeadlineSeconds: 600 diff --git a/platformQuickStarts/helm/webgoat/templates/route-goat.yml b/platformQuickStarts/helm/webgoat/templates/route-goat.yml index 75cf2ade9..e9cdcccd6 100644 --- a/platformQuickStarts/helm/webgoat/templates/route-goat.yml +++ b/platformQuickStarts/helm/webgoat/templates/route-goat.yml @@ -16,4 +16,21 @@ spec: kind: Service name: {{ .Values.webgoat_server.name }}-service weight: 100 - wildcardPolicy: None \ No newline at end of file + wildcardPolicy: None +--- + apiVersion: route.openshift.io/v1 +kind: Route +metadata: + labels: + app: {{ .Values.webgoat_server.name }} + name: {{ .Values.webgoat_server.name }}-wolf + namespace: {{ .Values.namespace }} +spec: + path: / + port: + targetPort: 9090 + to: + kind: Service + name: {{ .Values.webgoat_server.name }}-wolfservice + weight: 100 + wildcardPolicy: None diff --git a/platformQuickStarts/helm/webgoat/templates/route-wolf.yml b/platformQuickStarts/helm/webgoat/templates/route-wolf.yml deleted file mode 100644 index d9aec3952..000000000 --- a/platformQuickStarts/helm/webgoat/templates/route-wolf.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: route.openshift.io/v1 -kind: Route -metadata: - labels: - app: {{ .Values.webwolf_server.name }} - name: {{ .Values.webwolf_server.name }}-wolf - namespace: {{ .Values.namespace }} -spec: - path: / - port: - targetPort: 9090 - to: - kind: Service - name: {{ .Values.webwolf_server.name }}-service - weight: 100 - wildcardPolicy: None diff --git a/platformQuickStarts/helm/webgoat/templates/service.yaml b/platformQuickStarts/helm/webgoat/templates/service.yaml index dab0819f6..4635bbd91 100644 --- a/platformQuickStarts/helm/webgoat/templates/service.yaml +++ b/platformQuickStarts/helm/webgoat/templates/service.yaml @@ -12,10 +12,6 @@ spec: port: 8080 protocol: TCP targetPort: 8080 - - name: 9001-tcp - port: 9001 - protocol: TCP - targetPort: 9001 selector: app: {{ .Values.webgoat_server.name }} sessionAffinity: None @@ -24,9 +20,9 @@ apiVersion: v1 kind: Service metadata: labels: - app: {{ .Values.webwolf_server.name }} + app: {{ .Values.webgoat_server.name }} app.kubernetes.io/part-of: {{ .Values.webgoat_server.name }} - name: {{ .Values.webwolf_server.name }}-service + name: {{ .Values.webgoat_server.name }}-wolfservice namespace: {{ .Values.namespace }} spec: ports: @@ -35,5 +31,5 @@ spec: protocol: TCP targetPort: 9090 selector: - app: {{ .Values.webwolf_server.name }} + app: {{ .Values.webgoat_server.name }} sessionAffinity: None diff --git a/platformQuickStarts/helm/webgoat/values.yaml b/platformQuickStarts/helm/webgoat/values.yaml index d6adbca72..98586069d 100644 --- a/platformQuickStarts/helm/webgoat/values.yaml +++ b/platformQuickStarts/helm/webgoat/values.yaml @@ -4,11 +4,8 @@ accessMode: ReadWriteMany webgoat_server: name: webgoat-1 - image: docker.io/webgoat/goatandwolf:openshift + image: docker.io/webgoat/webgoat:latest webwolf_server: name: webwolf-1 - image: docker.io/webgoat/goatandwolf:openshift - - - + image: docker.io/webgoat/webgoat:latest