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

Fix PDB implementation #425

Merged
merged 1 commit into from
Jul 10, 2023
Merged

Fix PDB implementation #425

merged 1 commit into from
Jul 10, 2023

Conversation

ariefrahmansyah
Copy link
Contributor

What this PR does / why we need it:

  1. Fix PDB apply by supplying FieldManager: "application/apply-patch" PatchOptions.meta.k8s.io \"\" is invalid: fieldManager: Required value: is required for apply patch kubernetes/client-go#1036 (comment)
  2. Fix PDB config to always have % as suffix

Which issue(s) this PR fixes:

Fixes PDB implementation

Does this PR introduce a user-facing change?:

NONE

Checklist

  • Added unit test, integration, and/or e2e tests
  • Tested locally
  • Updated documentation
  • Update Swagger spec if the PR introduce API changes
  • Regenerated Golang and Python client if the PR introduce API changes

@@ -90,7 +89,7 @@ func (c *controller) deployPodDisruptionBudget(ctx context.Context, pdb *PodDisr
pdbCfg.WithLabels(pdb.Labels)
pdbCfg.WithSpec(pdbSpec)

_, err = c.policyClient.PodDisruptionBudgets(pdb.Namespace).Apply(ctx, pdbCfg, metav1.ApplyOptions{})
_, err = c.policyClient.PodDisruptionBudgets(pdb.Namespace).Apply(ctx, pdbCfg, metav1.ApplyOptions{FieldManager: "application/apply-patch"})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missed this in the previous PR. But what's the reason for using Apply instead of Create? https://github.com/kubernetes/client-go/blob/v0.27.3/kubernetes/typed/policy/v1/poddisruptionbudget.go#L118

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So we can use Apply for both Undeploy and Redeploy. Otherwise, we need to implement a function that call Update.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So we can use Apply for both Undeploy and Redeploy

Do you mean for both Deploy and Redeploy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, yes, you're right. It's for Deploy and Redeploy.

Copy link
Collaborator

@krithika369 krithika369 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, @ariefrahmansyah ! I imagine we will be adding it to caraml-dev/turing#346 too.

LGTM.

@ariefrahmansyah ariefrahmansyah merged commit b2ed508 into main Jul 10, 2023
43 checks passed
@ariefrahmansyah ariefrahmansyah deleted the fix-pdb branch July 10, 2023 07:16
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.

None yet

2 participants