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

HNC: Implement HNC type configuration #411

Closed
sophieliu15 opened this issue Feb 11, 2020 · 3 comments
Closed

HNC: Implement HNC type configuration #411

sophieliu15 opened this issue Feb 11, 2020 · 3 comments
Assignees
Milestone

Comments

@sophieliu15
Copy link
Contributor

HNC type configuration makes it possible for cluster administrators to configure the propagation behavior for each KIND by HNC. This is a cluster-wide configuration.

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

sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 11, 2020
This commit implements HNC type configuration by creating HNCConfiguration CR and setting up a corresponding reconciler for it. Specifically, it does the following:

 - Implements the Go structs for HNCConfiguration and generates corresponding yaml files by running "make manifests".
 - Creates a basic reconciler for HNCConfiguration and configures it in setup.go. The reconciler does the following:
    - Creates a default singleton if it does not exist.
    - Writes or updates the singleton on the apiserver.
    - Logs the Spec of the HNCConfiguration when a reconciliation happens.

Tested:
  - Verified that the CRD were created correctly.
  - Created a sample HNCConfiguration and applied to KIND.
  - Verified the logs are expected on a GKE cluster during a reconciliation.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 12, 2020
This commit implements HNC type configuration by creating HNCConfiguration CR and setting up a corresponding reconciler for it. Specifically, it does the following:

 - Implements the Go structs for HNCConfiguration and generates corresponding yaml files by running "make manifests".
 - Creates a basic reconciler for HNCConfiguration and configures it in setup.go. The reconciler does the following:
    - Creates a default singleton if it does not exist.
    - Writes or updates the singleton on the apiserver.
    - Logs the Spec of the HNCConfiguration when a reconciliation happens.

Tested:
  - Verified that the CRD were created correctly.
  - Created a sample HNCConfiguration and applied to KIND.
  - Verified the logs are expected on a GKE cluster during a reconciliation.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 12, 2020
This commit implements HNC type configuration by creating HNCConfiguration CR and setting up a corresponding reconciler for it. Specifically, it does the following:

 - Implements the Go structs for HNCConfiguration and generates corresponding yaml files by running "make manifests".
 - Creates a basic reconciler for HNCConfiguration and configures it in setup.go. The reconciler does the following:
    - Creates a default singleton if it does not exist.
    - Writes or updates the singleton on the apiserver.
    - Logs the Spec of the HNCConfiguration when a reconciliation happens.

Tested:
  - Verified that the CRD were created correctly.
  - Created a sample HNCConfiguration and applied to KIND.
  - Verified the logs are expected on a GKE cluster during a reconciliation.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 12, 2020
This commit implements HNC type configuration by creating HNCConfiguration CR and setting up a corresponding reconciler for it. Specifically, it does the following:

 - Implements the Go structs for HNCConfiguration and generates corresponding yaml files by running "make manifests".
 - Creates a basic reconciler for HNCConfiguration and configures it in setup.go. The reconciler does the following:
    - Creates a default singleton if it does not exist.
    - Writes or updates the singleton on the apiserver.
    - Logs the Spec of the HNCConfiguration when a reconciliation happens.

Tested:
  - Verified that the CRD were created correctly.
  - Created a sample HNCConfiguration and applied to KIND.
  - Verified the logs are expected on a GKE cluster during a reconciliation.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 12, 2020
This commit implements HNC type configuration by creating HNCConfiguration CR and setting up a corresponding reconciler for it. Specifically, it does the following:

 - Implements the Go structs for HNCConfiguration and generates corresponding yaml files by running "make manifests".
 - Creates a basic reconciler for HNCConfiguration and configures it in setup.go. The reconciler does the following:
    - Creates a default singleton if it does not exist.
    - Writes or updates the singleton on the apiserver.
    - Logs the Spec of the HNCConfiguration when a reconciliation happens.

Tested:
  - Verified that the CRD were created correctly.
  - Created a sample HNCConfiguration and applied to KIND.
  - Verified the logs are expected on a GKE cluster during a reconciliation.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
