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

Allow addons to be installed by label, but also manually #616

Open
tesshuflower opened this issue Sep 10, 2024 · 5 comments
Open

Allow addons to be installed by label, but also manually #616

tesshuflower opened this issue Sep 10, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@tesshuflower
Copy link

Describe the enhancement

I'm considering this an enhancement request, but we do have some functionality that was removed between v0.9.0 and v0.10.0 of the addon-framework.

Essentially my use-case (for the ACM volsync-addon-controller which uses the addon-framework) is that users are able to deploy the addon to managed clusters in 2 ways:

  1. Users can add a specific label to a ManagedCluster resource, and then the ManagedClusterAddOn resource is created automatically for them in the managedcluster namespace on the hub.
  2. Users can manually create the ManagedClusterAddOn.

This has been the case for quite a few ACM releases.

To achieve this, I have the following in my addon setup:

agent.AgentAddonOptions{
		AddonName: addonName,
		InstallStrategy: agent.InstallByLabelStrategy(
			"",
			metav1.LabelSelector{
				MatchLabels: map[string]string{
					ManagedClusterInstallVolSyncLabel: ManagedClusterInstallVolSyncLabelValue,
				},
			},
		),

but now in v0.10.0 the InstallByLabelStrategy has been removed.

Is there something I can do to get this functionality back? For the meantime I'm not updating to the addon-framework v0.10.0.

@haoqing0110
Copy link
Member

cc @qiujian16
Seems currently with v0.10.0, we can support case 1 (cma spec.installStrategy.type is "Placements") or case 2 (cma spec.installStrategy.type is"Manual"), but not 1 & 2 at the same time. When installStrategy type is Placements, the manually created mca will be removed.

@tesshuflower
Copy link
Author

I'm not sure I understand the "Placements" install strategy - will this work for a label? Or would someone need to create a placement that then looks for a label selector?

@haoqing0110
Copy link
Member

@tesshuflower

With "Placements" install strategy, you will need to create 2 resources as below, 1 cma and 1 placement with label selector.
With this defined, the user can no longer manually create mca unless changes the type to Manual.

apiVersion: addon.open-cluster-management.io/v1alpha1
kind: ClusterManagementAddOn
metadata:
  name: helloworld
  annotations:
    addon.open-cluster-management.io/lifecycle: "addon-manager"
spec:
  addOnMeta:
    displayName: helloworld
  installStrategy:
    type: Placements
    placements:
    - name: placement-test
      namespace: default
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: Placement
metadata:
  name: placement-test
  namespace: default
spec:
  predicates:
    - requiredClusterSelector:
        labelSelector:
          matchLabels:
            purpose: test

@tesshuflower
Copy link
Author

I think this also breaks my current scenario where I have already allowed customers to deploy via setting a specific label on their managedclusters - now they would have to create those resources in order to be able to use a label selector (or I would need to always create the CMA & placement myself - which could be problematic if they already have their own CMA with other settings).

@haoqing0110
Copy link
Member

haoqing0110 commented Sep 20, 2024

@tesshuflower yes, this is indeed the "expected" breaking changes when upgrading to v0.10.0. Another option to keep the current user behavior while upgrading to v0.10.0 might be to set installStrategy type as Manual, and implement your own controller to install the mca.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants