Skip to content

Commit

Permalink
fix: correct rebase errors for allow privatelink/psc with no allowed …
Browse files Browse the repository at this point in the history
…principals

Rebase error, ctx was removed in f9d2e63 but ListValueFrom(ctx, ...) was
added in 492d69c.
  • Loading branch information
ligfx committed Nov 7, 2024
1 parent 91bfd31 commit 0c492cc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions redpanda/resources/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,15 @@ func generateModel(cfg models.Cluster, cluster *controlplanev1beta2.Cluster) (*m
}

if !isAwsPrivateLinkSpecNil(cluster.AwsPrivateLink) {
ap, dg := types.ListValueFrom(ctx, types.StringType, cluster.AwsPrivateLink.AllowedPrincipals)
if dg.HasError() {
return nil, fmt.Errorf("failed to parse AWS Private Link: %v", dg)
}
ap := utils.StringSliceToTypeList(cluster.AwsPrivateLink.AllowedPrincipals)
if ap.IsNull() {
// this must match the user's plan, which is currently required to be non-null
ap = types.ListValueMust(types.StringType, []attr.Value{})
}
output.AwsPrivateLink = &models.AwsPrivateLink{
Enabled: types.BoolValue(cluster.AwsPrivateLink.Enabled),
ConnectConsole: types.BoolValue(cluster.AwsPrivateLink.ConnectConsole),
AllowedPrincipals: utils.StringSliceToTypeList(cluster.AwsPrivateLink.AllowedPrincipals),
AllowedPrincipals: ap,
}
}
if !isGcpPrivateServiceConnectSpecNil(cluster.GcpPrivateServiceConnect) {
Expand All @@ -313,18 +310,15 @@ func generateModel(cfg models.Cluster, cluster *controlplanev1beta2.Cluster) (*m
}

if !isAzurePrivateLinkSpecNil(cluster.AzurePrivateLink) {
as, dg := types.ListValueFrom(ctx, types.StringType, cluster.AzurePrivateLink.AllowedSubscriptions)
if dg.HasError() {
return nil, fmt.Errorf("failed to parse Azure Private Link: %v", dg)
}
as := utils.StringSliceToTypeList(cluster.AzurePrivateLink.AllowedSubscriptions)
if as.IsNull() {
// this must match the user's plan, which is currently required to be non-null
as = types.ListValueMust(types.StringType, []attr.Value{})
}
output.AzurePrivateLink = &models.AzurePrivateLink{
Enabled: types.BoolValue(cluster.AzurePrivateLink.Enabled),
ConnectConsole: types.BoolValue(cluster.AzurePrivateLink.ConnectConsole),
AllowedSubscriptions: utils.StringSliceToTypeList(cluster.AzurePrivateLink.AllowedSubscriptions),
AllowedSubscriptions: as,
}
}
kAPI := toMtlsModel(cluster.GetKafkaApi().GetMtls())
Expand Down

0 comments on commit 0c492cc

Please sign in to comment.