Skip to content

Commit 5ac5459

Browse files
improve cert-manager-webhook-pdns tests (#57526)
<!--- Provide a short summary in the Title above. Examples of good PR titles: * "ruby-3.1: new package" * "haproxy: fix CVE-2014-123456" --> <!-- Please include references to any related issues or delete this section otherwise. --> Fixes: Related: ### Pre-review Checklist <!-- This checklist is mostly useful as a reminder of small things that can easily be forgotten – it is meant as a helpful tool rather than hoops to jump through. At the moment of this PR you have the most information on what all the change will affect, so please take the time to jot it down. Put an `x` in all the items that apply, make notes next to any that haven't been addressed, and remove any items that are not relevant to this PR. --> #### For new package PRs only <!-- remove if unrelated --> - [ ] This PR is marked as fixing a pre-existing package request bug - [ ] Alternatively, the PR is marked as related to a pre-existing package request bug, such as a dependency - [x] REQUIRED - The package is available under an OSI-approved or FSF-approved license - [x] REQUIRED - The version of the package is still receiving security updates - [ ] This PR links to the upstream project's support policy (e.g. `endoflife.date`) Signed-off-by: Batuhan Apaydin <[email protected]>
1 parent 1391803 commit 5ac5459

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

cert-manager-webhook-pdns.yaml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package:
22
name: cert-manager-webhook-pdns
33
version: "2.5.2"
4-
epoch: 7
4+
epoch: 8
55
description: A PowerDNS webhook for cert-manager
66
copyright:
77
- license: MIT
@@ -38,11 +38,46 @@ update:
3838
ignore-regex-patterns:
3939
- 'cert-manager-webhook-pdns-'
4040

41-
# https://github.com/zachomedia/cert-manager-webhook-pdns/blob/bf4d525dca7345538aaad8840f6315a73c27f38b/README.md?plain=1#L45
4241
test:
4342
environment:
4443
environment:
4544
GROUP_NAME: "acme.zacharyseguin.ca"
45+
KUBERNETES_SERVICE_HOST: "127.0.0.1"
46+
KUBERNETES_SERVICE_PORT: 32764
47+
contents:
48+
packages:
49+
- mkcert
4650
pipeline:
51+
- uses: test/kwok/cluster
4752
- runs: |
48-
webhook -h
53+
# wait until you have a serviceaccount default
54+
while ! kubectl get serviceaccount default -n kube-system; do
55+
echo "Waiting for serviceaccount default in kube-system namespace..."
56+
sleep 1
57+
done
58+
mkdir -p /var/run/secrets/kubernetes.io/serviceaccount
59+
kubectl create token default > /var/run/secrets/kubernetes.io/serviceaccount/token
60+
CA=$(kubectl config view --raw -o jsonpath='{.clusters[0].cluster.certificate-authority}')
61+
cp $CA /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
62+
63+
kubectl create rolebinding default-get-configmap \
64+
--clusterrole=view \
65+
--serviceaccount=default:default \
66+
--namespace=kube-system
67+
68+
mkcert example.com
69+
export CA_OTHER="$(cat ~/.local/share/mkcert/rootCA.pem)"
70+
kubectl create configmap extension-apiserver-authentication \
71+
--from-literal=client-ca-file="$CA_OTHER" \
72+
--from-literal=requestheader-client-ca-file="$CA_OTHER" \
73+
-n kube-system \
74+
--dry-run=client -o yaml | kubectl apply -f -
75+
76+
webhook > /tmp/webhook.log 2>&1 &
77+
sleep 5
78+
if ! grep -q "Starting controller" /tmp/webhook.log; then
79+
echo "Webhook server did not start correctly"
80+
exit 1
81+
fi
82+
83+
echo "Webhook server started successfully"

0 commit comments

Comments
 (0)