Skip to content

Commit eb9e40c

Browse files
committed
Add version annotation to APIService to prevent race conditions during rolling upgrades
During kapp-controller rolling upgrades via `kapp deploy`, a race condition can occur where kapp reports success even though the APIService webhook is not ready yet. This happens because kapp doesn't detect any changes in the APIService resource and considers the deployment complete before the new APIService is fully operational. This change adds a version annotation to the APIService that gets updated with each release, ensuring kapp detects changes and properly waits for the APIService to be ready during rolling upgrades. Changes: - Add kapp-controller.carvel.dev/version annotation to APIService metadata - Update build script to replace version placeholder with actual release version - Follow same pattern as existing Deployment resource versioning Fixes race condition during kapp-controller upgrades where APIService readiness is not properly validated. Made-with: Cursor Signed-off-by: Marin Dzhigarov <m.dzhigarov@gmail.com> Made-with: Cursor
1 parent 32fc399 commit eb9e40c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

config/config/agg-api.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ apiVersion: apiregistration.k8s.io/v1
44
kind: APIService
55
metadata:
66
name: v1alpha1.data.packaging.carvel.dev
7+
annotations:
8+
kapp-controller.carvel.dev/version: v0.0.0
79
spec:
810
group: data.packaging.carvel.dev
911
groupPriorityMinimum: 100

hack/build-release.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export version="$(get_kappctrl_ver)"
1414
sed 's/v0.0.0/'"$version"'/' config/config/deployment.yml > tmp/deployment.yml
1515
mv tmp/deployment.yml config/config/deployment.yml
1616

17+
sed 's/v0.0.0/'"$version"'/' config/config/agg-api.yml > tmp/agg-api.yml
18+
mv tmp/agg-api.yml config/config/agg-api.yml
19+
1720
ytt -f config/config -f config/values-schema.yml -f config-release -v dev.version="$version" --data-values-env=KCTRL | kbld --imgpkg-lock-output .imgpkg/images.yml -f- > ./tmp/release.yml
1821

1922
# Update image url in kapp-controller package overlays

0 commit comments

Comments
 (0)