Skip to content

Commit

Permalink
feat: Customizing OpenShift Eclipse Che ConsoleLink
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha committed Nov 22, 2023
1 parent 00bfdaf commit 1e2b9a6
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 2 deletions.
3 changes: 3 additions & 0 deletions modules/administration-guide/pages/configuring-dashboard.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
= Configuring dashboard

* xref:configuring-getting-started-samples.adoc[]

* xref:customizing-openshift-che-consolelink.adoc[]

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
:_content-type: PROCEDURE
:description: Customizing OpenShift Eclipse Che ConsoleLink
:keywords: administration guide, customizing, consolelink
:navtitle: Customizing OpenShift Eclipse Che ConsoleLink
:page-aliases: installation-guide:customizing-openshift-che-consolelink.adoc

[id="customizing-openshift-che-consolelink"]
= Customizing {ocp} {prod} ConsoleLink

This procedure describes how to customize {prod} ConsoleLink.

.Prerequisites

* An active `{orch-cli}` session with administrative permissions to the {orch-name} cluster. See {orch-cli-link}.

.Procedure

. Create a Secret:
+
[source,shell,subs="+quotes,+attributes"]
----
{orch-cli} apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: {prod-deployment}-dashboard-customization
namespace: {prod-namespace}
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /public/dashboard/assets/branding
labels:
app.kubernetes.io/component: {prod-deployment}-dashboard-secret
app.kubernetes.io/part-of: che.eclipse.org
data:
loader.svg: __<Base64_encoded_content_of_the_image>__ <1>
type: Opaque
EOF
----
<1> Base64 encoding with disabled line wrapping.

. Wait until the rollout of {prod-deployment}-dashboard finishes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ The mounting process uses the standard {platforms-name} mounting mechanism, but

include::partial$proc_mounting-a-secret-or-a-configmap-as-a-file-into-a-container.adoc[leveloffset=+1]

include::partial$proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc[leveloffset=+1]

include::partial$proc_mounting-a-secret-or-a-configmap-as-an-environment-variable-into-a-container.adoc[leveloffset=+1]

Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// Module included in the following assemblies:
//
// mounting-a-secret-or-a-configmap-as-a-file-or-an-environment-variable-into-a-container


[id="mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container"]
= Mounting a Secret or a ConfigMap as a subPath into a {prod-short} container


.Prerequisites

* A running instance of {prod}.

.Procedure

include::partial$snip_mounting-a-secret-or-a-configmap-into-a-container.adoc[leveloffset=+1]

Annotations must indicate that the given object is mounted as a subPath.

. Configure the annotation values:
+
* `che.eclipse.org/mount-as: subpath` - To indicate that an object is mounted as a subPath.
* `che.eclipse.org/mount-path: _<TARGET_PATH>_` - To provide a required mount path.

.Example:
====
[source,yaml]
----
apiVersion: v1
kind: Secret
metadata:
name: custom-data
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
labels:
...
----
or
[source,yaml]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-data
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
labels:
...
----
====

The {orch-name} object can contain several items whose names must match the desired file name mounted into the container.

Check warning on line 54 in modules/administration-guide/partials/proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc

View workflow job for this annotation

GitHub Actions / vale

[vale] modules/administration-guide/partials/proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc#L54

[RedHat.TermsWarnings] Consider using 'needed' or 'required' rather than 'desired' unless updating existing content that uses the term.
Raw output
{"message": "[RedHat.TermsWarnings] Consider using 'needed' or 'required' rather than 'desired' unless updating existing content that uses the term.", "location": {"path": "modules/administration-guide/partials/proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc", "range": {"start": {"line": 54, "column": 77}}}, "severity": "WARNING"}

.Example:
====
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: Secret
metadata:
name: custom-data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-secret
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
data:
ca.crt: __<base64 encoded data content here>__
----
or
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-configmap
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
data:
ca.crt: __<data content here>__
----
====

This results in a file named `ca.crt` being mounted at the `/data` path of {prod-short} container.

IMPORTANT: To make the changes in a {prod-short} container visible, recreate the object entirely.

Check warning on line 93 in modules/administration-guide/partials/proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc

View workflow job for this annotation

GitHub Actions / vale

[vale] modules/administration-guide/partials/proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc#L93

[RedHat.Hyphens] Use 're-create' rather than 'recreate'.
Raw output
{"message": "[RedHat.Hyphens] Use 're-create' rather than 'recreate'.", "location": {"path": "modules/administration-guide/partials/proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc", "range": {"start": {"line": 93, "column": 69}}}, "severity": "WARNING"}

.Additional resources

* xref:using-chectl-to-configure-the-checluster-custom-resource-during-installation.adoc[]

* xref:using-the-cli-to-configure-the-checluster-custom-resource.adoc[]

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

include::partial$snip_mounting-a-secret-or-a-configmap-into-a-container.adoc[leveloffset=+1]

Annotations must indicate that the given object is mounted as a environment variable.
Annotations must indicate that the given object is mounted as an environment variable.

. Configure the annotation values:
+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
+
* The `<DEPLOYMENT_NAME>` corresponds to the one following deployments:

** `keycloak`
** `{prod-deployment}-dashboard`
** `devfile-registry`
** `plugin-registry`
** `{prod-deployment}`
Expand Down

0 comments on commit 1e2b9a6

Please sign in to comment.