Skip to content

Commit

Permalink
Issue 6985: Bare metal upgrade should honor the TinkerbellDatacenterC…
Browse files Browse the repository at this point in the history
…onfig.skipLoadBalancerDeployment config value (#6990)

Co-authored-by: doug.alcouffe <doug.alcouffe@workday.com>
  • Loading branch information
dalcouffe and doug.alcouffe authored Nov 8, 2023
1 parent a0689c4 commit 8c135ab
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
13 changes: 9 additions & 4 deletions pkg/providers/tinkerbell/stack/mocks/stack.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions pkg/providers/tinkerbell/stack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type StackInstaller interface {
CleanupLocalBoots(ctx context.Context, forceCleanup bool) error
Install(ctx context.Context, bundle releasev1alpha1.TinkerbellBundle, tinkerbellIP, kubeconfig, hookOverride string, opts ...InstallOption) error
UninstallLocal(ctx context.Context) error
Upgrade(_ context.Context, _ releasev1alpha1.TinkerbellBundle, tinkerbellIP, kubeconfig string, hookOverride string) error
Upgrade(_ context.Context, _ releasev1alpha1.TinkerbellBundle, tinkerbellIP, kubeconfig, hookOverride string, opts ...InstallOption) error
AddNoProxyIP(IP string)
GetNamespace() string
}
Expand Down Expand Up @@ -378,9 +378,13 @@ func (s *Installer) authenticateHelmRegistry(ctx context.Context) error {
}

// Upgrade the Tinkerbell stack using images specified in bundle.
func (s *Installer) Upgrade(ctx context.Context, bundle releasev1alpha1.TinkerbellBundle, tinkerbellIP, kubeconfig string, hookOverride string) error {
func (s *Installer) Upgrade(ctx context.Context, bundle releasev1alpha1.TinkerbellBundle, tinkerbellIP, kubeconfig string, hookOverride string, opts ...InstallOption) error {
logger.V(6).Info("Upgrading Tinkerbell helm chart")

for _, option := range opts {
option(s)
}

bootEnv := s.getBootsEnv(bundle.TinkerbellStack, tinkerbellIP)

osiePath, err := getURIDir(bundle.TinkerbellStack.Hook.Initramfs.Amd.URI)
Expand Down Expand Up @@ -421,7 +425,8 @@ func (s *Installer) Upgrade(ctx context.Context, bundle releasev1alpha1.Tinkerbe
image: bundle.TinkerbellStack.Rufio.URI,
},
kubevip: map[string]interface{}{
image: bundle.KubeVip.URI,
image: bundle.KubeVip.URI,
deploy: s.loadBalancer,
},
envoy: map[string]interface{}{
image: bundle.Envoy.URI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ hegel:
value: 192.168.0.0/16
image: public.ecr.aws/eks-anywhere/hegel:latest
kubevip:
deploy: false
image: public.ecr.aws/eks-anywhere/kube-vip:latest
namespace: eksa-system
rufio:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ hegel:
value: 192.168.0.0/16
image: public.ecr.aws/eks-anywhere/hegel:latest
kubevip:
deploy: false
image: public.ecr.aws/eks-anywhere/kube-vip:latest
namespace: eksa-system
rufio:
Expand Down
4 changes: 4 additions & 0 deletions pkg/providers/tinkerbell/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/aws/eks-anywhere/pkg/constants"
"github.com/aws/eks-anywhere/pkg/providers/tinkerbell/hardware"
"github.com/aws/eks-anywhere/pkg/providers/tinkerbell/rufiounreleased"
"github.com/aws/eks-anywhere/pkg/providers/tinkerbell/stack"
"github.com/aws/eks-anywhere/pkg/types"
"github.com/aws/eks-anywhere/pkg/utils/yaml"
)
Expand Down Expand Up @@ -456,6 +457,9 @@ func (p *Provider) PreCoreComponentsUpgrade(
p.datacenterConfig.Spec.TinkerbellIP,
cluster.KubeconfigFile,
p.datacenterConfig.Spec.HookImagesURLPath,
stack.WithLoadBalancerEnabled(
len(clusterSpec.Cluster.Spec.WorkerNodeGroupConfigurations) != 0 && // load balancer is handled by kube-vip in control plane nodes
!p.datacenterConfig.Spec.SkipLoadBalancerDeployment), // configure load balancer based on datacenterConfig.Spec.SkipLoadBalancerDeployment
)
if err != nil {
return fmt.Errorf("upgrading stack: %v", err)
Expand Down
5 changes: 5 additions & 0 deletions pkg/providers/tinkerbell/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func TestProviderPreCoreComponentsUpgrade_StackUpgradeError(t *testing.T) {
tconfig.DatacenterConfig.Spec.TinkerbellIP,
tconfig.Management.KubeconfigFile,
tconfig.DatacenterConfig.Spec.HookImagesURLPath,
gomock.Any(),
).
Return(errors.New(expect))

Expand All @@ -108,6 +109,7 @@ func TestProviderPreCoreComponentsUpgrade_HasBaseboardManagementCRDError(t *test
tconfig.TinkerbellIP,
tconfig.Management.KubeconfigFile,
tconfig.DatacenterConfig.Spec.HookImagesURLPath,
gomock.Any(),
).
Return(nil)

Expand Down Expand Up @@ -143,6 +145,7 @@ func TestProviderPreCoreComponentsUpgrade_NoBaseboardManagementCRD(t *testing.T)
tconfig.TinkerbellIP,
tconfig.Management.KubeconfigFile,
tconfig.DatacenterConfig.Spec.HookImagesURLPath,
gomock.Any(),
).
Return(nil)

Expand Down Expand Up @@ -454,6 +457,7 @@ func TestProviderPreCoreComponentsUpgrade_RufioConversions(t *testing.T) {
tconfig.DatacenterConfig.Spec.TinkerbellIP,
tconfig.Management.KubeconfigFile,
tconfig.DatacenterConfig.Spec.HookImagesURLPath,
gomock.Any(),
).
Return(nil)
tconfig.KubeClient.EXPECT().
Expand Down Expand Up @@ -624,6 +628,7 @@ func (t *PreCoreComponentsUpgradeTestConfig) WithStackUpgrade() *PreCoreComponen
t.TinkerbellIP,
t.Management.KubeconfigFile,
t.DatacenterConfig.Spec.HookImagesURLPath,
gomock.Any(),
).
Return(nil)
t.KubeClient.EXPECT().
Expand Down

0 comments on commit 8c135ab

Please sign in to comment.