diff --git a/pkg/clustermanager/cluster_manager.go b/pkg/clustermanager/cluster_manager.go index 9c0e2b19ee2e4..d698070ac414c 100644 --- a/pkg/clustermanager/cluster_manager.go +++ b/pkg/clustermanager/cluster_manager.go @@ -523,6 +523,22 @@ func (c *ClusterManager) getWorkloadClusterKubeconfig(ctx context.Context, clust return nil } +// CreateEKSAReleaseBundle applies the eks-a release bundle to the cluster. +func (c *ClusterManager) CreateEKSAReleaseBundle(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error { + if clusterSpec.Cluster.Namespace != "" { + if err := c.clusterClient.CreateNamespaceIfNotPresent(ctx, cluster.KubeconfigFile, clusterSpec.Cluster.Namespace); err != nil { + return err + } + } + + clusterSpec.Cluster.AddManagedByCLIAnnotation() + + if err := c.ApplyBundles(ctx, clusterSpec, cluster); err != nil { + return err + } + return c.ApplyReleases(ctx, clusterSpec, cluster) +} + func (c *ClusterManager) RunPostCreateWorkloadCluster(ctx context.Context, managementCluster, workloadCluster *types.Cluster, clusterSpec *cluster.Spec) error { logger.V(3).Info("Waiting for controlplane and worker machines to be ready") labels := []string{clusterv1.MachineControlPlaneNameLabel, clusterv1.MachineDeploymentNameLabel} diff --git a/pkg/workflows/interfaces/interfaces.go b/pkg/workflows/interfaces/interfaces.go index 53bf52cb2eea8..f983ae5567484 100644 --- a/pkg/workflows/interfaces/interfaces.go +++ b/pkg/workflows/interfaces/interfaces.go @@ -32,6 +32,7 @@ type ClusterManager interface { SaveLogsManagementCluster(ctx context.Context, spec *cluster.Spec, cluster *types.Cluster) error SaveLogsWorkloadCluster(ctx context.Context, provider providers.Provider, spec *cluster.Spec, cluster *types.Cluster) error InstallCustomComponents(ctx context.Context, clusterSpec *cluster.Spec, cluster *types.Cluster, provider providers.Provider) error + CreateEKSAReleaseBundle(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error CreateEKSANamespace(ctx context.Context, cluster *types.Cluster) error CreateEKSAResources(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec, datacenterConfig providers.DatacenterConfig, machineConfigs []providers.MachineConfig) error ApplyBundles(ctx context.Context, clusterSpec *cluster.Spec, cluster *types.Cluster) error diff --git a/pkg/workflows/interfaces/mocks/clients.go b/pkg/workflows/interfaces/mocks/clients.go index 4e09d90db0327..0d5cb41101383 100644 --- a/pkg/workflows/interfaces/mocks/clients.go +++ b/pkg/workflows/interfaces/mocks/clients.go @@ -181,6 +181,20 @@ func (mr *MockClusterManagerMockRecorder) CreateEKSANamespace(arg0, arg1 interfa return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateEKSANamespace", reflect.TypeOf((*MockClusterManager)(nil).CreateEKSANamespace), arg0, arg1) } +// CreateEKSAReleaseBundle mocks base method. +func (m *MockClusterManager) CreateEKSAReleaseBundle(arg0 context.Context, arg1 *types.Cluster, arg2 *cluster.Spec) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateEKSAReleaseBundle", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateEKSAReleaseBundle indicates an expected call of CreateEKSAReleaseBundle. +func (mr *MockClusterManagerMockRecorder) CreateEKSAReleaseBundle(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateEKSAReleaseBundle", reflect.TypeOf((*MockClusterManager)(nil).CreateEKSAReleaseBundle), arg0, arg1, arg2) +} + // CreateEKSAResources mocks base method. func (m *MockClusterManager) CreateEKSAResources(arg0 context.Context, arg1 *types.Cluster, arg2 *cluster.Spec, arg3 providers.DatacenterConfig, arg4 []providers.MachineConfig) error { m.ctrl.T.Helper()