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

Dynamically create object reconcilers for new types. #424

Merged
merged 1 commit into from
Feb 18, 2020

Conversation

sophieliu15
Copy link
Contributor

This PR creates object reconciler(s) when new type(s) are added to the
HNCConfiguration and informs the hierarchy reconciler about the new
object reconciler(s).

Specifically, it does the following tasks:

  • Dynamically creates an object reconciler when a new type is added
    in HNCConfiguration.
  • Informs the hierarchy reconciler about the newly added object
    reconciler so the corresponding objects can be propagated correctly
    when the hierarchy structure changes.

Test: Verified on a GKE cluster that

  • When adding a new type in HNCConfiguration, corresponding object
    reconciler is created successfully.
  • When adding a new object of the same type to a node in the namespace
    tree, the object is propagated correctly to the descendants of the
    node.
  • When the tree structure changes (e.g., add another descendant to the
    node above), the new object of the same type is propagated
    correctly.

Design doc: http://bit.ly/hnc-type-configuration
Issue: #411

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 14, 2020
@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 Feb 14, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @sophieliu15. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 14, 2020
@sophieliu15 sophieliu15 requested review from yiqigao217 and rjbez17 and removed request for rjbez17 and Fei-Guo February 14, 2020 18:24
@adrianludwin
Copy link
Contributor

/assign @rjbez17

Note that this change will also stop syncing everything except Roles and RoleBindings by default.

Copy link
Contributor

@adrianludwin adrianludwin left a comment

Choose a reason for hiding this comment

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

lgtm

incubator/hnc/pkg/controllers/config_controller.go Outdated Show resolved Hide resolved
incubator/hnc/pkg/controllers/config_controller.go Outdated Show resolved Hide resolved
incubator/hnc/pkg/forest/forest.go Outdated Show resolved Hide resolved
@adrianludwin
Copy link
Contributor

/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 Feb 14, 2020
@sophieliu15 sophieliu15 force-pushed the dynamic_start branch 5 times, most recently from 5f1b35e to d97b627 Compare February 14, 2020 21:31
@sophieliu15
Copy link
Contributor Author

The test should be fixed by now. Feel free to take a look.

Comment on lines 41 to 43
// Add secret to HNCConfiguration so that an ObjectReconciler will be created for secret.
addSecretToHNCConfig(ctx, hncConfig)

Copy link
Contributor

Choose a reason for hiding this comment

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

These should all be in the BeforeEach function at the top of this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Done.

incubator/hnc/pkg/forest/forest.go Show resolved Hide resolved
@rjbez17
Copy link

rjbez17 commented Feb 18, 2020

This lgtm, @adrianludwin and @yiqigao217 are you satisfied with the updates from you last few comments? Feel free to remove hold when happy.

/assign @adrianludwin
/assign @yiqigao217

/lgtm
/approve
/hold

@k8s-ci-robot k8s-ci-robot added lgtm Indicates that a PR is ready to be merged. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 18, 2020
Comment on lines 16 to 17
var _ = Describe("Secret", func() {
var _ = Describe("Role", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't we switch this back to "Secret" now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Switched back to "Secret".

@adrianludwin
Copy link
Contributor

Thanks Ryan! Just one minor nit left then I'll remove the hold.

This PR creates object reconciler(s) when new type(s) are added to the
HNCConfiguration and informs the hierarchy reconciler about the new
object reconciler(s).

Specifically, it does the following tasks:
  - Dynamically creates an object reconciler when a new type is added
    in HNCConfiguration.
  - Informs the hierarchy reconciler about the newly added object
    reconciler so the corresponding objects can be propagated correctly
    when the hierarchy structure changes.

Test: Verified on a GKE cluster that
   - When adding a new type in HNCConfiguration, corresponding object
     reconciler is created successfully.
   - When adding a new object of the same type to a node in the namespace
     tree, the object is propagated correctly to the descendants of the
     node.
   - When the tree structure changes (e.g., add another descendant to the
     node above), the new object of the same type is propagated
     correctly.
@k8s-ci-robot k8s-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 18, 2020
Copy link
Contributor

@adrianludwin adrianludwin left a comment

Choose a reason for hiding this comment

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

/lgtm
/unhold
/approve

@k8s-ci-robot k8s-ci-robot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Feb 18, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adrianludwin, rjbez17, sophieliu15

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:
  • OWNERS [adrianludwin,rjbez17]

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 merged commit 39df5a5 into kubernetes-retired:master Feb 18, 2020
@sophieliu15 sophieliu15 deleted the dynamic_start branch March 6, 2020 19:15
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants