Skip to content

Commit

Permalink
feat: Customizing OpenShift Eclipse Che ConsoleLink (#2666)
Browse files Browse the repository at this point in the history
* feat: Customizing OpenShift Eclipse Che ConsoleLink

Signed-off-by: Anatolii Bazko <abazko@redhat.com>

* fixup

Signed-off-by: Anatolii Bazko <abazko@redhat.com>

* Update modules/administration-guide/partials/proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc

Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com>

* Update modules/administration-guide/partials/proc_mounting-a-secret-or-a-configmap-as-a-subpath-into-a-container.adoc

Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com>

* Update modules/administration-guide/pages/customizing-openshift-che-consolelink.adoc

Co-authored-by: Ilya Buziuk <ibuziuk@redhat.com>

* Update modules/administration-guide/pages/customizing-openshift-che-consolelink.adoc

Co-authored-by: Ilya Buziuk <ibuziuk@redhat.com>

* Update modules/administration-guide/pages/customizing-openshift-che-consolelink.adoc

Co-authored-by: Ilya Buziuk <ibuziuk@redhat.com>

* Address remarks

Signed-off-by: Anatolii Bazko <abazko@redhat.com>

---------

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com>
Co-authored-by: Ilya Buziuk <ibuziuk@redhat.com>
  • Loading branch information
3 people authored Dec 4, 2023
1 parent 38ba74e commit 691b878
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 19 deletions.
1 change: 1 addition & 0 deletions modules/administration-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
*** xref:configuring-storage-sizes.adoc[]
** xref:configuring-dashboard.adoc[]
*** xref:configuring-getting-started-samples.adoc[]
*** xref:customizing-openshift-che-consolelink-icon.adoc[]
** xref:managing-identities-and-authorizations.adoc[]
*** xref:configuring-oauth-for-git-providers.adoc[]
**** xref:configuring-oauth-2-for-github.adoc[]
Expand Down
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-icon.adoc[]

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

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

This procedure describes how to customize {prod} link:https://docs.openshift.com/container-platform/{ocp4-ver}/rest_api/console_apis/consolelink-console-openshift-io-v1.html[ConsoleLink] icon.

.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.

.Additional resources

* link:https://docs.openshift.com/container-platform/{ocp4-ver}/web_console/customizing-the-web-console.html#creating-custom-links_customizing-web-console[Creating custom links in the web console]
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
Expand Up @@ -15,16 +15,14 @@

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 file.

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

.Example:
====
[source,yaml]
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: Secret
Expand All @@ -34,10 +32,12 @@ metadata:
che.eclipse.org/mount-as: file
che.eclipse.org/mount-path: /data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-secret
...
----
or
[source,yaml]
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: ConfigMap
Expand All @@ -47,6 +47,8 @@ metadata:
che.eclipse.org/mount-as: file
che.eclipse.org/mount-path: /data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-configmap
...
----
====
Expand Down Expand Up @@ -90,7 +92,7 @@ data:

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.
IMPORTANT: To make the changes in a {prod-short} container visible, re-create the Secret or the ConfigMap object entirely.

.Additional resources

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// 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]

. Configure the annotation values. Annotations must indicate that the given object is mounted as a subPath.:
+
* `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,subs="+quotes,attributes"]
----
apiVersion: v1
kind: Secret
metadata:
name: custom-data
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-secret
...
----
or
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-data
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-configmap
...
----
====

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

.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, re-create the Secret or the ConfigMap object entirely.

.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,16 +15,14 @@

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.

. Configure the annotation values:
. Configure the annotation values. Annotations must indicate that the given object is mounted as an environment variable:
+
* `che.eclipse.org/mount-as: env` - to indicate that a object is mounted as an environment variable
* `che.eclipse.org/env-name: _<FOO_ENV>_` - to provide an environment variable name, which is required to mount a object key value

.Example:
====
[source,yaml]
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: Secret
Expand All @@ -34,12 +32,13 @@ metadata:
che.eclipse.org/env-name: FOO_ENV
che.eclipse.org/mount-as: env
labels:
...
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-secret
data:
mykey: myvalue
----
or
[source,yaml]
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: ConfigMap
Expand All @@ -49,7 +48,8 @@ metadata:
che.eclipse.org/env-name: FOO_ENV
che.eclipse.org/mount-as: env
labels:
...
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-configmap
data:
mykey: myvalue
----
Expand All @@ -67,7 +67,7 @@ If the object provides more than one data item, the environment variable name mu

.Example:
====
[source,yaml]
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: Secret
Expand All @@ -78,13 +78,14 @@ metadata:
che.eclipse.org/mykey_env-name: FOO_ENV
che.eclipse.org/otherkey_env-name: OTHER_ENV
labels:
...
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-secret
stringData:
mykey: __<data_content_here>__
otherkey: __<data_content_here>__
----
or
[source,yaml]
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: v1
kind: ConfigMap
Expand All @@ -95,7 +96,8 @@ metadata:
che.eclipse.org/mykey_env-name: FOO_ENV
che.eclipse.org/otherkey_env-name: OTHER_ENV
labels:
...
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: {prod-deployment}-configmap
data:
mykey: __<data content here>__
otherkey: __<data content here>__
Expand All @@ -112,7 +114,7 @@ being provisioned into a {prod-short} container.

NOTE: The maximum length of annotation names in a {orch-name} object is 63 characters, where 9 characters are reserved for a prefix that ends with `/`. This acts as a restriction for the maximum length of the key that can be used for the object.

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

.Additional resources

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 691b878

Please sign in to comment.