@@ -21,27 +21,27 @@ const (
2121 defaultMultusNamespace = metav1 .NamespaceSystem
2222)
2323
24- type MultusDeployer struct {
25- client ctrlclient.Client
26- helmChartInfoGetter * config.HelmChartGetter
24+ type helmAddonStrategy struct {
25+ client ctrlclient.Client
26+ helmChart * config.HelmChart
2727}
2828
29- func NewMultusDeployer (client ctrlclient.Client , helmChartInfoGetter * config.HelmChartGetter ) * MultusDeployer {
30- return & MultusDeployer {
31- client : client ,
32- helmChartInfoGetter : helmChartInfoGetter ,
29+ func newHelmAddonStrategy (client ctrlclient.Client , helmChart * config.HelmChart ) helmAddonStrategy {
30+ return helmAddonStrategy {
31+ client : client ,
32+ helmChart : helmChart ,
3333 }
3434}
3535
36- func (m * MultusDeployer ) Deploy (
36+ func (s helmAddonStrategy ) apply (
3737 ctx context.Context ,
3838 cluster * clusterv1.Cluster ,
3939 readinessSocketPath string ,
40- targetNamespace string ,
40+ defaultsNamespace string ,
4141 log logr.Logger ,
4242) error {
4343 // Check if Multus deployment is supported for this cloud provider
44- isSupported , providerName := m . isCloudProviderSupported (cluster )
44+ isSupported , providerName := isCloudProviderSupported (cluster )
4545
4646 // Currently, Multus is only supported for EKS and Nutanix clusters
4747 if ! isSupported {
@@ -51,31 +51,19 @@ func (m *MultusDeployer) Deploy(
5151
5252 log .Info (fmt .Sprintf ("Cluster is %s. Proceeding with Multus deployment." , providerName ))
5353
54- // Get Multus Helm chart info
55- helmChart , err := m .helmChartInfoGetter .For (ctx , log , config .Multus )
56- if err != nil {
57- // For local testing, provide a placeholder chart info
58- log .Info ("Multus not found in helm-config.yaml, using placeholder chart info for local development" )
59- helmChart = & config.HelmChart {
60- Name : "multus" ,
61- Version : "dev" ,
62- Repository : "" ,
63- }
64- }
65-
6654 // Deploy Multus using HelmAddonApplier with template function
6755 strategy := addons .NewHelmAddonApplier (
6856 addons .NewHelmAddonConfig (
6957 "default-multus-values-template" ,
7058 defaultMultusNamespace ,
7159 defaultMultusReleaseName ,
7260 ),
73- m .client ,
74- helmChart ,
61+ s .client ,
62+ s . helmChart ,
7563 ).WithValueTemplater (templateValuesFunc (readinessSocketPath )).
7664 WithDefaultWaiter ()
7765
78- if err := strategy .Apply (ctx , cluster , targetNamespace , log ); err != nil {
66+ if err := strategy .Apply (ctx , cluster , defaultsNamespace , log ); err != nil {
7967 return fmt .Errorf ("failed to apply Multus deployment: %w" , err )
8068 }
8169
@@ -85,7 +73,7 @@ func (m *MultusDeployer) Deploy(
8573
8674// isCloudProviderSupported checks if the cluster is a supported cloud provider
8775// by inspecting the infrastructure reference.
88- func ( m * MultusDeployer ) isCloudProviderSupported (cluster * clusterv1.Cluster ) (
76+ func isCloudProviderSupported (cluster * clusterv1.Cluster ) (
8977 isSupported bool ,
9078 providerName string ,
9179) {
0 commit comments