Skip to content

Commit

Permalink
chore: add field for internal web UI use to identify product context (#…
Browse files Browse the repository at this point in the history
…5342)

* add product context

* fix lint
  • Loading branch information
cjmanna authored Oct 27, 2022
1 parent 0d4281e commit 781716f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions harness/determined/common/api/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def to_json(self) -> typing.Any:
"inProgress": self.inProgress if self.inProgress is not None else None,
}

class GetMasterResponseProduct(enum.Enum):
PRODUCT_UNSPECIFIED = "PRODUCT_UNSPECIFIED"
PRODUCT_COMMUNITY = "PRODUCT_COMMUNITY"

class GetTrialWorkloadsRequestFilterOption(enum.Enum):
FILTER_OPTION_UNSPECIFIED = "FILTER_OPTION_UNSPECIFIED"
FILTER_OPTION_CHECKPOINT = "FILTER_OPTION_CHECKPOINT"
Expand Down Expand Up @@ -2541,6 +2545,7 @@ def __init__(
externalLoginUri: "typing.Optional[str]" = None,
externalLogoutUri: "typing.Optional[str]" = None,
featureSwitches: "typing.Optional[typing.Sequence[str]]" = None,
product: "typing.Optional[GetMasterResponseProduct]" = None,
rbacEnabled: "typing.Optional[bool]" = None,
ssoProviders: "typing.Optional[typing.Sequence[v1SSOProvider]]" = None,
telemetryEnabled: "typing.Optional[bool]" = None,
Expand All @@ -2555,6 +2560,7 @@ def __init__(
self.externalLogoutUri = externalLogoutUri
self.branding = branding
self.rbacEnabled = rbacEnabled
self.product = product
self.featureSwitches = featureSwitches

@classmethod
Expand All @@ -2570,6 +2576,7 @@ def from_json(cls, obj: Json) -> "v1GetMasterResponse":
externalLogoutUri=obj.get("externalLogoutUri", None),
branding=obj.get("branding", None),
rbacEnabled=obj.get("rbacEnabled", None),
product=GetMasterResponseProduct(obj["product"]) if obj.get("product", None) is not None else None,
featureSwitches=obj.get("featureSwitches", None),
)

Expand All @@ -2585,6 +2592,7 @@ def to_json(self) -> typing.Any:
"externalLogoutUri": self.externalLogoutUri if self.externalLogoutUri is not None else None,
"branding": self.branding if self.branding is not None else None,
"rbacEnabled": self.rbacEnabled if self.rbacEnabled is not None else None,
"product": self.product.value if self.product is not None else None,
"featureSwitches": self.featureSwitches if self.featureSwitches is not None else None,
}

Expand Down
5 changes: 5 additions & 0 deletions master/internal/api_master.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ var masterLogsBatchMissWaitTime = time.Second
func (a *apiServer) GetMaster(
_ context.Context, _ *apiv1.GetMasterRequest,
) (*apiv1.GetMasterResponse, error) {
product := apiv1.GetMasterResponse_PRODUCT_UNSPECIFIED
if len(a.m.config.InternalConfig.ExternalSessions.LoginURI) > 1 {
product = apiv1.GetMasterResponse_PRODUCT_COMMUNITY
}
masterResp := &apiv1.GetMasterResponse{
Version: version.Version,
MasterId: a.m.MasterID,
Expand All @@ -34,6 +38,7 @@ func (a *apiServer) GetMaster(
ExternalLogoutUri: a.m.config.InternalConfig.ExternalSessions.LogoutURI,
Branding: "determined",
RbacEnabled: config.GetAuthZConfig().IsRBACUIEnabled(),
Product: product,
FeatureSwitches: a.m.config.FeatureSwitches,
}
sso.AddProviderInfoToMasterResponse(a.m.config, masterResp)
Expand Down
9 changes: 9 additions & 0 deletions proto/src/determined/api/v1/master.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ message GetMasterResponse {
required: [ "version", "master_id", "cluster_id", "cluster_name" ]
}
};
// Different kinds of Determined Cloud offerings
enum Product {
// Not a Cloud Community offering
PRODUCT_UNSPECIFIED = 0;
// Determined Cloud, Community Edition
PRODUCT_COMMUNITY = 1;
}
// The current version of the master.
string version = 1;
// The current instance id of the master.
Expand All @@ -50,6 +57,8 @@ message GetMasterResponse {
string branding = 9;
// Feature flag for RBAC and user groups.
bool rbac_enabled = 10;
// What kind of product offering the cluster is part of, if any
Product product = 11;
// List of features that is on.
repeated string feature_switches = 12;
}
Expand Down
16 changes: 16 additions & 0 deletions webui/react/src/services/api-ts-sdk/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,16 @@ export interface GetHPImportanceResponseMetricHPImportance {
inProgress?: boolean;
}

/**
* - PRODUCT_UNSPECIFIED: Not a Cloud Community offering - PRODUCT_COMMUNITY: Determined Cloud, Community Edition
* @export
* @enum {string}
*/
export enum GetMasterResponseProduct {
UNSPECIFIED = <any> 'PRODUCT_UNSPECIFIED',
COMMUNITY = <any> 'PRODUCT_COMMUNITY'
}

/**
* Filter workloads with training, validation, and checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint.
* @export
Expand Down Expand Up @@ -3141,6 +3151,12 @@ export interface V1GetMasterResponse {
* @memberof V1GetMasterResponse
*/
rbacEnabled?: boolean;
/**
*
* @type {GetMasterResponseProduct}
* @memberof V1GetMasterResponse
*/
product?: GetMasterResponseProduct;
/**
* List of features that is on.
* @type {Array<string>}
Expand Down

0 comments on commit 781716f

Please sign in to comment.