diff --git a/pkg/addonfactory/addonfactory.go b/pkg/addonfactory/addonfactory.go index 17599350..d4413377 100644 --- a/pkg/addonfactory/addonfactory.go +++ b/pkg/addonfactory/addonfactory.go @@ -140,6 +140,7 @@ func (f *AgentAddonFactory) WithHostingCluster(cluster *clusterv1.ManagedCluster return f } +// WithManagedClusterClient defines the cluster client that can get the hosting cluster used in hosted mode. func (f *AgentAddonFactory) WithManagedClusterClient(c clusterclientset.Interface) *AgentAddonFactory { f.clusterClient = c return f diff --git a/pkg/addonfactory/helm_agentaddon.go b/pkg/addonfactory/helm_agentaddon.go index 1a243e26..c01255b5 100644 --- a/pkg/addonfactory/helm_agentaddon.go +++ b/pkg/addonfactory/helm_agentaddon.go @@ -47,11 +47,12 @@ type helmDefaultValues struct { } type HelmAgentAddon struct { - decoder runtime.Decoder - chart *chart.Chart - getValuesFuncs []GetValuesFunc - agentAddonOptions agent.AgentAddonOptions - trimCRDDescription bool + decoder runtime.Decoder + chart *chart.Chart + getValuesFuncs []GetValuesFunc + agentAddonOptions agent.AgentAddonOptions + trimCRDDescription bool + // Deprecated: use clusterClient to get the hosting cluster. hostingCluster *clusterv1.ManagedCluster clusterClient clusterclientset.Interface agentInstallNamespace func(addon *addonapiv1alpha1.ManagedClusterAddOn) string @@ -245,6 +246,12 @@ func (a *HelmAgentAddon) getBuiltinValues( return helmBuiltinValues, nil } +// Deprecated: use "WithManagedClusterClient" in AgentAddonFactory to set a cluster client that +// can be used to get the hosting cluster. +func (a *HelmAgentAddon) SetHostingCluster(hostingCluster *clusterv1.ManagedCluster) { + a.hostingCluster = hostingCluster +} + func (a *HelmAgentAddon) getDefaultValues( cluster *clusterv1.ManagedCluster, addon *addonapiv1alpha1.ManagedClusterAddOn) (Values, error) {