Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support and specific values file for waf deployment #23

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: magento
apiVersion: v2
appVersion: 2.4.6
version: 2.7.0
version: 2.8.0
description: Magento chart to deploy the application including services.
type: application
keywords:
Expand Down
11 changes: 11 additions & 0 deletions templates/modsecurity-crs-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if and .Values.waf .Values.waf.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.waf.name | default "modsecurity-crs" }}
data:
{{- range $key, $value := .Values.waf.config }}
{{ $key }}: |-
{{ $value | indent 4 }}
{{- end }}
{{- end -}}
45 changes: 45 additions & 0 deletions templates/modsecurity-crs-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{- if and .Values.waf .Values.waf.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.waf.name | default "modsecurity-crs" }}
annotations: {{ toYaml .Values.waf.annotations | nindent 4 }}
labels: {{ toYaml .Values.waf.labels | nindent 4 }}
spec:
replicas: {{ .Values.waf.replicas | default 1 }}
selector:
matchLabels:
app: modsecurity-crs
template:
metadata:
labels:
app: modsecurity-crs
spec:
containers:
- name: modsecurity-crs
image: {{ .Values.waf.image.repository }}:{{ .Values.waf.image.tag }}
imagePullPolicy: {{ .Values.waf.image.pullPolicy | default "Always" }}
resources: {{ toYaml .Values.waf.resources | nindent 12 }}
readinessProbe: {{ toYaml .Values.waf.readinessProbe | nindent 12 }}
livenessProbe: {{ toYaml .Values.waf.livenessProbe | nindent 12 }}
startupProbe: {{ toYaml .Values.waf.startupProbe | nindent 12 }}
ports:
- containerPort: 8080
name: http
env:
- name: PORT
value: "8080"
{{ toYaml .Values.waf.env | nindent 12 }}

volumeMounts:
- name: modsecurity-configmap
mountPath: /docker-entrypoint.d/999-phoenix-proxy-behaviour.sh
subPath: entrypoint.sh

volumes:
- name: modsecurity-configmap
configMap:
name: {{ .Values.waf.name | default "modsecurity-crs" }}
defaultMode: 0777
dnsPolicy: ClusterFirst
{{- end -}}
15 changes: 15 additions & 0 deletions templates/modsecurity-crs-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if and .Values.waf .Values.waf.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.waf.name | default "modsecurity-crs" }}
spec:
type: ClusterIP
clusterIP: None
selector:
app: modsecurity-crs
ports:
- name: http
port: 8080
targetPort: http
{{- end -}}
38 changes: 38 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,44 @@
fallbackImage:
httpCode: 404

waf:
enabled: false
#replicas: 1

Check failure on line 848 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

848:4 [comments] missing starting space in comment
#annotations: {}

Check failure on line 849 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

849:4 [comments] missing starting space in comment
#labels: {}

Check failure on line 850 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

850:4 [comments] missing starting space in comment
#image:

Check failure on line 851 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

851:4 [comments] missing starting space in comment
# repository: owasp/modsecurity-crs:nginx-alpine
# tag: 4.9.0-nginx-alpine-202412020312
# pullPolicy: Always
#env:

Check failure on line 855 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

855:4 [comments] missing starting space in comment
# # see more configuration options here: https://github.com/coreruleset/modsecurity-crs-docker/blob/main/README.md
# # keep in mind that this is a nginx image...
# - name: BACKEND
# value: "http://magento.${NAMESPACE}.svc.cluster.local:80" # Forward traffic to magento
#resources:

Check failure on line 860 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

860:4 [comments] missing starting space in comment
# requests:
# memory: 512Mi
# cpu: 300m

Check failure on line 864 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

864:1 [trailing-spaces] trailing spaces
#readinessProbe:

Check failure on line 865 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

865:4 [comments] missing starting space in comment
# httpGet:
# path: /healthz
# port: 8080
# # if the probe fails 2 times within 10 secondary, the pod is considered as "not ready"
# periodSeconds: 5
# timeoutSeconds: 1
# successThreshold: 2
# failureThreshold: 2

#livenessProbe:

Check failure on line 875 in values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

875:4 [comments] missing starting space in comment
# httpGet:
# path: /healthz
# port: 8080
# # if the probe fails 3 times within 30 seconds, the pod will get restarted
# periodSeconds: 10
# timeoutSeconds: 1
# failureThreshold: 3


persistence:
enabled: true
Expand Down
Loading
Loading