From 78c67915d9a22249bdb88041f5f23441f822488e Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 12 Feb 2025 10:09:13 +0100 Subject: [PATCH] First commit --- files/default.vcl | 6 ++++++ kustomization.yaml | 11 +++++++++++ resources/deployment.yaml | 40 +++++++++++++++++++++++++++++++++++++++ resources/svc.yaml | 11 +++++++++++ 4 files changed, 68 insertions(+) create mode 100644 files/default.vcl create mode 100644 kustomization.yaml create mode 100644 resources/deployment.yaml create mode 100644 resources/svc.yaml diff --git a/files/default.vcl b/files/default.vcl new file mode 100644 index 0000000..1cb8790 --- /dev/null +++ b/files/default.vcl @@ -0,0 +1,6 @@ +vcl 4.0; + +backend default { + .host = "127.0.0.1"; + .port = "8080"; +} \ No newline at end of file diff --git a/kustomization.yaml b/kustomization.yaml new file mode 100644 index 0000000..35b444f --- /dev/null +++ b/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- resources/deployment.yaml +- resources/svc.yaml + +configMapGenerator: +- name: varnish-config + files: + - files/default.vcl diff --git a/resources/deployment.yaml b/resources/deployment.yaml new file mode 100644 index 0000000..0325f77 --- /dev/null +++ b/resources/deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: varnish + labels: + app: varnish +spec: + replicas: 1 + selector: + matchLabels: + app: varnish + template: + metadata: + labels: + app: varnish + spec: + containers: + - name: varnish + image: reg.cadoles.com/dh/library/varnish:7.6.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + volumeMounts: + - mountPath: /etc/varnish/default.vcl + name: varnish-config + subPath: default.vcl + securityContext: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + volumes: + - name: varnish-config + configMap: + name: varnish-config + items: + - key: default.vcl + path: default.vcl + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + runAsNonRoot: true diff --git a/resources/svc.yaml b/resources/svc.yaml new file mode 100644 index 0000000..667231f --- /dev/null +++ b/resources/svc.yaml @@ -0,0 +1,11 @@ +kind: Service +apiVersion: v1 +metadata: + name: varnish +spec: + selector: + app: varnish + ports: + - protocol: TCP + port: 80 + targetPort: 8080