From 2540eda0c6fd96147afe5c4d1bdc21a56a50ed0f Mon Sep 17 00:00:00 2001 From: Denan Musinovic Date: Mon, 19 Feb 2024 14:45:01 +0100 Subject: [PATCH] adding facade app --- charts/facade/.helmignore | 23 +++++ charts/facade/Chart.yaml | 28 ++++++ charts/facade/templates/deployment.yaml | 109 ++++++++++++++++++++++++ charts/facade/templates/ingress.yaml | 29 +++++++ charts/facade/templates/service.yaml | 13 +++ charts/facade/values.yaml | 4 + 6 files changed, 206 insertions(+) create mode 100644 charts/facade/.helmignore create mode 100644 charts/facade/Chart.yaml create mode 100644 charts/facade/templates/deployment.yaml create mode 100644 charts/facade/templates/ingress.yaml create mode 100644 charts/facade/templates/service.yaml create mode 100644 charts/facade/values.yaml diff --git a/charts/facade/.helmignore b/charts/facade/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/facade/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/facade/Chart.yaml b/charts/facade/Chart.yaml new file mode 100644 index 0000000..4cb7463 --- /dev/null +++ b/charts/facade/Chart.yaml @@ -0,0 +1,28 @@ +apiVersion: v2 +name: facade +description: A Helm chart for Kubernetes + + IMPORTANT! For some reason you have to wait 4 minutes after deployment for app to work properly and load all containers. + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +keywords: +- facade +version: 1.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.0.0" diff --git a/charts/facade/templates/deployment.yaml b/charts/facade/templates/deployment.yaml new file mode 100644 index 0000000..5c6a97d --- /dev/null +++ b/charts/facade/templates/deployment.yaml @@ -0,0 +1,109 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + selector: + matchLabels: + app: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/instance: {{ .Release.Name }} + app: {{ .Release.Name }} + spec: + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "base" + - "jsp" + - "php" + + restartPolicy: Always + containers: + - name: {{ .Chart.Name }} + image: brightsec/vulnerableapp-facade:k8s + imagePullPolicy: Always + ports: + - containerPort: 8000 + resources: + requests: + cpu: 25m + memory: 128Mi + limits: + cpu: 100m + memory: 256Mi + livenessProbe: + httpGet: + path: / + port: 8000 + scheme: HTTP + initialDelaySeconds: 120 + periodSeconds: 30 + + - name: base + image: sasanlabs/owasp-vulnerableapp:unreleased + imagePullPolicy: Always + ports: + - containerPort: 9090 + resources: + requests: + cpu: 25m + memory: 128Mi + limits: + cpu: 100m + memory: 256Mi + # livenessProbe: + # httpGet: + # path: / + # port: 9090 + # scheme: HTTP + # initialDelaySeconds: 120 + # periodSeconds: 30 + + - name: jsp + image: sasanlabs/owasp-vulnerableapp-jsp:latest + imagePullPolicy: Always + ports: + - containerPort: 8080 + resources: + requests: + cpu: 25m + memory: 128Mi + limits: + cpu: 100m + memory: 256Mi + livenessProbe: + httpGet: + path: / + port: 8080 + scheme: HTTP + initialDelaySeconds: 120 + periodSeconds: 30 + + - name: php + image: sasanlabs/owasp-vulnerableapp-php:latest + imagePullPolicy: Always + ports: + - containerPort: 80 + resources: + requests: + cpu: 25m + memory: 128Mi + limits: + cpu: 100m + memory: 256Mi + livenessProbe: + httpGet: + path: / + port: 80 + scheme: HTTP + initialDelaySeconds: 120 + periodSeconds: 30 + diff --git a/charts/facade/templates/ingress.yaml b/charts/facade/templates/ingress.yaml new file mode 100644 index 0000000..0967650 --- /dev/null +++ b/charts/facade/templates/ingress.yaml @@ -0,0 +1,29 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/proxy-ssl-protocols: "TLSv1.1 TLSv1.2" + nginx.ingress.kubernetes.io/ssl-redirect: "false" + {{ if eq .Values.ingress.cert "" }} + cert-manager.io/cluster-issuer: letsencrypt-cf-prod + {{ end }} +spec: + tls: + - hosts: + - {{ .Values.ingress.url }} + secretName: {{ if eq .Values.ingress.cert "" }}distributorwildcard{{ else }}{{ .Values.ingress.cert }}{{ end }} + rules: + - host: {{ .Values.ingress.url }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }} + port: + number: 8000 diff --git a/charts/facade/templates/service.yaml b/charts/facade/templates/service.yaml new file mode 100644 index 0000000..7061937 --- /dev/null +++ b/charts/facade/templates/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} +spec: + ports: + - name: http + port: 8000 + targetPort: 8000 + selector: + app.kubernetes.io/instance: {{ .Release.Name }} + app: {{ .Release.Name }} diff --git a/charts/facade/values.yaml b/charts/facade/values.yaml new file mode 100644 index 0000000..02f27a6 --- /dev/null +++ b/charts/facade/values.yaml @@ -0,0 +1,4 @@ +ingress: + url: dev.vuln.nexploit.app + cert: "" + authlevel: "."