-
Notifications
You must be signed in to change notification settings - Fork 42
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
Conversation
@@ -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"}) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
What this PR does / why we need it:
FieldManager: "application/apply-patch"
PatchOptions.meta.k8s.io \"\" is invalid: fieldManager: Required value: is required for apply patch kubernetes/client-go#1036 (comment)Which issue(s) this PR fixes:
Fixes PDB implementation
Does this PR introduce a user-facing change?:
Checklist