Skip to content

Commit

Permalink
[APIT-893] Schema Registry on Private Link (#2866)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmalikconfluent authored Sep 4, 2024
1 parent 2c14f84 commit d35288c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
github.com/confluentinc/ccloud-sdk-go-v2/networking-privatelink v0.2.0
github.com/confluentinc/ccloud-sdk-go-v2/org v0.9.0
github.com/confluentinc/ccloud-sdk-go-v2/service-quota v0.2.0
github.com/confluentinc/ccloud-sdk-go-v2/srcm v0.6.0
github.com/confluentinc/ccloud-sdk-go-v2/srcm v0.7.0
github.com/confluentinc/ccloud-sdk-go-v2/sso v0.0.1
github.com/confluentinc/ccloud-sdk-go-v2/stream-designer v0.3.0
github.com/confluentinc/confluent-kafka-go v1.9.3-RC3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ github.com/confluentinc/ccloud-sdk-go-v2/org v0.9.0 h1:FtaqHX0kBTK7fCQK+9SJcOso+
github.com/confluentinc/ccloud-sdk-go-v2/org v0.9.0/go.mod h1:X0uaTYPp+mr19W1R/Z1LuB1ePZJZrH7kxnQckDx6zoc=
github.com/confluentinc/ccloud-sdk-go-v2/service-quota v0.2.0 h1:xVSmwdycExze1E2Jta99CaFuMOlL6k6KExOOSY1hSFg=
github.com/confluentinc/ccloud-sdk-go-v2/service-quota v0.2.0/go.mod h1:zZWZoGWJuO0Qm4lO6H2KlXMx4OoB/yhD8y6J1ZB/97Q=
github.com/confluentinc/ccloud-sdk-go-v2/srcm v0.6.0 h1:BfhTmbkEWaRbvWZ4mxzkAE9/0DVBClClO34GibG8OkM=
github.com/confluentinc/ccloud-sdk-go-v2/srcm v0.6.0/go.mod h1:qY4Y/QCDKI0eR+HLVJWGFstsTAiI83+sowKOyoRFhF0=
github.com/confluentinc/ccloud-sdk-go-v2/srcm v0.7.0 h1:BFab+P8PHLsmmPfg/K7eguW1wE9mlL1sLYlvZxVzWH8=
github.com/confluentinc/ccloud-sdk-go-v2/srcm v0.7.0/go.mod h1:9JegVbJxJf/F5q5YZKd1GC2fwh1lBvkqXuRG8yk5zV8=
github.com/confluentinc/ccloud-sdk-go-v2/sso v0.0.1 h1:WZJYfgXJrvTIYQpCFps/qHF7T8ekgPlX/SFqx4EY2zQ=
github.com/confluentinc/ccloud-sdk-go-v2/sso v0.0.1/go.mod h1:kB+MXWYYg9ohrTCb27LlfpTbuexAzyYAmum105ow0ho=
github.com/confluentinc/ccloud-sdk-go-v2/stream-designer v0.3.0 h1:zI59UpVm88hQn+dG4KO3TRxD2xdSVQbg5aqSm9/3LXo=
Expand Down
6 changes: 5 additions & 1 deletion internal/schema-registry/command_cluster_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import (
type clusterOut struct {
Name string `human:"Name" serialized:"name"`
Cluster string `human:"Cluster" serialized:"cluster"`
EndpointUrl string `human:"Endpoint URL" serialized:"endpoint_url"`
EndpointUrl string `human:"Endpoint URL,omitempty" serialized:"endpoint_url,omitempty"`
PrivateEndpointUrl string `human:"Private Endpoint URL,omitempty" serialized:"private_endpoint_url,omitempty"`
CatalogEndpointUrl string `human:"Catalog Endpoint URL,omitempty" serialized:"catalog_endpoint_url,omitempty"`
UsedSchemas string `human:"Used Schemas" serialized:"used_schemas"`
AvailableSchemas string `human:"Available Schemas" serialized:"available_schemas"`
FreeSchemasLimit int `human:"Free Schemas Limit" serialized:"free_schemas_limit"`
Expand Down Expand Up @@ -139,6 +141,8 @@ func (c *command) clusterDescribe(cmd *cobra.Command, _ []string) error {
Name: cluster.Spec.GetDisplayName(),
Cluster: cluster.GetId(),
EndpointUrl: cluster.Spec.GetHttpEndpoint(),
PrivateEndpointUrl: cluster.Spec.GetPrivateHttpEndpoint(),
CatalogEndpointUrl: cluster.Spec.GetCatalogHttpEndpoint(),
Cloud: cluster.Spec.GetCloud(),
Region: cluster.Spec.GetRegion(),
Package: cluster.Spec.GetPackage(),
Expand Down
6 changes: 5 additions & 1 deletion pkg/cmd/authenticated_cli_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ func (c *AuthenticatedCLICommand) GetSchemaRegistryClient(cmd *cobra.Command) (*
if len(clusters) == 0 {
return nil, errors.NewSRNotEnabledError()
}
configuration.Servers = srsdk.ServerConfigurations{{URL: clusters[0].Spec.GetHttpEndpoint()}}
if clusters[0].Spec.GetHttpEndpoint() != "" {
configuration.Servers = srsdk.ServerConfigurations{{URL: clusters[0].Spec.GetHttpEndpoint()}}
} else {
configuration.Servers = srsdk.ServerConfigurations{{URL: clusters[0].Spec.GetPrivateHttpEndpoint()}}
}
configuration.DefaultHeader = map[string]string{"target-sr-cluster": clusters[0].GetId()}
} else {
return nil, errors.NewErrorWithSuggestions(
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/output/schema-registry/cluster/describe.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
| Name | account schema-registry |
| Cluster | lsrc-1234 |
| Endpoint URL | http://127.0.0.1:1027 |
| Private Endpoint URL | http://127.0.0.1:1029 |
| Catalog Endpoint URL | http://127.0.0.1:1030 |
| Used Schemas | 0 |
| Available Schemas | 1000 |
| Free Schemas Limit | 1000 |
Expand Down
14 changes: 8 additions & 6 deletions test/test-server/srcm_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ func getSchemaRegistryClusterV3(packageType, endpoint string) srcmv3.SrcmV3Clust
return srcmv3.SrcmV3Cluster{
Id: srcmv3.PtrString(srClusterId),
Spec: &srcmv3.SrcmV3ClusterSpec{
DisplayName: srcmv3.PtrString("account schema-registry"),
Package: &packageType,
HttpEndpoint: &endpoint,
Environment: &srcmv3.GlobalObjectReference{Id: SRApiEnvId},
Region: srcmv3.PtrString(regionSpec),
Cloud: srcmv3.PtrString(cloudSpec),
DisplayName: srcmv3.PtrString("account schema-registry"),
Package: srcmv3.PtrString(packageType),
HttpEndpoint: srcmv3.PtrString(endpoint),
PrivateHttpEndpoint: srcmv3.PtrString("http://127.0.0.1:1029"),
CatalogHttpEndpoint: srcmv3.PtrString("http://127.0.0.1:1030"),
Environment: &srcmv3.GlobalObjectReference{Id: SRApiEnvId},
Region: srcmv3.PtrString(regionSpec),
Cloud: srcmv3.PtrString(cloudSpec),
},
Status: &srcmv3.SrcmV3ClusterStatus{Phase: srClusterStatus},
}
Expand Down

0 comments on commit d35288c

Please sign in to comment.