From b46dc07dbf5a50518876b391190819229fff398b Mon Sep 17 00:00:00 2001 From: Ultradesu Date: Mon, 20 Apr 2026 11:42:27 +0300 Subject: [PATCH] Fix zola restart --- k8s/apps/wedding/kustomization.yaml | 1 + k8s/apps/wedding/webhook.yaml | 71 +++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 k8s/apps/wedding/webhook.yaml diff --git a/k8s/apps/wedding/kustomization.yaml b/k8s/apps/wedding/kustomization.yaml index 12d7f42..2f429bc 100644 --- a/k8s/apps/wedding/kustomization.yaml +++ b/k8s/apps/wedding/kustomization.yaml @@ -7,3 +7,4 @@ resources: - deployment.yaml - service.yaml - ingress.yaml + - webhook.yaml diff --git a/k8s/apps/wedding/webhook.yaml b/k8s/apps/wedding/webhook.yaml new file mode 100644 index 0000000..49049f9 --- /dev/null +++ b/k8s/apps/wedding/webhook.yaml @@ -0,0 +1,71 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: webhook-script +data: + serve.sh: | + #!/bin/sh + echo "Webhook server listening on :8080" + while true; do + echo -e "HTTP/1.1 200 OK\r\nContent-Length: 2\r\nConnection: close\r\n\r\nok" \ + | nc -l -p 8080 > /dev/null + echo "Received webhook, restarting deployment..." + kubectl rollout restart deployment/wedding + done + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wedding-webhook + labels: + app: wedding-webhook +spec: + replicas: 1 + selector: + matchLabels: + app: wedding-webhook + template: + metadata: + labels: + app: wedding-webhook + spec: + nodeSelector: + kubernetes.io/hostname: spb.tail2fe2d.ts.net + serviceAccountName: wedding-deployer + containers: + - name: webhook + image: alpine/k8s:1.32.3 + command: ["sh", "/scripts/serve.sh"] + ports: + - containerPort: 8080 + protocol: TCP + volumeMounts: + - name: script + mountPath: /scripts + readOnly: true + resources: + requests: + memory: 16Mi + cpu: 5m + limits: + memory: 32Mi + cpu: 50m + volumes: + - name: script + configMap: + name: webhook-script + +--- +apiVersion: v1 +kind: Service +metadata: + name: wedding-webhook +spec: + selector: + app: wedding-webhook + ports: + - port: 8080 + targetPort: 8080 + protocol: TCP