Skip to content

Commit bccb48e

Browse files
committed
add to scope
1 parent a5d94e9 commit bccb48e

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

pkg/cloud/scope/managedcontrolplane.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ func (s *ManagedControlPlaneScope) BootstrapSelfManagedAddons() *bool {
430430
return &s.ControlPlane.Spec.BootstrapSelfManagedAddons
431431
}
432432

433+
// PreserveAddons returns whether the AWS EKS addons should be preserved in the case of removal from the manifest.
434+
func (s *ManagedControlPlaneScope) PreserveAddons() *bool {
435+
return &s.ControlPlane.Spec.PreserveAddons
436+
}
437+
433438
// VpcCni returns a list of environment variables to apply to the `aws-node` DaemonSet.
434439
func (s *ManagedControlPlaneScope) VpcCni() ekscontrolplanev1.VpcCni {
435440
return s.ControlPlane.Spec.VpcCni

pkg/eks/addons/plan.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ import (
2828
)
2929

3030
// NewPlan creates a new Plan to manage EKS addons.
31-
func NewPlan(clusterName string, desiredAddons, installedAddons []*EKSAddon, client eks.Client, maxWait time.Duration) planner.Plan {
31+
func NewPlan(clusterName string, desiredAddons, installedAddons []*EKSAddon, client eks.Client, maxWait time.Duration, preserveOnDelete bool) planner.Plan {
3232
return &plan{
3333
installedAddons: installedAddons,
3434
desiredAddons: desiredAddons,
3535
eksClient: client,
3636
clusterName: clusterName,
3737
maxWaitActiveUpdateDelete: maxWait,
38+
preserveOnDelete: preserveOnDelete,
3839
}
3940
}
4041

@@ -45,6 +46,7 @@ type plan struct {
4546
eksClient eks.Client
4647
clusterName string
4748
maxWaitActiveUpdateDelete time.Duration
49+
preserveOnDelete bool
4850
}
4951

5052
// Create will create the plan (i.e. list of procedures) for managing EKS addons.

pkg/eks/addons/procedures.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func (p *DeleteAddonProcedure) Do(ctx context.Context) error {
4949
input := &eks.DeleteAddonInput{
5050
AddonName: aws.String(p.name),
5151
ClusterName: aws.String(p.plan.clusterName),
52+
Preserve: p.plan.preserveOnDelete,
5253
}
5354

5455
if _, err := p.plan.eksClient.DeleteAddon(ctx, input); err != nil {

0 commit comments

Comments
 (0)