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

Allow overriding PATCH vs PUT for updates of select resources #3983

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

thomas11
Copy link
Contributor

@thomas11 thomas11 commented Feb 24, 2025

Update: since there are resources where PATCH is also the Create method, this PR doesn't work as is. We cannot express three options with one boolean UpdateMethod:

  1. both PUT
  2. PUT for create, PATCH for update
  3. both PATCH

Currently, every resource where the spec defines a PUT operation is created and updated via PUT. This is incorrect for a small number of resources which should be created via PUT but updated via PATCH. Postgres Server, e.g., will be recreated when updated via PUT when certain properties are changed.

This PR decouples determining the create and the update operation for a resource. It splits CreateOrUpdate of the Azure client into Create and Update. An addition to the Postgres integration test shows that the password of a server can now be updated without replacement.

Resolves #3961

@thomas11 thomas11 self-assigned this Feb 24, 2025
@thomas11 thomas11 changed the title Allow overriding PATCH vs PUT for select resources; better naming and testing for create/update operations Allow overriding PATCH vs PUT for updates of select resources Feb 24, 2025
@thomas11 thomas11 requested review from danielrbradley, EronWright and a team February 24, 2025 13:46
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

codecov bot commented Feb 24, 2025

Codecov Report

Attention: Patch coverage is 73.33333% with 8 lines in your changes missing coverage. Please review.

Project coverage is 57.51%. Comparing base (c85f387) to head (b9c21a7).

Files with missing lines Patch % Lines
provider/pkg/gen/schema.go 73.68% 3 Missing and 2 partials ⚠️
provider/pkg/provider/provider.go 50.00% 1 Missing ⚠️
...ovider/pkg/resources/customresources/custom_pim.go 66.66% 1 Missing ⚠️
...esources/customresources/custom_postgres_config.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3983      +/-   ##
==========================================
+ Coverage   57.49%   57.51%   +0.02%     
==========================================
  Files          82       82              
  Lines       13078    13092      +14     
==========================================
+ Hits         7519     7530      +11     
- Misses       4984     4986       +2     
- Partials      575      576       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

PostgreSQL - simple resource change requires the resource to recreate and hits the quota on Azure West Europe
1 participant