Skip to content

Commit

Permalink
SchemaEditor behind a feature flag (#5564)
Browse files Browse the repository at this point in the history
### Description of the change

As per the discussion in
#5530, this PR is adding a
`featureFlags.schemaEditor` flag to enable the schema editor for those
users who really want it.

### Benefits

The schema editor will be available, but only if really needed.

### Possible drawbacks

It is a work-in-progress feature until we also save the schema or use in
the backend.

### Applicable issues

- related #3535 

### Additional information

I've fixed some typos here as well.

Signed-off-by: Antonio Gamez Diaz <[email protected]>
  • Loading branch information
antgamdia authored Oct 26, 2022
1 parent e3fca14 commit 0ab3d3a
Show file tree
Hide file tree
Showing 36 changed files with 238 additions and 104 deletions.
2 changes: 1 addition & 1 deletion chart/kubeapps/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ maintainers:
name: kubeapps
sources:
- https://github.com/vmware-tanzu/kubeapps
version: 11.0.2-dev1
version: 11.1.0-dev0
19 changes: 13 additions & 6 deletions chart/kubeapps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,19 @@ Once you have installed Kubeapps follow the [Getting Started Guide](https://gith

### Other Parameters

| Name | Description | Value |
| ------------------------- | ----------------------------------------------------------------------------- | ------- |
| `allowNamespaceDiscovery` | Allow users to discover available namespaces (only the ones they have access) | `true` |
| `clusters` | List of clusters that Kubeapps can target for deployments | `[]` |
| `featureFlags.operators` | Enable ingress record generation for Kubeapps | `false` |
| `rbac.create` | Specifies whether RBAC resources should be created | `true` |
| Name | Description | Value |
| ------------------------- | ----------------------------------------------------------------------------- | ------ |
| `allowNamespaceDiscovery` | Allow users to discover available namespaces (only the ones they have access) | `true` |
| `clusters` | List of clusters that Kubeapps can target for deployments | `[]` |
| `rbac.create` | Specifies whether RBAC resources should be created | `true` |


### Feature flags

| Name | Description | Value |
| --------------------------- | ---------------------------------------------------------- | ------- |
| `featureFlags.operators` | Enable support for Operators in Kubeapps | `false` |
| `featureFlags.schemaEditor` | Enable a visual editor for customizing the package schemas | `false` |


### Database Parameters
Expand Down
18 changes: 11 additions & 7 deletions chart/kubeapps/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1417,20 +1417,24 @@ clusters:
- name: default
domain: cluster.local

## @skip featureFlags Feature flags (used to switch on development features)
##
featureFlags:
## @param featureFlags.operators Enable ingress record generation for Kubeapps
##
operators: false

## RBAC configuration
##
rbac:
## @param rbac.create Specifies whether RBAC resources should be created
##
create: true

## @section Feature flags

## Used enable some opt-in development features
##
featureFlags:
## @param featureFlags.operators Enable support for Operators in Kubeapps
operators: false
## @param featureFlags.schemaEditor Enable a visual editor for customizing the package schemas
##
schemaEditor: false

## @section Database Parameters

## PostgreSQL chart configuration
Expand Down
3 changes: 2 additions & 1 deletion dashboard/public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"oauthLogoutURI": "/oauth2/sign_out",
"clusters": ["default"],
"featureFlags": {
"operators": false
"operators": false,
"schemaEditor": false
},
"theme": "light",
"remoteComponentsUrl": "",
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/actions/config.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const testConfig = {
oauthLogoutURI: "",
authProxySkipLoginPage: false,
clusters: [],
featureFlags: { operators: false },
featureFlags: { operators: false, schemaEditor: false },
theme: SupportedThemes.light,
remoteComponentsUrl: "",
customAppViews: [],
Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/components/AppList/AppList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ afterEach(() => {
context("when changing props", () => {
it("should fetch apps in the new namespace", async () => {
const state = deepClone(initialState) as IStoreState;
state.config.featureFlags = { operators: true };
state.config.featureFlags = { ...initialState.config.featureFlags, operators: true };
const store = getStore(state);
const fetchInstalledPackages = jest.fn();
const getCustomResources = jest.fn();
Expand All @@ -71,7 +71,7 @@ context("when changing props", () => {

it("should not fetch resources in the new namespace when operators is deactivated", async () => {
const state = deepClone(initialState) as IStoreState;
state.config.featureFlags = { operators: false };
state.config.featureFlags = { ...initialState.config.featureFlags, operators: false };
const store = getStore(state);
const fetchInstalledPackages = jest.fn();
const getCustomResources = jest.fn();
Expand Down Expand Up @@ -110,7 +110,7 @@ context("when changing props", () => {

it("should fetch apps in all namespaces", async () => {
const state = deepClone(initialState) as IStoreState;
state.config.featureFlags = { operators: true };
state.config.featureFlags = { ...initialState.config.featureFlags, operators: true };
const store = getStore(state);
const fetchInstalledPackages = jest.fn();
const getCustomResources = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const defaultProps = {
};

let spyOnUseDispatch: jest.SpyInstance;
const kubeaActions = { ...actions.kube };
const kubeActions = { ...actions.kube };
beforeEach(() => {
actions.installedpackages = {
...actions.installedpackages,
Expand All @@ -38,7 +38,7 @@ beforeEach(() => {
});

afterEach(() => {
actions.kube = { ...kubeaActions };
actions.kube = { ...kubeActions };
spyOnUseDispatch.mockRestore();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const defaultProps = {
};

let spyOnUseDispatch: jest.SpyInstance;
const kubeaActions = { ...actions.kube };
const kubeActions = { ...actions.kube };
beforeEach(() => {
actions.installedpackages = {
...actions.installedpackages,
Expand All @@ -41,7 +41,7 @@ beforeEach(() => {
});

afterEach(() => {
actions.kube = { ...kubeaActions };
actions.kube = { ...kubeActions };
spyOnUseDispatch.mockRestore();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const defaultProps = {
};

let spyOnUseDispatch: jest.SpyInstance;
const kubeaActions = { ...actions.kube };
const kubeActions = { ...actions.kube };
beforeEach(() => {
actions.installedpackages = {
...actions.installedpackages,
Expand All @@ -34,7 +34,7 @@ beforeEach(() => {
});

afterEach(() => {
actions.kube = { ...kubeaActions };
actions.kube = { ...kubeActions };
spyOnUseDispatch.mockRestore();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { IAppViewResourceRefs } from "../AppView";

const defaultState = {
config: { remoteComponentsUrl: "" },
};
} as IStoreState;

const defaultProps = {
app: {
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/components/Catalog/Catalog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ it("retrieves csvs in the namespace if operators enabled", () => {
const getCSVs = jest.fn();
actions.operators.getCSVs = getCSVs;
const state = deepClone(populatedState) as IStoreState;
state.config.featureFlags = { operators: true };
state.config.featureFlags = { ...initialState.config.featureFlags, operators: true };

mountWrapper(
getStore(state),
Expand All @@ -185,7 +185,7 @@ it("not retrieveing csvs in the namespace if operators deactivated", () => {
const getCSVs = jest.fn();
actions.operators.getCSVs = getCSVs;
const state = deepClone(populatedState) as IStoreState;
state.config.featureFlags = { operators: false };
state.config.featureFlags = { ...initialState.config.featureFlags, operators: false };

mountWrapper(
getStore(state),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jest.mock("./PkgRepoForm", () => {
});

let spyOnUseDispatch: jest.SpyInstance;
const kubeaActions = { ...actions.kube };
const kubeActions = { ...actions.kube };
beforeEach(() => {
actions.repos = {
...actions.repos,
Expand All @@ -32,7 +32,7 @@ beforeEach(() => {
});

afterEach(() => {
actions.kube = { ...kubeaActions };
actions.kube = { ...kubeActions };
spyOnUseDispatch.mockRestore();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { PkgRepoAddButton } from "./PkgRepoButton";
import { IPkgRepoListItemProps, PkgRepoControl } from "./PkgRepoControl";

let spyOnUseDispatch: jest.SpyInstance;
const kubeaActions = { ...actions.kube };
const kubeActions = { ...actions.kube };
beforeEach(() => {
actions.repos = {
...actions.repos,
Expand All @@ -23,7 +23,7 @@ beforeEach(() => {
});

afterEach(() => {
actions.kube = { ...kubeaActions };
actions.kube = { ...kubeActions };
spyOnUseDispatch.mockRestore();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const pkgRepoFormData = {
} as IPkgRepoFormData;

let spyOnUseDispatch: jest.SpyInstance;
const kubeaActions = { ...actions.kube };
const kubeActions = { ...actions.kube };
beforeEach(() => {
actions.repos = {
...actions.repos,
Expand All @@ -99,7 +99,7 @@ beforeEach(() => {
});

afterEach(() => {
actions.kube = { ...kubeaActions };
actions.kube = { ...kubeActions };
spyOnUseDispatch.mockRestore();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const {
const namespace = clusters[currentCluster].currentNamespace;

let spyOnUseDispatch: jest.SpyInstance;
const kubeaActions = { ...actions.kube };
const kubeActions = { ...actions.kube };
beforeEach(() => {
actions.repos = {
...actions.repos,
Expand All @@ -43,7 +43,7 @@ beforeEach(() => {
});

afterEach(() => {
actions.kube = { ...kubeaActions };
actions.kube = { ...kubeActions };
spyOnUseDispatch.mockRestore();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const defaultProps = {

const defaultState = {
config: { remoteComponentsUrl: "" },
};
} as IStoreState;

// Ensure remote-component doesn't trigger external requests during this test.
const mockOpen = jest.fn();
Expand Down
Loading

0 comments on commit 0ab3d3a

Please sign in to comment.