From f9f3ccd576cb2e3cadc43d1c935249120e235e86 Mon Sep 17 00:00:00 2001 From: zhujian Date: Fri, 15 Mar 2024 07:51:50 +0000 Subject: [PATCH] add deprecated marks Signed-off-by: zhujian --- pkg/addonfactory/addonfactory.go | 1 + pkg/addonfactory/helm_agentaddon.go | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) 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) {