|
| 1 | +:_content-type: PROCEDURE |
| 2 | +:description: Concealing editors definitions |
| 3 | +:keywords: administration guide, concealing, dashboard, editors |
| 4 | +:navtitle: Concealing editors definitions |
| 5 | + |
| 6 | +[id="concealing-editors-definitions"] |
| 7 | += Concealing editors definitions |
| 8 | + |
| 9 | +Learn how to conceal {prod-short} editor definitions. This is useful when you want to hide selected editors from the Dashboard UI, e.g. hide the IntelliJ IDEA Ultimate and have only Visual Studio Code - Open Source visible. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* An active `{orch-cli}` session with administrative permissions to the {orch-name} cluster. See {orch-cli-link}. |
| 14 | + |
| 15 | +* `jq`. See link:https://stedolan.github.io/jq/download/[Downloading `jq`]. |
| 16 | + |
| 17 | +.Procedure |
| 18 | + |
| 19 | +. Find out the namespace where the {prod-short} Operator is deployed: |
| 20 | ++ |
| 21 | +[source,subs="+attributes"] |
| 22 | +---- |
| 23 | +OPERATOR_NAMESPACE=$({orch-cli} get pods -l app.kubernetes.io/component={prod-operator} -o jsonpath={".items[0].metadata.namespace"} --all-namespaces) |
| 24 | +---- |
| 25 | + |
| 26 | +. Find out the available editors definitions files: |
| 27 | ++ |
| 28 | +[source,subs="+attributes"] |
| 29 | +---- |
| 30 | +{orch-cli} exec -n $OPERATOR_NAMESPACE deploy/{prod-operator} -- ls /tmp/editors-definitions |
| 31 | +---- |
| 32 | +The output should look similar to the following example: |
| 33 | ++ |
| 34 | +[source] |
| 35 | +---- |
| 36 | +che-code-insiders.yaml |
| 37 | +che-code-latest.yaml |
| 38 | +che-idea-latest.yaml |
| 39 | +che-idea-next.yaml |
| 40 | +---- |
| 41 | + |
| 42 | +. Choose an editor definition to conceal. |
| 43 | +For example, to conceal the `che-idea-next.yaml` editor definition, set the editor definition file name: |
| 44 | ++ |
| 45 | +[source,subs="+attributes"] |
| 46 | +---- |
| 47 | +CHE_EDITOR_CONCEAL_FILE_NAME=che-idea-next.yaml |
| 48 | +---- |
| 49 | + |
| 50 | +. Define the ConfigMap name for the concealed editor definition: |
| 51 | ++ |
| 52 | +[source,subs="+attributes"] |
| 53 | +---- |
| 54 | +CHE_EDITOR_CONCEAL_CONFIGMAP_NAME=che-conceal-$CHE_EDITOR_CONCEAL_FILE_NAME |
| 55 | +---- |
| 56 | + |
| 57 | +. Create the ConfigMap: |
| 58 | ++ |
| 59 | +[source,subs="+attributes"] |
| 60 | +---- |
| 61 | +{orch-cli} create configmap $CHE_EDITOR_CONCEAL_CONFIGMAP_NAME \ |
| 62 | + --namespace $OPERATOR_NAMESPACE \ |
| 63 | + --from-literal=$CHE_EDITOR_CONCEAL_FILE_NAME="" |
| 64 | +---- |
| 65 | + |
| 66 | +. Find out the Operator subscription namespace (if it exists): |
| 67 | ++ |
| 68 | +[source,subs="+attributes"] |
| 69 | +---- |
| 70 | +SUBSCRIPTION_NAMESPACE=$({orch-cli} get subscription \ |
| 71 | + --all-namespaces \ |
| 72 | + --field-selector=metadata.name={prod-operator-subscription} \ |
| 73 | + --output jsonpath='{.items[0].metadata.namespace}' 2>/dev/null |
| 74 | +) |
| 75 | +---- |
| 76 | + |
| 77 | +. Patch the {kubernetes} resource to mount the ConfigMap with the empty editor definition. The resource to patch depends on the existence of the Operator subscription. If the subscription exists, then the subscription should be patched. If not, patch the Operator deployment: |
| 78 | ++ |
| 79 | +[source,subs="+attributes"] |
| 80 | +---- |
| 81 | +if [[ -n $SUBSCRIPTION_NAMESPACE ]]; then |
| 82 | + if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config}') == "" ]]; then |
| 83 | + {orch-cli} patch subscription {prod-operator-subscription} \ |
| 84 | + --namespace $SUBSCRIPTION_NAMESPACE \ |
| 85 | + --type json \ |
| 86 | + --patch '[{ |
| 87 | + "op":"add", |
| 88 | + "path":"/spec/config", |
| 89 | + "value": {} |
| 90 | + }]' |
| 91 | + fi |
| 92 | +
|
| 93 | + if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config.volumes}') == "" ]]; then |
| 94 | + {orch-cli} patch subscription {prod-operator-subscription} \ |
| 95 | + --namespace $SUBSCRIPTION_NAMESPACE \ |
| 96 | + --type json \ |
| 97 | + --patch '[{ |
| 98 | + "op":"add", |
| 99 | + "path":"/spec/config/volumes", |
| 100 | + "value": [] |
| 101 | + }]' |
| 102 | + fi |
| 103 | +
|
| 104 | + if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config.volumeMounts}') == "" ]]; then |
| 105 | + {orch-cli} patch subscription {prod-operator-subscription} \ |
| 106 | + --namespace $SUBSCRIPTION_NAMESPACE \ |
| 107 | + --type json \ |
| 108 | + --patch '[{ |
| 109 | + "op":"add", |
| 110 | + "path":"/spec/config/volumeMounts", |
| 111 | + "value": [] |
| 112 | + }]' |
| 113 | + fi |
| 114 | +
|
| 115 | + {orch-cli} patch subscription {prod-operator-subscription} \ |
| 116 | + --namespace $SUBSCRIPTION_NAMESPACE \ |
| 117 | + --type json \ |
| 118 | + --patch '[{ |
| 119 | + "op":"add", |
| 120 | + "path":"/spec/config/volumes/-", |
| 121 | + "value": { |
| 122 | + "name":"'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", |
| 123 | + "configMap": { |
| 124 | + "name": "'$CHE_EDITOR_CONCEAL_CONFIGMAP_NAME'" |
| 125 | + } |
| 126 | + } |
| 127 | + }, |
| 128 | + { |
| 129 | + "op":"add", |
| 130 | + "path":"/spec/config/volumeMounts/-", |
| 131 | + "value":{ |
| 132 | + "name": "'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", |
| 133 | + "subPath":"'$CHE_EDITOR_CONCEAL_FILE_NAME'", |
| 134 | + "mountPath": "/tmp/editors-definitions/'$CHE_EDITOR_CONCEAL_FILE_NAME'" |
| 135 | + } |
| 136 | + }]' |
| 137 | +else |
| 138 | + {orch-cli} patch deployment {prod-operator} \ |
| 139 | + --namespace $OPERATOR_NAMESPACE \ |
| 140 | + --type json \ |
| 141 | + --patch '[{ |
| 142 | + "op":"add", |
| 143 | + "path":"/spec/template/spec/volumes/-", |
| 144 | + "value": { |
| 145 | + "name":"'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", |
| 146 | + "configMap": { |
| 147 | + "name": "'$CHE_EDITOR_CONCEAL_CONFIGMAP_NAME'" |
| 148 | + } |
| 149 | + } |
| 150 | + }, |
| 151 | + { |
| 152 | + "op":"add", |
| 153 | + "path":"/spec/template/spec/containers/0/volumeMounts/-", |
| 154 | + "value":{ |
| 155 | + "name": "'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", |
| 156 | + "subPath":"'$CHE_EDITOR_CONCEAL_FILE_NAME'", |
| 157 | + "mountPath": "/tmp/editors-definitions/'$CHE_EDITOR_CONCEAL_FILE_NAME'" |
| 158 | + } |
| 159 | + } |
| 160 | +]' |
| 161 | +fi |
| 162 | +---- |
| 163 | + |
| 164 | + |
| 165 | +.Additional resources |
| 166 | + |
| 167 | +* xref:configuring-editors-definitions.adoc[] |
| 168 | + |
| 169 | +* xref:configuring-default-editor-definition.adoc[] |
| 170 | + |
| 171 | +* {editor-definition-samples-link} |
| 172 | + |
0 commit comments