Skip to content

Commit

Permalink
Merge pull request #738 from mjura/external-v2.9
Browse files Browse the repository at this point in the history
[v2.9] Fix Rancher integration for BuildUpstreamClusterState
  • Loading branch information
mjura committed Aug 7, 2024
2 parents 670e34c + 3897556 commit 326cc29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controller/eks-cluster-config-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (h *Handler) checkAndUpdate(ctx context.Context, config *eksv1.EKSClusterCo
return h.eksCC.UpdateStatus(config)
}

upstreamSpec, clusterARN, err := BuildUpstreamClusterState(ctx, config.Spec.DisplayName, config.Status.ManagedLaunchTemplateID, clusterState, nodeGroupStates, awsSVCs, true)
upstreamSpec, clusterARN, err := BuildUpstreamClusterState(ctx, config.Spec.DisplayName, config.Status.ManagedLaunchTemplateID, clusterState, nodeGroupStates, awsSVCs.ec2, awsSVCs.eks, true)
if err != nil {
return config, err
}
Expand Down
6 changes: 3 additions & 3 deletions controller/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NodeGroupIssueIsUpdatable(code string) bool {
}

// BuildUpstreamClusterState builds the upstream cluster state from the given eks cluster and node group states.
func BuildUpstreamClusterState(ctx context.Context, name, managedTemplateID string, clusterState *eks.DescribeClusterOutput, nodeGroupStates []*eks.DescribeNodegroupOutput, awsSVCs *awsServices, includeManagedLaunchTemplate bool) (*eksv1.EKSClusterConfigSpec, string, error) {
func BuildUpstreamClusterState(ctx context.Context, name, managedTemplateID string, clusterState *eks.DescribeClusterOutput, nodeGroupStates []*eks.DescribeNodegroupOutput, ec2Service services.EC2ServiceInterface, eksService services.EKSServiceInterface, includeManagedLaunchTemplate bool) (*eksv1.EKSClusterConfigSpec, string, error) {
upstreamSpec := &eksv1.EKSClusterConfigSpec{}

upstreamSpec.Imported = true
Expand Down Expand Up @@ -101,7 +101,7 @@ func BuildUpstreamClusterState(ctx context.Context, name, managedTemplateID stri

// set ebs csi driver
upstreamSpec.EBSCSIDriver = aws.Bool(false)
currentARN, err := awsservices.CheckEBSAddon(ctx, name, awsSVCs.eks)
currentARN, err := awsservices.CheckEBSAddon(ctx, name, eksService)
if err != nil {
return nil, "", fmt.Errorf("error checking if ebs csi driver addon is installed: %w", err)
}
Expand Down Expand Up @@ -153,7 +153,7 @@ func BuildUpstreamClusterState(ctx context.Context, name, managedTemplateID stri
if managedTemplateID == aws.ToString(ngToAdd.LaunchTemplate.ID) {
// If this is a rancher-managed launch template, then we move the data from the launch template to the node group.
launchTemplateRequestOutput, err := awsservices.GetLaunchTemplateVersions(ctx, &awsservices.GetLaunchTemplateVersionsOpts{
EC2Service: awsSVCs.ec2,
EC2Service: ec2Service,
LaunchTemplateID: ngToAdd.LaunchTemplate.ID,
Versions: []*string{ng.Nodegroup.LaunchTemplate.Version},
})
Expand Down

0 comments on commit 326cc29

Please sign in to comment.