Skip to content

Commit 87452a1

Browse files
authored
Merge pull request #84 from appuio/ocp-4.19/dev-view
Manage console developer view state based on cluster's `distribution` fact
2 parents 0e52df5 + dabdf44 commit 87452a1

File tree

18 files changed

+91
-0
lines changed

18 files changed

+91
-0
lines changed

component/main.jsonnet

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ local params = inv.parameters.openshift4_console;
88
local versionGroup = 'operator.openshift.io/v1';
99

1010
local openshiftMinor = std.parseInt(params.openshift_version.Minor);
11+
local openshiftFlavor = inv.parameters.facts.distribution;
1112

1213
local validateConfig(obj, kind='logo') =
1314
assert
@@ -200,6 +201,25 @@ local consoleSpec =
200201
}
201202
else
202203
{}
204+
) + (
205+
if openshiftMinor > 18 then {
206+
customization+: {
207+
perspectives: [
208+
{
209+
id: 'dev',
210+
visibility: {
211+
state:
212+
if openshiftFlavor == 'oke' then
213+
'Disabled'
214+
else
215+
'Enabled',
216+
},
217+
},
218+
],
219+
220+
},
221+
}
222+
else {}
203223
);
204224

205225
local faviconRoute =

docs/modules/ROOT/pages/references/parameters.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ A dictionary holding the `.spec` for the console config.
6363

6464
See the https://docs.openshift.com/container-platform/latest/web_console/customizing-the-web-console.html[OpenShift docs] for available parameters.
6565

66+
[NOTE]
67+
====
68+
The component will inject various configurations based on other parameters.
69+
70+
Additionally, on OpenShift 4.19 and newer, the component automatically configures the console's "Developer" view state based on the cluster's distribution.
71+
The "Developer" view is disabled for OKE clusters and enabled for other clusters.
72+
====
73+
6674
=== `config.managementState`
6775

6876
[horizontal]

tests/custom-links.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
parameters:
2+
facts:
3+
distribution: openshift4
4+
25
openshift4_console:
36
console_links:
47
homepage:

tests/custom-logo.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ parameters:
55
source: https://raw.githubusercontent.com/projectsyn/component-patch-operator/v1.2.0/lib/patch-operator.libsonnet
66
output_path: vendor/lib/patch-operator.libsonnet
77

8+
facts:
9+
distribution: openshift4
10+
811
patch_operator:
912
patch_serviceaccount:
1013
name: patch-sa

tests/custom-plugins.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
parameters:
2+
facts:
3+
distribution: oke
4+
25
openshift4_console:
36
config:
47
plugins:

tests/custom-route-legacy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ parameters:
55
source: https://raw.githubusercontent.com/projectsyn/component-patch-operator/v1.2.0/lib/patch-operator.libsonnet
66
output_path: vendor/lib/patch-operator.libsonnet
77

8+
facts:
9+
distribution: openshift4
10+
811
patch_operator:
912
patch_serviceaccount:
1013
name: patch-sa

tests/custom-route-managed-tls.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ parameters:
88
source: https://raw.githubusercontent.com/projectsyn/component-patch-operator/v1.2.0/lib/patch-operator.libsonnet
99
output_path: vendor/lib/patch-operator.libsonnet
1010

11+
facts:
12+
distribution: openshift4
13+
1114
patch_operator:
1215
patch_serviceaccount:
1316
name: patch-sa

tests/custom-route.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ parameters:
55
source: https://raw.githubusercontent.com/projectsyn/component-patch-operator/v1.2.0/lib/patch-operator.libsonnet
66
output_path: vendor/lib/patch-operator.libsonnet
77

8+
facts:
9+
distribution: openshift4
10+
811
patch_operator:
912
patch_serviceaccount:
1013
name: patch-sa

tests/defaults.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
parameters:
2+
facts:
3+
distribution: openshift4
4+
25
openshift4_console: {}

tests/golden/custom-links/openshift4-console/openshift4-console/10_console.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ metadata:
66
name: cluster
77
name: cluster
88
spec:
9+
customization:
10+
perspectives:
11+
- id: dev
12+
visibility:
13+
state: Enabled
914
managementState: Managed
1015
plugins:
1116
- monitoring-plugin

0 commit comments

Comments
 (0)