|
1 | 1 | package:
|
2 | 2 | name: gatekeeper-3.18
|
3 | 3 | version: "3.18.3"
|
4 |
| - epoch: 1 |
| 4 | + epoch: 2 |
5 | 5 | description: Gatekeeper - Policy Controller for Kubernetes
|
6 | 6 | copyright:
|
7 | 7 | - license: Apache-2.0
|
@@ -109,7 +109,70 @@ update:
|
109 | 109 | tag-filter: v3.18.
|
110 | 110 |
|
111 | 111 | test:
|
| 112 | + environment: |
| 113 | + contents: |
| 114 | + packages: |
| 115 | + - ${{package.name}}-gator |
| 116 | + - openssl |
| 117 | + - curl |
| 118 | + - kubectl |
112 | 119 | pipeline:
|
113 | 120 | # AUTOGENERATED
|
114 | 121 | - runs: |
|
115 | 122 | manager --help
|
| 123 | + gator --version | grep -q v"${{package.version}}" |
| 124 | + - name: gator verify constraint |
| 125 | + uses: test/daemon-check-output |
| 126 | + with: |
| 127 | + setup: | |
| 128 | + cat > constraint.yaml <<EOF |
| 129 | + apiVersion: constraints.gatekeeper.sh/v1beta1 |
| 130 | + kind: K8sRequiredLabels |
| 131 | + metadata: |
| 132 | + name: ns-must-have-gk |
| 133 | + spec: |
| 134 | + match: |
| 135 | + kinds: |
| 136 | + - apiGroups: [""] |
| 137 | + kinds: ["Namespace"] |
| 138 | + parameters: |
| 139 | + labels: ["gatekeeper"] |
| 140 | + EOF |
| 141 | + start: | |
| 142 | + gator verify constraint.yaml |
| 143 | + timeout: 10 |
| 144 | + expected_output: | |
| 145 | + PASS |
| 146 | + - uses: test/kwok/cluster |
| 147 | + - name: Run Gatekeeper manager in KWOK |
| 148 | + uses: test/daemon-check-output |
| 149 | + with: |
| 150 | + setup: | |
| 151 | + export KUBERNETES_SERVICE_HOST="127.0.0.1" |
| 152 | + export KUBERNETES_SERVICE_PORT="32764" |
| 153 | +
|
| 154 | + kubectl config view --minify --raw > /tmp/kwok-kubeconfig.yaml |
| 155 | + # Create dummy certificates in /tmp |
| 156 | + echo "Creating dummy certificates..." |
| 157 | + openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes -keyout /tmp/tls.key -out /tmp/tls.crt -subj "/CN=gatekeeper-webhook-service.gatekeeper-system.svc" |
| 158 | +
|
| 159 | + kubectl create ns gatekeeper-system |
| 160 | + kubectl -n gatekeeper-system create secret tls gatekeeper-webhook-server-cert --cert=/tmp/tls.crt --key=/tmp/tls.key |
| 161 | + start: | |
| 162 | + manager -operation=webhook -metrics-addr=:8080 -logtostderr -v=2 -cert-dir=/tmp -kubeconfig=/tmp/kwok-kubeconfig.yaml |
| 163 | + timeout: 30 |
| 164 | + expected_output: | |
| 165 | + setting up cert rotation |
| 166 | + starting manager |
| 167 | + Starting metrics server |
| 168 | + Starting workers |
| 169 | + post: | |
| 170 | + echo "Checking health endpoint:" |
| 171 | + HEALTH_OUTPUT=$(curl -sf http://localhost:9090/healthz) |
| 172 | + echo "$HEALTH_OUTPUT" |
| 173 | + if echo "$HEALTH_OUTPUT" | grep -i "ok" > /dev/null; then |
| 174 | + echo "Health endpoint check PASSED" |
| 175 | + else |
| 176 | + echo "Health endpoint check FAILED" |
| 177 | + exit 1 |
| 178 | + fi |
0 commit comments