From e26dce16c3d7c8c7f7911a7da88b830ad62cfe14 Mon Sep 17 00:00:00 2001 From: emilys314 Date: Mon, 29 Jul 2024 16:34:52 -0400 Subject: [PATCH] Add disableConnectionTypes feature flag --- backend/src/types.ts | 1 + backend/src/utils/constants.ts | 1 + docs/dashboard-config.md | 2 ++ frontend/src/__mocks__/mockDashboardConfig.ts | 3 +++ frontend/src/concepts/areas/const.ts | 4 ++++ frontend/src/concepts/areas/types.ts | 2 ++ .../concepts/connectionTypes/useConnectionTypesEnabled.ts | 6 ++++++ frontend/src/k8sTypes.ts | 1 + .../common/crd/odhdashboardconfigs.opendatahub.io.crd.yaml | 2 ++ .../rhoai/shared/odhdashboardconfig/odhdashboardconfig.yaml | 1 + 10 files changed, 23 insertions(+) create mode 100644 frontend/src/concepts/connectionTypes/useConnectionTypesEnabled.ts diff --git a/backend/src/types.ts b/backend/src/types.ts index 7164d4e883..0da7f13d37 100644 --- a/backend/src/types.ts +++ b/backend/src/types.ts @@ -41,6 +41,7 @@ export type DashboardConfig = K8sResourceCommon & { disableArtifactsAPI: boolean; disableDistributedWorkloads: boolean; disableModelRegistry: boolean; + disableConnectionTypes: boolean; }; groupsConfig?: { adminGroups: string; diff --git a/backend/src/utils/constants.ts b/backend/src/utils/constants.ts index 131fd61a49..f5da341c67 100644 --- a/backend/src/utils/constants.ts +++ b/backend/src/utils/constants.ts @@ -66,6 +66,7 @@ export const blankDashboardCR: DashboardConfig = { disableArtifactsAPI: true, disableDistributedWorkloads: false, disableModelRegistry: true, + disableConnectionTypes: true, }, notebookController: { enabled: true, diff --git a/docs/dashboard-config.md b/docs/dashboard-config.md index f26796f013..c6dd9a404f 100644 --- a/docs/dashboard-config.md +++ b/docs/dashboard-config.md @@ -34,6 +34,7 @@ The following are a list of features that are supported, along with there defaul | disablePerformanceMetrics | false | Disables Endpoint Performance tab from Model Serving metrics. | | disableDistributedWorkloads | false | Disables Distributed Workload Metrics from the dashboard. | | disableModelRegistry | true | Disables Model Registry from the dashboard. | +| disableConnectionTypes | true | Disables creating custom data connection types from the dashboard. | ## Defaults @@ -65,6 +66,7 @@ spec: disableS3Endpoint: true disableArtifactsAPI: true disableDistributedWorkloads: false + disableConnectionTypes: false ``` ## Additional fields diff --git a/frontend/src/__mocks__/mockDashboardConfig.ts b/frontend/src/__mocks__/mockDashboardConfig.ts index 5524291a43..805dc08630 100644 --- a/frontend/src/__mocks__/mockDashboardConfig.ts +++ b/frontend/src/__mocks__/mockDashboardConfig.ts @@ -27,6 +27,7 @@ type MockDashboardConfigType = { disableArtifactsAPI?: boolean; disableDistributedWorkloads?: boolean; disableModelRegistry?: boolean; + disableConnectionTypes?: boolean; disableNotebookController?: boolean; notebookSizes?: NotebookSize[]; }; @@ -57,6 +58,7 @@ export const mockDashboardConfig = ({ disableArtifactsAPI = true, disableDistributedWorkloads = false, disableModelRegistry = true, + disableConnectionTypes = true, disableNotebookController = false, notebookSizes = [ { @@ -164,6 +166,7 @@ export const mockDashboardConfig = ({ disableArtifactsAPI, disableDistributedWorkloads, disableModelRegistry, + disableConnectionTypes, }, notebookController: { enabled: !disableNotebookController, diff --git a/frontend/src/concepts/areas/const.ts b/frontend/src/concepts/areas/const.ts index 1cbc89bc0a..d10e8ad62d 100644 --- a/frontend/src/concepts/areas/const.ts +++ b/frontend/src/concepts/areas/const.ts @@ -29,6 +29,7 @@ export const allFeatureFlags: string[] = Object.keys({ disableArtifactsAPI: false, disableDistributedWorkloads: false, disableModelRegistry: false, + disableConnectionTypes: false, } satisfies DashboardCommonConfig); export const SupportedAreasStateMap: SupportedAreasState = { @@ -123,4 +124,7 @@ export const SupportedAreasStateMap: SupportedAreasState = { requiredComponents: [StackComponent.MODEL_REGISTRY], requiredCapabilities: [StackCapability.SERVICE_MESH, StackCapability.SERVICE_MESH_AUTHZ], }, + [SupportedArea.DATA_CONNECTIONS_TYPES]: { + featureFlags: ['disableConnectionTypes'], + }, }; diff --git a/frontend/src/concepts/areas/types.ts b/frontend/src/concepts/areas/types.ts index db131d880f..bd1b4c9c10 100644 --- a/frontend/src/concepts/areas/types.ts +++ b/frontend/src/concepts/areas/types.ts @@ -61,6 +61,8 @@ export enum SupportedArea { /* Model Registry areas */ MODEL_REGISTRY = 'model-registry', + + DATA_CONNECTIONS_TYPES = 'data-connections-types', } /** Components deployed by the Operator. Part of the DSC Status. */ diff --git a/frontend/src/concepts/connectionTypes/useConnectionTypesEnabled.ts b/frontend/src/concepts/connectionTypes/useConnectionTypesEnabled.ts new file mode 100644 index 0000000000..0106da69be --- /dev/null +++ b/frontend/src/concepts/connectionTypes/useConnectionTypesEnabled.ts @@ -0,0 +1,6 @@ +import { SupportedArea, useIsAreaAvailable } from '~/concepts/areas'; + +const useConnectionTypesEnabled = (): boolean => + useIsAreaAvailable(SupportedArea.DATA_CONNECTIONS_TYPES).status; + +export default useConnectionTypesEnabled; diff --git a/frontend/src/k8sTypes.ts b/frontend/src/k8sTypes.ts index 28847a5cc1..4805772c98 100644 --- a/frontend/src/k8sTypes.ts +++ b/frontend/src/k8sTypes.ts @@ -1239,6 +1239,7 @@ export type DashboardCommonConfig = { disableArtifactsAPI: boolean; disableDistributedWorkloads: boolean; disableModelRegistry: boolean; + disableConnectionTypes: boolean; }; export type DashboardConfigKind = K8sResourceCommon & { diff --git a/manifests/common/crd/odhdashboardconfigs.opendatahub.io.crd.yaml b/manifests/common/crd/odhdashboardconfigs.opendatahub.io.crd.yaml index fb49e77472..08e1e2edc4 100644 --- a/manifests/common/crd/odhdashboardconfigs.opendatahub.io.crd.yaml +++ b/manifests/common/crd/odhdashboardconfigs.opendatahub.io.crd.yaml @@ -75,6 +75,8 @@ spec: type: boolean disableModelRegistry: type: boolean + disableConnectionTypes: + type: boolean groupsConfig: type: object required: diff --git a/manifests/rhoai/shared/odhdashboardconfig/odhdashboardconfig.yaml b/manifests/rhoai/shared/odhdashboardconfig/odhdashboardconfig.yaml index 4ada7120d9..9b7afc0fd4 100644 --- a/manifests/rhoai/shared/odhdashboardconfig/odhdashboardconfig.yaml +++ b/manifests/rhoai/shared/odhdashboardconfig/odhdashboardconfig.yaml @@ -28,6 +28,7 @@ spec: disableModelMesh: false disableDistributedWorkloads: false disableModelRegistry: true + disableConnectionTypes: true groupsConfig: adminGroups: "$(admin_groups)" allowedGroups: "system:authenticated"