Skip to content

Commit ed3befc

Browse files
adjust init script and add chainsaw tests
1 parent 7ff15ff commit ed3befc

File tree

4 files changed

+43
-18
lines changed

4 files changed

+43
-18
lines changed

.e2e/chainsaw-tests.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: chainsaw.kyverno.io/v1alpha1
2+
kind: Test
3+
metadata:
4+
name: sm-with-ns-selector
5+
spec:
6+
steps:
7+
- try:
8+
- assert:
9+
resource:
10+
apiVersion: monitoring.coreos.com/v1
11+
kind: ServiceMonitor
12+
metadata:
13+
name: sm-with-ns-selector-x-default-x-vcluster
14+
namespace: default
15+
spec:
16+
namespaceSelector: {}
17+
selector:
18+
matchExpressions:
19+
- key: vcluster.loft.sh/namespace
20+
operator: In
21+
values:
22+
- my-virtual-namespace
23+
matchLabels:
24+
vcluster.loft.sh/label-vcluster-x-a172cedcae: example-app
File renamed without changes.

v1/.e2e/chainsaw-tests.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

v1/.e2e/scripts/init.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,29 @@
44
PLUGIN_IMAGE=$1
55
MYDIR=$(dirname $0)
66
ROOT_DIR=$MYDIR/../../
7-
RESOURCES_FILE=$MYDIR/../vcluster-resources.yaml
7+
RESOURCES_FILE=$MYDIR/../../../.e2e/vcluster-resources.yaml
88

99
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.70.0/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml
1010
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.70.0/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml
1111
helm upgrade --install --repo https://charts.loft.sh vcluster vcluster --version 0.16.4 --values $MYDIR/vcluster-values.yaml --values $ROOT_DIR/plugin.yaml --set plugin.prometheus-operator-resources.image=$PLUGIN_IMAGE --wait
1212

13-
sleep 120 # Give time for for CRDs to sync
13+
vcluster connect vcluster -n default -- kubectl get servicemonitor && vcluster connect vcluster -n default -- kubectl get podmonitor
14+
15+
res=$?
16+
secondsWaited=0
17+
timeout=300
18+
19+
while [ $res -ne 0 ] && [ $secondsWaited -lt $timeout ]; do
20+
echo "Waiting for CRDs to get created, sleep for 30 seconds..."
21+
sleep 30
22+
secondsWaited=$((secondsWaited + 30))
23+
vcluster connect vcluster -n default -- kubectl get servicemonitorr && vcluster connect vcluster -n default -- kubectl get podmonitor
24+
res=$?
25+
done
26+
27+
if [ $res -ne 0 ]; then
28+
echo "Timed out waiting for CRDs to get created in vcluster"
29+
exit 1
30+
fi
1431

1532
cat $RESOURCES_FILE | vcluster connect vcluster -n default -- kubectl -n default apply -f -

0 commit comments

Comments
 (0)