Skip to content

Commit

Permalink
fix: identify kafka cluster by externalName
Browse files Browse the repository at this point in the history
Signed-off-by: André Kesser <andre.kesser@dkb.de>
  • Loading branch information
André Kesser committed Apr 6, 2023
1 parent 6a4da3d commit 84c8547
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/controller/kafka/cluster/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,13 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
}
input := GenerateDescribeClusterInput(cr)

if cr.Status.AtProvider.ClusterARN != nil {
if meta.GetExternalName(cr) != "" {
obj, err := u.client.DescribeClusterWithContext(ctx, input)

if err != nil {
return managed.ExternalUpdate{}, awsclients.Wrap(err, errDescribe)
}
currentARN := cr.Status.AtProvider.ClusterARN
currentARN := meta.GetExternalName(cr)
currentVersion := obj.ClusterInfo.CurrentVersion
wanted := cr.Spec.ForProvider
if !isInstanceTypeUpToDate(wanted.CustomBrokerNodeGroupInfo, obj.ClusterInfo.BrokerNodeGroupInfo) {
Expand All @@ -588,7 +588,7 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
}
// UpdateBrokerTypeWithContext
input := &svcsdk.UpdateBrokerTypeInput{
ClusterArn: currentARN,
ClusterArn: &currentARN,
CurrentVersion: currentVersion,
TargetInstanceType: wanted.CustomBrokerNodeGroupInfo.InstanceType,
}
Expand All @@ -611,7 +611,7 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
return managed.ExternalUpdate{}, errors.New(errStateForUpdate)
}
input := &svcsdk.UpdateBrokerStorageInput{
ClusterArn: currentARN,
ClusterArn: &currentARN,
CurrentVersion: currentVersion,
TargetBrokerEBSVolumeInfo: []*svcsdk.BrokerEBSVolumeInfo{{
KafkaBrokerNodeId: aws.String("ALL"),
Expand Down Expand Up @@ -647,7 +647,7 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
return managed.ExternalUpdate{}, errors.New(errStateForUpdate)
}
input := &svcsdk.UpdateBrokerCountInput{
ClusterArn: currentARN,
ClusterArn: &currentARN,
CurrentVersion: currentVersion,
TargetNumberOfBrokerNodes: wanted.NumberOfBrokerNodes,
}
Expand All @@ -668,7 +668,7 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
return managed.ExternalUpdate{}, errors.New(errStateForUpdate)
}
input := &svcsdk.UpdateMonitoringInput{
ClusterArn: currentARN,
ClusterArn: &currentARN,
CurrentVersion: currentVersion,
EnhancedMonitoring: wanted.EnhancedMonitoring,
LoggingInfo: generateLoggingInfoInput(wanted.LoggingInfo),
Expand All @@ -692,7 +692,7 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
return managed.ExternalUpdate{}, errors.New(errStateForUpdate)
}
input := &svcsdk.UpdateClusterConfigurationInput{
ClusterArn: currentARN,
ClusterArn: &currentARN,
CurrentVersion: currentVersion,
ConfigurationInfo: generateCustomConfigurationInfo(wanted.CustomConfigurationInfo),
}
Expand All @@ -713,7 +713,7 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
return managed.ExternalUpdate{}, errors.New(errStateForUpdate)
}
input := &svcsdk.UpdateClusterKafkaVersionInput{
ClusterArn: currentARN,
ClusterArn: &currentARN,
CurrentVersion: currentVersion,
TargetKafkaVersion: wanted.KafkaVersion,
}
Expand All @@ -740,7 +740,7 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
return managed.ExternalUpdate{}, errors.New(errStateForUpdate)
}
input := &svcsdk.UpdateSecurityInput{
ClusterArn: currentARN,
ClusterArn: &currentARN,
CurrentVersion: currentVersion,
}

Expand Down Expand Up @@ -769,7 +769,7 @@ func (u *updater) update(ctx context.Context, mg cpresource.Managed) (managed.Ex
return managed.ExternalUpdate{}, errors.New(errStateForUpdate)
}
input := &svcsdk.TagResourceInput{
ResourceArn: currentARN,
ResourceArn: &currentARN,
Tags: generateTags(wanted.Tags),
}

Expand Down

0 comments on commit 84c8547

Please sign in to comment.