From 04feff62f6046e42d7a4018f32146108782315a4 Mon Sep 17 00:00:00 2001 From: Cavaughn Browne Date: Wed, 17 Jan 2024 22:42:38 +0000 Subject: [PATCH] update management commponents annotation; change eksa cli field manager name --- internal/test/cluster.go | 8 ++------ pkg/api/v1alpha1/cluster_types.go | 2 +- pkg/api/v1alpha1/cluster_types_test.go | 2 +- pkg/constants/constants.go | 4 ++-- pkg/workflows/create.go | 2 +- pkg/workflows/create_test.go | 6 +++--- pkg/workflows/management/core_components.go | 2 +- .../management/upgrade_management_components_test.go | 2 +- pkg/workflows/management/upgrade_test.go | 2 +- 9 files changed, 13 insertions(+), 17 deletions(-) diff --git a/internal/test/cluster.go b/internal/test/cluster.go index 7d8babe4a6d1e..a930f513497ba 100644 --- a/internal/test/cluster.go +++ b/internal/test/cluster.go @@ -47,12 +47,8 @@ func NewClusterSpec(opts ...ClusterSpecOpt) *cluster.Spec { } s.VersionsBundles = map[v1alpha1.KubernetesVersion]*cluster.VersionsBundle{ v1alpha1.Kube119: { - VersionsBundle: &releasev1alpha1.VersionsBundle{ - Eksa: releasev1alpha1.EksaBundle{ - Version: "v0.0.0-dev+build.0000+000000", - }, - }, - KubeDistro: &cluster.KubeDistro{}, + VersionsBundle: &releasev1alpha1.VersionsBundle{}, + KubeDistro: &cluster.KubeDistro{}, }, } s.Bundles = &releasev1alpha1.Bundles{} diff --git a/pkg/api/v1alpha1/cluster_types.go b/pkg/api/v1alpha1/cluster_types.go index a67be6d5a7367..c64cba1247ca2 100644 --- a/pkg/api/v1alpha1/cluster_types.go +++ b/pkg/api/v1alpha1/cluster_types.go @@ -44,7 +44,7 @@ const ( // managementComponentsVersionAnnotation is an annotation applied to an EKS-A management cluster pointing to the current version of the management components. // The value for this annotation is expected to correspond to an EKSARelease object version, following semantic version convention: e.g. v0.18.3 // This is an internal EKS-A managed annotation, not meant to be updated manually. - managementComponentsVersionAnnotation = "anywhere.eks.amazonaws.com/eksa-management-components-version" + managementComponentsVersionAnnotation = "anywhere.eks.amazonaws.com/management-components-version" // defaultEksaNamespace is the default namespace for EKS-A resources when not specified. defaultEksaNamespace = "default" diff --git a/pkg/api/v1alpha1/cluster_types_test.go b/pkg/api/v1alpha1/cluster_types_test.go index 4788b7f4919d7..21aba284d0f80 100644 --- a/pkg/api/v1alpha1/cluster_types_test.go +++ b/pkg/api/v1alpha1/cluster_types_test.go @@ -3243,7 +3243,7 @@ func TestCluster_SetManagmentComponentsVersion(t *testing.T) { name: "self-managed cluster", cluster: baseCluster(), managementComponentsVersion: "v0.0.0-dev+build.0000", - wantAnnotations: map[string]string{"anywhere.eks.amazonaws.com/eksa-management-components-version": "v0.0.0-dev+build.0000"}, + wantAnnotations: map[string]string{"anywhere.eks.amazonaws.com/management-components-version": "v0.0.0-dev+build.0000"}, }, { name: "managed cluster", diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 813cc7bd79734..65f5601f95291 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -100,5 +100,5 @@ const ( Delete Operation = 2 ) -// EKSAFieldManager is the owner name for fields applied by the EKS-A CLI. -const EKSAFieldManager = "eks-a-cli" +// EKSACLIFieldManager is the owner name for fields applied by the EKS-A CLI. +const EKSACLIFieldManager = "eks-a-cli" diff --git a/pkg/workflows/create.go b/pkg/workflows/create.go index 0c84e19c6010c..e3f6465a71285 100644 --- a/pkg/workflows/create.go +++ b/pkg/workflows/create.go @@ -386,7 +386,7 @@ func (s *InstallEksaComponentsTask) Run(ctx context.Context, commandContext *tas commandContext.ClusterSpec.Cluster.SetManagementComponentsVersion(commandContext.ClusterSpec.EKSARelease.Spec.Version) if err := client.ApplyServerSide(ctx, - constants.EKSAFieldManager, + constants.EKSACLIFieldManager, commandContext.ClusterSpec.Cluster, kubernetes.ApplyServerSideOptions{ForceOwnership: true}, ); err != nil { diff --git a/pkg/workflows/create_test.go b/pkg/workflows/create_test.go index f030a6934713a..92573e609ff21 100644 --- a/pkg/workflows/create_test.go +++ b/pkg/workflows/create_test.go @@ -215,7 +215,7 @@ func (c *createTestSetup) expectInstallEksaComponents() { c.client.EXPECT().ApplyServerSide( c.ctx, - constants.EKSAFieldManager, + constants.EKSACLIFieldManager, c.clusterSpec.Cluster, kubernetes.ApplyServerSideOptions{ForceOwnership: true}, ), @@ -246,7 +246,7 @@ func (c *createTestSetup) skipInstallEksaComponents() { c.client.EXPECT().ApplyServerSide( c.ctx, - constants.EKSAFieldManager, + constants.EKSACLIFieldManager, c.clusterSpec.Cluster, kubernetes.ApplyServerSideOptions{ForceOwnership: true}, ), @@ -389,7 +389,7 @@ func TestCreateRunInstallEksaComponentsApplyServerSideFailure(t *testing.T) { test.client.EXPECT().ApplyServerSide( test.ctx, - constants.EKSAFieldManager, + constants.EKSACLIFieldManager, test.clusterSpec.Cluster, kubernetes.ApplyServerSideOptions{ForceOwnership: true}, ).Return(wantError), diff --git a/pkg/workflows/management/core_components.go b/pkg/workflows/management/core_components.go index bffd33971fb68..427bcaeb16157 100644 --- a/pkg/workflows/management/core_components.go +++ b/pkg/workflows/management/core_components.go @@ -94,7 +94,7 @@ func runUpgradeCoreComponents(ctx context.Context, commandContext *task.CommandC } commandContext.ClusterSpec.Cluster.SetManagementComponentsVersion(commandContext.ClusterSpec.EKSARelease.Spec.Version) if err := client.ApplyServerSide(ctx, - constants.EKSAFieldManager, + constants.EKSACLIFieldManager, commandContext.ClusterSpec.Cluster, kubernetes.ApplyServerSideOptions{ForceOwnership: true}, ); err != nil { diff --git a/pkg/workflows/management/upgrade_management_components_test.go b/pkg/workflows/management/upgrade_management_components_test.go index 19788625e656b..73e9d99543714 100644 --- a/pkg/workflows/management/upgrade_management_components_test.go +++ b/pkg/workflows/management/upgrade_management_components_test.go @@ -112,7 +112,7 @@ func TestRunnerHappyPath(t *testing.T) { mocks.clientFactory.EXPECT().BuildClientFromKubeconfig(managementCluster.KubeconfigFile).Return(mocks.client, nil), mocks.client.EXPECT().ApplyServerSide( ctx, - constants.EKSAFieldManager, + constants.EKSACLIFieldManager, newSpec.Cluster, kubernetes.ApplyServerSideOptions{ForceOwnership: true}, ).Return(nil), diff --git a/pkg/workflows/management/upgrade_test.go b/pkg/workflows/management/upgrade_test.go index 54f112fcbf55b..5a184a461210b 100644 --- a/pkg/workflows/management/upgrade_test.go +++ b/pkg/workflows/management/upgrade_test.go @@ -180,7 +180,7 @@ func (c *upgradeManagementTestSetup) expectBuildClientFromKubeconfig(err error) func (c *upgradeManagementTestSetup) expectApplyServerSide(err error) { c.client.EXPECT().ApplyServerSide( c.ctx, - constants.EKSAFieldManager, + constants.EKSACLIFieldManager, c.newClusterSpec.Cluster, kubernetes.ApplyServerSideOptions{ForceOwnership: true}, ).Return(err)