Skip to content

Commit

Permalink
Revert " Allow VizierID to be used to find the Vizier's org" (#1666)
Browse files Browse the repository at this point in the history
Summary: After testing the interaction between the operator and config
manager service, it seems that the config manager service segmentation
faults when it receives the VizierID from the operator as it's not able
to properly convert it to type uuid, causing the service to restart.
This needs to be fixed and in the meantime these changes should be
reverted.

Relevant Issues: #1632

Type of change: /kind bug

Test Plan: Make sure it still builds

Signed-off-by: Kartik Pattaswamy <[email protected]>
  • Loading branch information
kpattaswamy authored Aug 11, 2023
1 parent 6984448 commit 69415c0
Show file tree
Hide file tree
Showing 7 changed files with 408 additions and 563 deletions.
789 changes: 366 additions & 423 deletions src/api/proto/cloudpb/cloudapi.pb.go

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/api/proto/cloudpb/cloudapi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,6 @@ message ConfigForVizierRequest {
vizierconfigpb.VizierSpec vz_spec = 2;
// Kubernetes version of the cluster Vizier is running on.
string k8s_version = 3 [ (gogoproto.customname) = "K8sVersion" ];
// ID of the Vizier (Cluster ID).
string vizier_id = 4 [ (gogoproto.customname) = "VizierID" ];
}

// ConfigForVizierResponse is the response to a ConfigForVizierRequest.
Expand Down
1 change: 0 additions & 1 deletion src/cloud/api/controllers/config_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func (c *ConfigServiceServer) GetConfigForVizier(ctx context.Context,
Registry: vizSpecReq.Registry,
},
K8sVersion: req.K8sVersion,
VizierID: req.VizierID,
})
if err != nil {
return nil, err
Expand Down
22 changes: 1 addition & 21 deletions src/cloud/config_manager/config_manager_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,6 @@ func newDeploymentKeyClient() (vzmgrpb.VZDeploymentKeyServiceClient, error) {
return vzmgrpb.NewVZDeploymentKeyServiceClient(deployKeyChannel), nil
}

func newVizierManagerClient() (vzmgrpb.VZMgrServiceClient, error) {
dialOpts, err := services.GetGRPCClientDialOpts()
if err != nil {
return nil, err
}

vizierManagerChannel, err := grpc.Dial(viper.GetString("vzmgr_service"), dialOpts...)
if err != nil {
return nil, err
}

return vzmgrpb.NewVZMgrServiceClient(vizierManagerChannel), nil
}

func main() {
services.SetupService("config-manager-service", 50500)
services.PostFlagSetupAndParse()
Expand All @@ -107,13 +93,7 @@ func main() {
if err != nil {
log.WithError(err).Fatal("Could not connect with Artifact Service.")
}

vzmgrClient, err := newVizierManagerClient()
if err != nil {
log.WithError(err).Fatal("Could not connect with VizierManager Service.")
}

svr := controllers.NewServer(atClient, deployKeyClient, viper.GetString("ld_sdk_key"), vzmgrClient)
svr := controllers.NewServer(atClient, deployKeyClient, viper.GetString("ld_sdk_key"))
serverOpts := &server.GRPCServerOptions{
DisableAuth: map[string]bool{
"/px.services.ConfigManagerService/GetConfigForVizier": true,
Expand Down
130 changes: 36 additions & 94 deletions src/cloud/config_manager/configmanagerpb/service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/cloud/config_manager/configmanagerpb/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ message ConfigForVizierRequest {
vizierconfigpb.VizierSpec vz_spec = 2;
// Kubernetes version of the cluster Vizier is running on.
string k8s_version = 3 [ (gogoproto.customname) = "K8sVersion" ];
// ID of the Vizier (Cluster ID).
string vizier_id = 4 [ (gogoproto.customname) = "VizierID" ];
}

// ConfigForVizierResponse is the response to a ConfigForVizierRequest.
Expand Down
25 changes: 5 additions & 20 deletions src/cloud/config_manager/controllers/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,14 @@ type Server struct {
atClient atpb.ArtifactTrackerClient
deployKeyClient vzmgrpb.VZDeploymentKeyServiceClient
vzFeatureFlagClient VizierFeatureFlagClient
vzmgrClient vzmgrpb.VZMgrServiceClient
}

// NewServer creates GRPC handlers.
func NewServer(atClient atpb.ArtifactTrackerClient, deployKeyClient vzmgrpb.VZDeploymentKeyServiceClient, ldSDKKey string, vzmgrClient vzmgrpb.VZMgrServiceClient) *Server {
func NewServer(atClient atpb.ArtifactTrackerClient, deployKeyClient vzmgrpb.VZDeploymentKeyServiceClient, ldSDKKey string) *Server {
return &Server{
atClient: atClient,
deployKeyClient: deployKeyClient,
vzFeatureFlagClient: NewVizierFeatureFlagClient(ldSDKKey),
vzmgrClient: vzmgrClient,
}
}

Expand Down Expand Up @@ -219,25 +217,12 @@ func (s *Server) GetConfigForVizier(ctx context.Context,
}
AddDefaultTableStoreSize(tmplValues.PEMMemoryRequest, tmplValues.CustomPEMFlags)

// Attempt to get the org ID from DeployKey, otherwise from the Vizier.
var orgID uuid.UUID
orgID, err = s.getOrgIDForDeployKey(tmplValues.DeployKey)
if err != nil || orgID == uuid.Nil {
log.WithError(err).Error("Error getting org ID from deploy key")
}
if orgID == uuid.Nil && in.VizierID != "" {
resp, err := s.vzmgrClient.GetOrgFromVizier(ctx, utils.ProtoFromUUIDStrOrNil(in.VizierID))
orgID = utils.UUIDFromProtoOrNil(resp.OrgID)
if err != nil || orgID == uuid.Nil {
log.WithError(err).Error("Error getting org ID from Vizier")
}
}

// Next we inject any feature flags that we want to set for this org.
if orgID != uuid.Nil {
AddFeatureFlagsToTemplate(s.vzFeatureFlagClient, orgID, tmplValues)
orgID, err := s.getOrgIDForDeployKey(tmplValues.DeployKey)
if err != nil || orgID == uuid.Nil {
log.WithError(err).Error("Error getting org ID from deploy key, skipping feature flag logic")
} else {
log.Error("Skipping feature flag logic")
AddFeatureFlagsToTemplate(s.vzFeatureFlagClient, orgID, tmplValues)
}

vzYamls, err := yamls.ExecuteTemplatedYAMLs(templatedYAMLs, vizieryamls.VizierTmplValuesToArgs(tmplValues))
Expand Down

0 comments on commit 69415c0

Please sign in to comment.