@sophieliu15 sophieliu15 changed the title Implement HNC type configuration HNC: Implement HNC type configuration Feb 14, 2020
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 19, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also moves shared helper functions from each controller test files to a common file.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 19, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also moves shared helper functions from each controller test files to a common file.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also moves shared helper functions from each controller test files to a common file.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also moves shared helper functions from each controller test files to a common file.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also moves shared helper functions from each controller test files to a common file.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also moves shared helper functions from each controller test files to a common file.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also moves shared helper functions from each controller test files to a common file.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also does the following refactoring:
   -  Moves shared helper functions from each controller test files to a common file: test_helpers_test.go
   -  Switches the object type in object_controller_test.go from Secret to Role because:
       -  The behaviors that are tested in the object_controller_test.go are irrelevant to the object type or the creation of a new object reconciler.
       -  Since the test suite creates the object reconciler for Role by default, object_controller_test.go can use the existing Role object reconciler for the tests instead of creating a new object reconciler.
       -  The tests inside controllers_test package share the same test environment, which means if the test in one Describe container adds a type to
       HNCConfiguration singleton, the corresponding object reconciler for that type will be created and will still be there when running subsequent Describe
       containers in the package. Until we find a way to "cleanup" object reconcilers, it is better to only create new object reconcilers when necessary.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also does the following refactoring:
   -  Moves shared helper functions from each controller test files to a common file: test_helpers_test.go
   -  Switches the object type in object_controller_test.go from Secret to Role because:
       -  The behaviors that are tested in the object_controller_test.go are irrelevant to the object type or the creation of a new object reconciler.
       -  Since the test suite creates the object reconciler for Role by default, object_controller_test.go can use the existing Role object reconciler
       for the tests instead of creating a new object reconciler.
       -  The tests inside controllers_test package share the same test environment, which means if the test in one Describe container adds a type to
       HNCConfiguration singleton, the corresponding object reconciler for that type will be created and will still be there when running subsequent Describe
       containers in the package. Until we find a way to "cleanup" object reconcilers, it is better to only create new object reconcilers when necessary.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also does the following refactoring:
   -  Moves shared helper functions from each controller test files to a common file: test_helpers_test.go
   -  Switches the object type in object_controller_test.go from Secret to Role because:
       -  The behaviors that are tested in the object_controller_test.go are irrelevant to the object type or the creation of a new object reconciler.
       -  Since the test suite creates the object reconciler for Role by default, object_controller_test.go can use the existing Role object reconciler
       for the tests instead of creating a new object reconciler.
       -  The tests inside controllers_test package share the same test environment, which means if the test in one Describe container adds a type to
       HNCConfiguration singleton, the corresponding object reconciler for that type will be created and will still be there when running subsequent Describe
       containers in the package. Until we find a way to "cleanup" object reconcilers, it is better to only create new object reconcilers when necessary.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 20, 2020
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.

This PR also does the following refactoring:
   -  Moves shared helper functions from each controller test files to a common file: test_helpers_test.go
   -  Switches the object type in object_controller_test.go from Secret to Role because:
       -  The behaviors that are tested in the object_controller_test.go are irrelevant to the object type or the creation of a new object reconciler.
       -  Since the test suite creates the object reconciler for Role by default, object_controller_test.go can use the existing Role object reconciler
       for the tests instead of creating a new object reconciler.
       -  The tests inside controllers_test package share the same test environment, which means if the test in one Describe container adds a type to
       HNCConfiguration singleton, the corresponding object reconciler for that type will be created and will still be there when running subsequent Describe
       containers in the package. Until we find a way to "cleanup" object reconcilers, it is better to only create new object reconcilers when necessary.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 25, 2020
This PR creates a default HNCConfiguration singleton when starting HNC if the singleton does not exist. The feature is achieved by adding a channel in reconciler watch to trigger the reconciliation at startup. The reconciliation will ensure the default singleton will be created if it does not exist.

Tested: GKE cluster; unit tests.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 26, 2020
This PR creates a default HNCConfiguration singleton when starting HNC if the singleton does not exist. The feature is achieved by adding a channel in reconciler watch to trigger the reconciliation at startup. The reconciliation will ensure the default singleton will be created if it does not exist.

Tested: GKE cluster; unit tests.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 26, 2020
This PR creates a default HNCConfiguration singleton when starting HNC if the singleton does not exist. The feature is achieved by adding a channel in reconciler watch to trigger the reconciliation at startup. The reconciliation will ensure the default singleton will be created if it does not exist.

Tested: GKE cluster; unit tests.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 27, 2020
This PR adds Conditions in HNCConfiguration.Status to indicate error scenarios. Condition specifies error code and message for a specific error. Currently we support following error code:
    - "CRIT_SINGLETON_NAME_INVALID": the specified singleton name is invalid.
    - "OBJECT_RECONCILER_CREATION_FAILED": an error exists when creating the object reconciler for a specific type.

