From 8a179fe6618d0586a7a9f4fe3f757ecb16189abd Mon Sep 17 00:00:00 2001 From: r-vasquez Date: Thu, 24 Oct 2024 15:56:45 -0700 Subject: [PATCH] rpk: fill schema registry information in cloud profiles This is available in all of our cloud deployments. (cherry picked from commit 1392dd764a2f4107a60459ab2ecd2ab706a4ee1f) --- src/go/rpk/pkg/cli/profile/create.go | 11 +++++++++++ src/go/rpk/pkg/cloudapi/api_virtual_cluster.go | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/go/rpk/pkg/cli/profile/create.go b/src/go/rpk/pkg/cli/profile/create.go index 0af91ae2662e3..7e0bb277a93a1 100644 --- a/src/go/rpk/pkg/cli/profile/create.go +++ b/src/go/rpk/pkg/cli/profile/create.go @@ -497,6 +497,13 @@ func fromCloudCluster(yAuth *config.RpkCloudAuth, rg *controlplanev1beta2.Resour isMTLS = mtls.Enabled } } + if c.SchemaRegistry != nil { + p.SR.Addresses = []string{c.SchemaRegistry.Url} + p.SR.TLS = new(config.TLS) + if mtls := c.SchemaRegistry.Mtls; !isMTLS && mtls != nil { + isMTLS = mtls.Enabled + } + } return CloudClusterOutputs{ Profile: p, ResourceGroupName: rg.Name, @@ -522,6 +529,10 @@ func fromVirtualCluster(yAuth *config.RpkCloudAuth, rg *controlplanev1beta2.Reso Addresses: []string{vc.Status.Listeners.ConsoleURL}, TLS: new(config.TLS), }, + SR: config.RpkSchemaRegistryAPI{ + Addresses: vc.Status.Listeners.SchemaRegistryURL, + TLS: new(config.TLS), + }, CloudCluster: config.RpkCloudCluster{ ResourceGroup: rg.Name, ClusterID: vc.ID, diff --git a/src/go/rpk/pkg/cloudapi/api_virtual_cluster.go b/src/go/rpk/pkg/cloudapi/api_virtual_cluster.go index ce6a1ab566551..76ec294abbfa4 100644 --- a/src/go/rpk/pkg/cloudapi/api_virtual_cluster.go +++ b/src/go/rpk/pkg/cloudapi/api_virtual_cluster.go @@ -30,8 +30,9 @@ type ( Status struct { Listeners struct { - ConsoleURL string `json:"consoleUrl"` - SeedAddresses []string `json:"seedAddress"` + ConsoleURL string `json:"consoleUrl"` + SeedAddresses []string `json:"seedAddress"` + SchemaRegistryURL []string `json:"schemaRegistryUrl,omitempty"` } `json:"listeners"` } `json:"status"` }