ci: pre-create kargo-controller SA with Helm labels, fix JSON pod annotations, remove --wait from woodpecker helm
This commit is contained in:
+22
-4
@@ -88,7 +88,7 @@ if [ "${WOODPECKER_EXISTS:-0}" -gt 0 ]; then
|
|||||||
helm upgrade woodpecker oci://ghcr.io/woodpecker-ci/helm/woodpecker \
|
helm upgrade woodpecker oci://ghcr.io/woodpecker-ci/helm/woodpecker \
|
||||||
--namespace woodpecker \
|
--namespace woodpecker \
|
||||||
--values woodpecker/values.yaml \
|
--values woodpecker/values.yaml \
|
||||||
--wait --timeout 5m
|
--timeout 5m
|
||||||
else
|
else
|
||||||
echo " Fresh Woodpecker install..."
|
echo " Fresh Woodpecker install..."
|
||||||
# Delete stale OAuth2 app in Gitea (if any)
|
# Delete stale OAuth2 app in Gitea (if any)
|
||||||
@@ -116,9 +116,15 @@ for app in json.loads(sys.stdin.read()):
|
|||||||
--values woodpecker/values.yaml \
|
--values woodpecker/values.yaml \
|
||||||
--set server.env.WOODPECKER_GITEA_CLIENT="${GITEA_CLIENT_ID}" \
|
--set server.env.WOODPECKER_GITEA_CLIENT="${GITEA_CLIENT_ID}" \
|
||||||
--set server.env.WOODPECKER_GITEA_SECRET="${GITEA_CLIENT_SECRET}" \
|
--set server.env.WOODPECKER_GITEA_SECRET="${GITEA_CLIENT_SECRET}" \
|
||||||
--wait --timeout 5m
|
--timeout 5m
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Wait for server to be ready (don't use --wait, agents may take longer)
|
||||||
|
echo " Waiting for Woodpecker server..."
|
||||||
|
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=server -n woodpecker --timeout=120s > /dev/null 2>&1 || true
|
||||||
|
echo " Waiting for Woodpecker agents..."
|
||||||
|
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=agent -n woodpecker --timeout=120s > /dev/null 2>&1 || true
|
||||||
|
|
||||||
# Apply agent RBAC (grants cluster-admin to default + woodpecker-agent SAs)
|
# Apply agent RBAC (grants cluster-admin to default + woodpecker-agent SAs)
|
||||||
kubectl apply -f woodpecker/agent-rbac.yaml
|
kubectl apply -f woodpecker/agent-rbac.yaml
|
||||||
echo " ✓ Woodpecker CI installed + RBAC applied"
|
echo " ✓ Woodpecker CI installed + RBAC applied"
|
||||||
@@ -199,12 +205,24 @@ if [ "${KARGO_EXISTS:-0}" -eq 0 ]; then
|
|||||||
kubectl delete role --all -n kargo --ignore-not-found --timeout=10s > /dev/null 2>&1 || true
|
kubectl delete role --all -n kargo --ignore-not-found --timeout=10s > /dev/null 2>&1 || true
|
||||||
kubectl delete rolebinding --all -n kargo --ignore-not-found --timeout=10s > /dev/null 2>&1 || true
|
kubectl delete rolebinding --all -n kargo --ignore-not-found --timeout=10s > /dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
# Kargo chart bug: controller deployment references SA 'kargo-controller' but chart doesn't create it
|
||||||
|
# Pre-create with Helm labels so it doesn't conflict with the chart
|
||||||
|
kubectl apply -f - <<'SAEOF'
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: kargo-controller
|
||||||
|
namespace: kargo
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
annotations:
|
||||||
|
meta.helm.sh/release-name: kargo
|
||||||
|
meta.helm.sh/release-namespace: kargo
|
||||||
|
SAEOF
|
||||||
helm upgrade --install kargo oci://ghcr.io/akuity/kargo-charts/kargo \
|
helm upgrade --install kargo oci://ghcr.io/akuity/kargo-charts/kargo \
|
||||||
--namespace kargo \
|
--namespace kargo \
|
||||||
--values kargo/values.yaml \
|
--values kargo/values.yaml \
|
||||||
--timeout 5m || true
|
--timeout 5m || true
|
||||||
# Kargo chart bug: controller deployment references SA 'kargo-controller' but chart doesn't create it
|
|
||||||
kubectl create serviceaccount kargo-controller -n kargo 2>/dev/null || true
|
|
||||||
echo " Waiting for kargo-controller..."
|
echo " Waiting for kargo-controller..."
|
||||||
for i in $(seq 1 24); do
|
for i in $(seq 1 24); do
|
||||||
if kubectl get pods -n kargo -l app.kubernetes.io/component=controller -o jsonpath='{.items[0].status.containerStatuses[0].ready}' 2>/dev/null | grep -q true; then
|
if kubectl get pods -n kargo -l app.kubernetes.io/component=controller -o jsonpath='{.items[0].status.containerStatuses[0].ready}' 2>/dev/null | grep -q true; then
|
||||||
|
|||||||
@@ -60,5 +60,5 @@ agent:
|
|||||||
WOODPECKER_BACKEND_K8S_VOLUME_SIZE: 5Gi
|
WOODPECKER_BACKEND_K8S_VOLUME_SIZE: 5Gi
|
||||||
WOODPECKER_BACKEND_K8S_STORAGE_RWX: "false"
|
WOODPECKER_BACKEND_K8S_STORAGE_RWX: "false"
|
||||||
WOODPECKER_BACKEND_K8S_STORAGE_CLASS: local-path
|
WOODPECKER_BACKEND_K8S_STORAGE_CLASS: local-path
|
||||||
WOODPECKER_BACKEND_K8S_POD_ANNOTATIONS: "celestium.life/inject-ca:true"
|
WOODPECKER_BACKEND_K8S_POD_ANNOTATIONS: '{"celestium.life/inject-ca":"true"}'
|
||||||
WOODPECKER_MAX_WORKFLOWS: "16"
|
WOODPECKER_MAX_WORKFLOWS: "16"
|
||||||
|
|||||||
Reference in New Issue
Block a user