This PR includes changes introduced in kubernetes-retired#453

Tested: GKE cluster; unit tests.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 27, 2020
This PR adds Conditions in HNCConfiguration.Status to indicate error scenarios. Condition specifies error code and message for a specific error. Currently we support following error code:
    - "CRIT_SINGLETON_NAME_INVALID": the specified singleton name is invalid.
    - "OBJECT_RECONCILER_CREATION_FAILED": an error exists when creating the object reconciler for a specific type.

This PR includes changes introduced in kubernetes-retired#453

Tested: GKE cluster; unit tests.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 27, 2020
This PR adds Conditions in HNCConfiguration.Status to indicate error scenarios. Condition specifies error code and message for a specific error. Currently we support following error code:
    - "CRIT_SINGLETON_NAME_INVALID": the specified singleton name is invalid.
    - "OBJECT_RECONCILER_CREATION_FAILED": an error exists when creating the object reconciler for a specific type.

This PR includes changes introduced in kubernetes-retired#453

Tested: GKE cluster; unit tests.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Feb 27, 2020
This PR adds Conditions in HNCConfiguration.Status to indicate error scenarios. Condition specifies error code and message for a specific error. Currently we support following error code:
    - critSingletonNameInvalid: the specified singleton name is invalid.
    - objectReconcilerCreationFailed: an error exists when creating the object reconciler for a specific type.

This PR includes changes introduced in kubernetes-retired#453

Tested: GKE cluster; unit tests.

Design doc: http://bit.ly/hnc-type-configuration
Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 20, 2020
…o StatusReasonInvalid

This PR changes the StatusReason from StatusReasonForbidden to StatusReasonInvalid when handling invalid requests in `hncconfig.go`. To show the custom error message when the request is invalid, we need to add the message in the `Status.Details` field.

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 20, 2020
This PR handles multiple configurations for the same type in ConfigReconciler. If there are multiple configurations for the same type, only the first configuration will be followed, the rest will be ignored.

Tested:unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 23, 2020
This PR handles multiple configurations for the same type in ConfigReconciler. If there are multiple configurations for the same type, only the first configuration will be followed, the rest will be ignored.

Tested:unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 23, 2020
This PR handles multiple configurations for the same type in ConfigReconciler. If there are multiple configurations for the same type, only the first configuration will be followed, the rest will be ignored.

Tested:unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 24, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 24, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 24, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
@adrianludwin adrianludwin added this to the hnc-v0.3 milestone Mar 24, 2020
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 24, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 24, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 24, 2020
Note: This PR is implemented on top of kubernetes-retired#542, please review that first. I will rebase and remove the hold once kubernetes-retired#542 is merged. Thank you!

This PR computes NumSourceObjects as a part of HNCConfiguration status. NumSourceObjects indicates the number of objects of a specific type created by users.

Tested:unit tests, GKE cluster

Issue: kubernetes-retired#411

initial commit
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 25, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 25, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 26, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 26, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 26, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 26, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Mar 26, 2020
This PR computes NumPropagatedObjects as a part of HNCConfiguration
status. NumPropagatedObjects indicates the number of propagated objects
of a specific type created by HNC.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Apr 1, 2020
This PR computes NumSourceObjects as a part of HNCConfiguration status. NumSourceObjects indicates the number of source objects of a specific type created by users.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Apr 1, 2020
This PR computes NumSourceObjects as a part of HNCConfiguration status. NumSourceObjects indicates the number of source objects of a specific type created by users.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Apr 1, 2020
This PR computes NumSourceObjects as a part of HNCConfiguration status. NumSourceObjects indicates the number of source objects of a specific type created by users.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
sophieliu15 added a commit to sophieliu15/multi-tenancy that referenced this issue Apr 2, 2020
This PR computes NumSourceObjects as a part of HNCConfiguration status. NumSourceObjects indicates the number of source objects of a specific type created by users.

Tested: unit tests, GKE cluster

Issue: kubernetes-retired#411
@sophieliu15
Copy link
Contributor Author

/close

This issue is fixed.

@k8s-ci-robot
Copy link
Contributor

@sophieliu15: Closing this issue.

In response to this:

/close

This issue is fixed.

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants