Skip to content

fix(app): make app push idempotent using server-side apply#2904

Merged
kwiatekus merged 8 commits into
kyma-project:mainfrom
kwiatekus:patch-apply-kyma-app-push
May 12, 2026
Merged

fix(app): make app push idempotent using server-side apply#2904
kwiatekus merged 8 commits into
kyma-project:mainfrom
kwiatekus:patch-apply-kyma-app-push

Conversation

@kwiatekus
Copy link
Copy Markdown
Contributor

@kwiatekus kwiatekus commented May 6, 2026

Summary

  • kyma app push previously failed on rerun with "already exists" errors for Deployment and Service
  • Adds ApplyDeployment and ApplyService functions using Server-Side Apply (SSA) via the existing rootlessdynamic.Apply() infrastructure — the same pattern already used by CreateAPIRule
  • push.go now calls the new Apply* functions; existing Create* functions are preserved for backward compatibility

Changes

  • internal/kube/resources/deployment.go — add ApplyDeployment
  • internal/kube/resources/service.go — add ApplyService
  • internal/cmd/app/push.go — switch to ApplyDeployment/ApplyService; update output messages from "Creating" to "Applying"
  • Tests cover create (first run) and upsert (rerun) paths for both new functions

Test plan

  • go test ./internal/kube/resources/... ./internal/cmd/app/... passes
  • Run kyma app push --name my-app --image <image> twice against a cluster — second run should succeed without errors

Related to

Fixes #2905
#2899
#2410

@kwiatekus kwiatekus requested a review from a team as a code owner May 6, 2026 14:16
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

✅ Proposed changes verification passed

This pull request comes with up-to-date documentation and no illegal standard output usages.

Find more detailed information in the verify / standards (pull_request_target) action.

@kwiatekus kwiatekus enabled auto-merge (squash) May 6, 2026 14:49
@kwiatekus kwiatekus changed the title feat(app): make app push idempotent using server-side apply fix(app): make app push idempotent using server-side apply May 6, 2026
Comment thread internal/kube/resources/deployment.go Outdated
Comment thread internal/kube/resources/service.go Outdated
Copy link
Copy Markdown
Contributor

@musztardem musztardem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd adjust the deployment/service building functions, otherwise LGTM

@kwiatekus kwiatekus assigned kwiatekus and unassigned musztardem May 11, 2026
kwiatekus added 7 commits May 12, 2026 08:38
…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
@kwiatekus kwiatekus force-pushed the patch-apply-kyma-app-push branch from 4f48de0 to 6ff5263 Compare May 12, 2026 06:39
@github-actions
Copy link
Copy Markdown

✅ Proposed changes verification passed

This pull request comes with up-to-date documentation and no illegal standard output usages.

Find more detailed information in the verify-pr-code / standards action.

@github-actions
Copy link
Copy Markdown

✅ Proposed changes verification passed

This pull request comes with up-to-date documentation and no illegal standard output usages.

Find more detailed information in the verify-pr-code / standards action.

@kwiatekus kwiatekus assigned musztardem and unassigned kwiatekus May 12, 2026
@kwiatekus kwiatekus merged commit 7dbbc2e into kyma-project:main May 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kyma app push fails on rerun with "already exists" error for Deployment and Service

3 participants