-
Notifications
You must be signed in to change notification settings - Fork 533
Set observedGeneration in the federatedTypeConfig controller #403
Set observedGeneration in the federatedTypeConfig controller #403
Conversation
Hi @sohankunkerkar. Thanks for your PR. I'm waiting for a kubernetes-sigs or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -266,7 +278,7 @@ func (c *Controller) ensureFinalizer(tc *corev1a1.FederatedTypeConfig) error { | |||
} | |||
finalizers.Insert(finalizer) | |||
accessor.SetFinalizers(finalizers.List()) | |||
_, err = c.client.FederatedTypeConfigs(tc.Namespace).Update(tc) | |||
_, err = c.client.FederatedTypeConfigs(tc.Namespace).UpdateStatus(tc) |
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.
This change will prevent the finalizer from being saved. Everything but status is written with Update
, and only status is written with UpdateStatus
.
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.
The status endpoint should allow writes to metadata as well as status. If it doesn't, that may be a bug with CRD.
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.
@sohankunkerkar were you able to confirm if this works? Otherwise, per @pmorie we may have a bug with CRD.
@@ -281,6 +293,6 @@ func (c *Controller) removeFinalizer(tc *corev1a1.FederatedTypeConfig) error { | |||
} | |||
finalizers.Delete(finalizer) | |||
accessor.SetFinalizers(finalizers.List()) | |||
_, err = c.client.FederatedTypeConfigs(tc.Namespace).Update(tc) | |||
_, err = c.client.FederatedTypeConfigs(tc.Namespace).UpdateStatus(tc) |
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.
ditto
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.
UpdatesStatus()
method was used twice, one in the ensureFinalizer
and other in removeFinalizer
. so basically it was updating the status twice in the same iteration loop. I commented out UpdatesStatus()
in the ensureFinalizer
method and it's working fine without any issues.
Just to be explicit about this - observedGeneration is meant to contextualize other status fields. It's not terribly useful on its own, and my intention is that we will add (at least one) additional field in this PR that makes observedGeneration useful. /hold |
Referrencing #314 to get more clarity as to what we're planning to achieve. |
fc73245
to
9aca619
Compare
/ok-to-test |
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 @sohankunkerkar! There are just a couple of outstanding comments and we can merge this.
@@ -266,7 +278,7 @@ func (c *Controller) ensureFinalizer(tc *corev1a1.FederatedTypeConfig) error { | |||
} | |||
finalizers.Insert(finalizer) | |||
accessor.SetFinalizers(finalizers.List()) | |||
_, err = c.client.FederatedTypeConfigs(tc.Namespace).Update(tc) | |||
_, err = c.client.FederatedTypeConfigs(tc.Namespace).UpdateStatus(tc) |
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.
@sohankunkerkar were you able to confirm if this works? Otherwise, per @pmorie we may have a bug with CRD.
/hold cancel |
/approve @font you have LGTM |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pmorie, sohankunkerkar The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
d8c59e0
to
b37669d
Compare
b37669d
to
84315d5
Compare
84315d5
to
66064cb
Compare
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 @sohankunkerkar! Other than a few extra blank lines, can you squash your commits to prepare for merge?
66064cb
to
f8cf526
Compare
@font Done! |
f8cf526
to
bed12d1
Compare
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.
/lgtm
Following up #345
FederatedTypeConfig controller should set the observedGeneration in its control loop.