Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Set observedGeneration in the federatedTypeConfig controller #403

Conversation

sohankunkerkar
Copy link
Contributor

Following up #345
FederatedTypeConfig controller should set the observedGeneration in its control loop.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 7, 2018
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 7, 2018
pkg/controller/federatedtypeconfig/controller.go Outdated Show resolved Hide resolved
@@ -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)
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

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.

pkg/controller/federatedtypeconfig/controller.go Outdated Show resolved Hide resolved
pkg/controller/federatedtypeconfig/controller.go Outdated Show resolved Hide resolved
@pmorie
Copy link
Contributor

pmorie commented Nov 7, 2018

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

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 7, 2018
@sohankunkerkar
Copy link
Contributor Author

Referrencing #314 to get more clarity as to what we're planning to achieve.

@k8s-ci-robot k8s-ci-robot 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 Nov 9, 2018
@sohankunkerkar sohankunkerkar force-pushed the federatedTypeConfigIntialize branch from fc73245 to 9aca619 Compare November 9, 2018 16:06
@pmorie
Copy link
Contributor

pmorie commented Nov 13, 2018

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 13, 2018
Copy link
Contributor

@font font left a 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.

pkg/controller/federatedtypeconfig/controller.go Outdated Show resolved Hide resolved
@@ -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)
Copy link
Contributor

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.

pkg/controller/federatedtypeconfig/controller.go Outdated Show resolved Hide resolved
@pmorie
Copy link
Contributor

pmorie commented Nov 14, 2018

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 14, 2018
@pmorie
Copy link
Contributor

pmorie commented Nov 14, 2018

/approve

@font you have LGTM

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2018
@sohankunkerkar sohankunkerkar force-pushed the federatedTypeConfigIntialize branch from d8c59e0 to b37669d Compare November 14, 2018 21:44
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 14, 2018
@sohankunkerkar sohankunkerkar force-pushed the federatedTypeConfigIntialize branch from b37669d to 84315d5 Compare November 14, 2018 21:49
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 14, 2018
@sohankunkerkar sohankunkerkar force-pushed the federatedTypeConfigIntialize branch from 84315d5 to 66064cb Compare November 14, 2018 22:12
Copy link
Contributor

@font font left a 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?

@sohankunkerkar sohankunkerkar force-pushed the federatedTypeConfigIntialize branch from 66064cb to f8cf526 Compare November 15, 2018 13:54
@sohankunkerkar
Copy link
Contributor Author

@font Done!

@sohankunkerkar sohankunkerkar force-pushed the federatedTypeConfigIntialize branch from f8cf526 to bed12d1 Compare November 15, 2018 13:57
Copy link
Contributor

@font font left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 15, 2018
@k8s-ci-robot k8s-ci-robot merged commit 5221c20 into kubernetes-retired:master Nov 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

5 participants