fix(app): make app push idempotent using server-side apply#2904
Open
kwiatekus wants to merge 7 commits intokyma-project:mainfrom
Open
fix(app): make app push idempotent using server-side apply#2904kwiatekus wants to merge 7 commits intokyma-project:mainfrom
kwiatekus wants to merge 7 commits intokyma-project:mainfrom
Conversation
…e test coverage - Fix 1: Set Namespace field in buildDeployment's ObjectMeta so ApplyDeployment can correctly pass namespace to rootlessdynamic.Apply() - Fix 2: Set TypeMeta on deployment before ToUnstructured for consistency with CreateAPIRule pattern, instead of setting it after conversion - Fix 3: Enhance Test_ApplyDeployment to verify namespace propagation and image updates are correctly captured in applied objects
✅ Proposed changes verification passedThis pull request comes with up-to-date documentation and no illegal standard output usages. Find more detailed information in the |
musztardem
reviewed
May 8, 2026
| deployment := buildDeployment(&opts) | ||
| _, err := client.Static().AppsV1().Deployments(opts.Namespace).Create(ctx, deployment, metav1.CreateOptions{}) | ||
| return err | ||
| deployment.TypeMeta = metav1.TypeMeta{ |
Contributor
There was a problem hiding this comment.
We have the deployment definition built in the buildDeployment function starting from line 87, maybe let's move this TypeMeta there
musztardem
reviewed
May 8, 2026
| service := buildService(name, namespace, port) | ||
| _, err := client.Static().CoreV1().Services(namespace).Create(ctx, service, metav1.CreateOptions{}) | ||
| return err | ||
| service.TypeMeta = metav1.TypeMeta{ |
musztardem
requested changes
May 8, 2026
Contributor
musztardem
left a comment
There was a problem hiding this comment.
I'd adjust the deployment/service building functions, otherwise LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kyma app pushpreviously failed on rerun with "already exists" errors for Deployment and ServiceApplyDeploymentandApplyServicefunctions using Server-Side Apply (SSA) via the existingrootlessdynamic.Apply()infrastructure — the same pattern already used byCreateAPIRulepush.gonow calls the newApply*functions; existingCreate*functions are preserved for backward compatibilityChanges
internal/kube/resources/deployment.go— addApplyDeploymentinternal/kube/resources/service.go— addApplyServiceinternal/cmd/app/push.go— switch toApplyDeployment/ApplyService; update output messages from "Creating" to "Applying"Test plan
go test ./internal/kube/resources/... ./internal/cmd/app/...passeskyma app push --name my-app --image <image>twice against a cluster — second run should succeed without errorsRelated to
Fixes #2905
#2899
#2410