Skip to content

Commit ee8c815

Browse files
authored
chore: Allow setting up e2e environment in-cluster (#518)
Signed-off-by: jannfis <[email protected]>
1 parent 086a093 commit ee8c815

File tree

4 files changed

+30
-40
lines changed

4 files changed

+30
-40
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,14 @@ build: argocd-agent cli
4848
.PHONY: setup-e2e
4949
setup-e2e: cli
5050
./hack/dev-env/setup-vcluster-env.sh create
51+
ifneq (${ARGOCD_AGENT_IN_CLUSTER},)
52+
./hack/dev-env/deploy.sh deploy
53+
endif
5154
./hack/dev-env/gen-creds.sh
5255
./hack/dev-env/create-agent-config.sh
56+
ifneq (${ARGOCD_AGENT_IN_CLUSTER},)
57+
./hack/dev-env/restart-all.sh
58+
endif
5359

5460
.PHONY: teardown-e2e
5561
teardown-e2e:

hack/dev-env/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
# Copyright 2025 The argocd-agent Authors
44
#

hack/dev-env/restart-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -eo pipefail
44

hack/dev-env/setup-vcluster-env.sh

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -69,41 +69,25 @@ check_for_openshift() {
6969

7070
# wait_for_pods looks all Pods running in k8s context $1, and keeps waiting until running count == $2.
7171
wait_for_pods() {
72-
73-
set +e
74-
75-
count=0
76-
while [ true ]
77-
do
78-
79-
echo " -> Waiting for $1 pods to be running. Expecting $2 running pods."
80-
81-
kubectl get pods --context="$1" -A
82-
RUNNING_PODS=`kubectl get pods --context="$1" -A | grep "Running" | wc -l | tr -d '[:space:]'`
83-
84-
if [[ "$RUNNING_PODS" == "$2" ]]; then
85-
break
86-
fi
87-
88-
count=$((count+1))
89-
if [[ $count -eq 60 ]]; then
90-
echo " -> Timed out waiting for pods to be running."
91-
echo " -> Pods:"
92-
kubectl describe pods --context="$1" -n argocd
93-
echo " -> Deployments:"
94-
kubectl describe deployments --context="$1" -n argocd
95-
echo " -> Stateful Sets:"
96-
kubectl describe statefulsets --context="$1" -n argocd
97-
echo " -> Exiting due to timeout waiting for pods to be running."
98-
exit 1
99-
fi
100-
101-
sleep 10
102-
done
103-
104-
echo " -> Done waiting for $1 pods."
105-
106-
set -e
72+
context="$1"
73+
component="$2"
74+
case "$component" in
75+
"principal")
76+
kubectl --context $context -n argocd rollout status --watch deployments argocd-server
77+
kubectl --context $context -n argocd rollout status --watch deployments argocd-repo-server
78+
kubectl --context $context -n argocd rollout status --watch deployments argocd-dex-server
79+
kubectl --context $context -n argocd rollout status --watch deployments argocd-redis
80+
;;
81+
"agent")
82+
kubectl --context $context -n argocd rollout status --watch statefulsets argocd-application-controller
83+
kubectl --context $context -n argocd rollout status --watch deployments argocd-repo-server
84+
kubectl --context $context -n argocd rollout status --watch deployments argocd-redis
85+
;;
86+
*)
87+
echo "Unknown component: $component"
88+
exit 1
89+
;;
90+
esac
10791
}
10892

10993

@@ -245,9 +229,9 @@ apply() {
245229
kubectl --context vcluster-agent-managed create ns agent-managed || true
246230

247231
echo "-> Waiting for all the Argo CD/vCluster pods to be running on vclusters"
248-
wait_for_pods vcluster-control-plane 5
249-
wait_for_pods vcluster-agent-autonomous 4
250-
wait_for_pods vcluster-agent-managed 4
232+
wait_for_pods vcluster-control-plane principal
233+
wait_for_pods vcluster-agent-autonomous agent
234+
wait_for_pods vcluster-agent-managed agent
251235

252236
echo "-> Service configuration on control plane"
253237
kubectl --context vcluster-control-plane -n argocd get services

0 commit comments

Comments
 (0)