Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KIM - Fix of the problem with removing exiting shoots using client.Update function to change shoot workers #650

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

koala7659
Copy link
Contributor

@koala7659 koala7659 commented Feb 6, 2025

Description

Fix for the bug for scenario when user wanted to remove some workers initially created with the shoot.
Affected scenarios:

  1. User create shoot with two workers - worker is not removed
  2. User removes worker or changes its name - new worker is created with the new name

Proposed two steps operation as a fix:

  1. Set shoot workers as client.Update using existing shoot as a base
  2. Patch full object using client.Patch as in the previous approach
  • Unit tests update

Related issue(s)
Additional worker node pools are not removed from shoot

@koala7659 koala7659 requested a review from a team as a code owner February 6, 2025 12:55
@kyma-bot kyma-bot added cla: yes Indicates the PR's author has signed the CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 6, 2025
@kyma-bot kyma-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 6, 2025
@kyma-bot kyma-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 9, 2025
@koala7659 koala7659 changed the title Use KIM Field Manager to create shoot KIM - Fix of the problem with removing exiting shoots using client.Update function to change shoot workers Feb 9, 2025
copyShoot := s.shoot.DeepCopy()
copyShoot.Spec.Provider.Workers = updatedShoot.Spec.Provider.Workers

err = m.ShootClient.Update(ctx, copyShoot,
Copy link
Member

@Disper Disper Feb 10, 2025

Choose a reason for hiding this comment

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

could you just shortly describe in a comment why this second update is needed?

Also, do you think it would be worth to extract this to another method such as `handleWorkerPoolsUpdate() to clearly distinguish which code is responsible for this exceptional logic?

Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if it would make sense to check if shootWorkers differ from the ones specified in runtimeCR and doing additional update only if they do.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is the whole workers comparison and matching logic inside converter, this idea would imply this code would have to be duplicated. I can try to come up with something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants