Skip to content
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

Add a controller to support addon template #187

Conversation

zhujian7
Copy link
Member

@zhujian7 zhujian7 commented May 29, 2023

implement for the proposal: open-cluster-management-io/enhancements#87

@openshift-ci openshift-ci bot requested review from deads2k and elgnay May 29, 2023 03:07
@zhujian7 zhujian7 force-pushed the addon-template-prototype branch 8 times, most recently from 9c3af5b to 2f182f7 Compare June 2, 2023 03:31
@zhujian7
Copy link
Member Author

zhujian7 commented Jun 5, 2023

@zhujian7 zhujian7 changed the title WIP:Add a controller to support addon template Add a controller to support addon template Jun 6, 2023
kubeConfig,
hubKubeClient,
addonClient,
addonInformerFactory.Addon().V1alpha1().ClusterManagementAddOns(),
Copy link
Member

Choose a reason for hiding this comment

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

Does this controller need a filter? Considering the case when cma is configured with addontemplate but claim managed by self by annotation addon.open-cluster-management.io/lifecycle: "self"

Copy link
Member

Choose a reason for hiding this comment

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

addonConfigController and managementAddonConfigController should be considered to filter too in self case ?

Copy link
Member Author

Choose a reason for hiding this comment

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

discussed with haoqing offline, the utils.FilterOutTheBuiltInAddOnConfigGVRs(a.addonConfigs) will do the filter. so I think self filter is not necessary.

return false
}

for _, config := range cma.Spec.SupportedConfigs {
Copy link
Member

Choose a reason for hiding this comment

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

Today the cma.Spec.SupportedConfigs is more like a global configs for all the addons. The actual addon supported config is hard code with WithConfigGVRs() and print in mca.Status.SupportedConfigs.

Copy link
Member Author

Choose a reason for hiding this comment

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

for the template type addon, the developers do not write code for the hub side controller, so they do not have a chance to define the WithConfigGVRs, we need to check the cma.spec.supportedConfigs field to determine whether an addon is a template type addon.

deploy/resources/cluster_role.yaml Outdated Show resolved Hide resolved
name: hello-template-agent
namespace: open-cluster-management-agent-addon
annotations:
"addon.open-cluster-management.io/deletion-orphan": ""
Copy link
Member

Choose a reason for hiding this comment

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

the annotation deletion-orphan still can work in addonTemplate?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, it can work since the template controller just start a go routine to run the framework code.

kubeConfig,
hubKubeClient,
addonClient,
addonInformerFactory.Addon().V1alpha1().ClusterManagementAddOns(),
Copy link
Member

Choose a reason for hiding this comment

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

addonConfigController and managementAddonConfigController should be considered to filter too in self case ?

@zhujian7 zhujian7 force-pushed the addon-template-prototype branch 2 times, most recently from 26b7d23 to 34ed983 Compare June 9, 2023 09:17
Signed-off-by: zhujian <jiazhu@redhat.com>
Signed-off-by: zhujian <jiazhu@redhat.com>
Signed-off-by: zhujian <jiazhu@redhat.com>
Signed-off-by: zhujian <jiazhu@redhat.com>
Signed-off-by: zhujian <jiazhu@redhat.com>
@zhujian7
Copy link
Member Author

/cc @qiujian16 PTAL

@openshift-ci openshift-ci bot requested a review from qiujian16 June 19, 2023 13:49
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 19, 2023

@zhujian7: GitHub didn't allow me to request PR reviews from the following users: PTAL.

Note that only open-cluster-management-io members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @qiujian16 PTAL

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.

@zhujian7
Copy link
Member Author

/hold

@zhujian7
Copy link
Member Author

/unhold

@zhujian7 zhujian7 force-pushed the addon-template-prototype branch 2 times, most recently from fcf27c5 to 1d10946 Compare June 20, 2023 08:59
Signed-off-by: zhujian <jiazhu@redhat.com>
@qiujian16
Copy link
Member

/approve
/lgtm
/hold

@zhiweiyin318 @haoqing0110 Please also take a look

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16, zhujian7

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

dynamicInformers,
a.addonConfigs,
utils.FilterOutTheBuiltInAddOnConfigGVRs(a.addonConfigs),
Copy link
Member

Choose a reason for hiding this comment

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

May need to consider the case when the addon upgrades the framework but still wants to be managed by self, which component is responsible to update the spec hash and lastobservedgeneration for addondeploymentconfig?

Copy link
Member Author

Choose a reason for hiding this comment

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

deleted the addonconfig controller in the addon manager, will use the controller in addon-framework to update the spec hash for both addon templates and addon deployment config.

@openshift-ci openshift-ci bot removed the lgtm label Jun 21, 2023
@haoqing0110
Copy link
Member

/lgtm

@zhiweiyin318
Copy link
Member

/unhold

@openshift-merge-robot openshift-merge-robot merged commit 0056b14 into open-cluster-management-io:main Jun 21, 2023
8 checks passed
@zhujian7 zhujian7 deleted the addon-template-prototype branch June 21, 2023 11:28
)
managementAddonConfigController = managementaddonconfig.NewManagementAddonConfigController(
addonClient,
addonInformers.Addon().V1alpha1().ClusterManagementAddOns(),
dynamicInformers,
a.addonConfigs,
utils.FilterByAddonName(a.addonAgents),
Copy link
Member Author

Choose a reason for hiding this comment

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

filter by the addon name so the controller will only handle its own clustermanagementaddon.

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

Successfully merging this pull request may close these issues.

None yet

5 participants