Origin: Changing contents of webconsole-config doesn't seem to persist after web-console pod restart

Created on 5 Sep 2018  路  8Comments  路  Source: openshift/origin

With oc version 3.10, I have done oc cluster up to produce my own local instance.
I want to enable an extension, so I edit the webconsole-config configmap to include references to my scripts and styles.
When the webconsole pod restarts, the webconsole-config configmap seems to be reset to the original values, which does not include my extension enablement.

Version

oc v3.10.0+dd10d17
kubernetes v1.10.0+b81c8f8
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://192.168.1.108:8443
openshift v3.10.0+8e19bad-29
kubernetes v1.10.0+b81c8f8

Steps To Reproduce
  1. oc cluster up
  2. Host a set of scripts/styles for an extension via https somewhere
  3. login as system:admin
  4. oc edit configmap/webconsole-config -n openshift-web-console // make changes to scriptURLs and stylesheetURLs to point at scripts hosted in step 2 above.
  5. Note that the webconsole pod restarts
  6. oc get configmap webconsole-config -o yaml -n openshift-web-console // notice that the contents of the webconsole-config.yaml are reset to the values prior to the edit in step 4.
Current Result

webconsole-config.yaml is reset to the values prior to the edit in step 4.

Expected Result

webconsole-config.yaml retains the values set in step 4 and my console extension loads

Additional Information

One thing that I note as odd is that the docs for v3.10 show the value for the webconsole-config.yaml key in the configmap to be stored as yaml, but in my instance, it appears to be json. Here is what I see in mine....

oc get configmap webconsole-config -o yaml -n openshift-web-console
apiVersion: v1
data:
  webconsole-config.yaml: |
    {"kind":"WebConsoleConfiguration","apiVersion":"webconsole.config.openshift.io/v1","servingInfo":{"bindAddress":"0.0.0.0:8443","bindNetwork":"tcp4","certFile":"/var/serving-cert/tls.crt","keyFile":"/var/serving-cert/tls.key","clientCA":"","namedCertificates":null,"maxRequestsInFlight":0,"requestTimeoutSeconds":0},"clusterInfo":{"consolePublicURL":"https://192.168.1.108:8443/console/","masterPublicURL":"https://192.168.1.108:8443","loggingPublicURL":"","metricsPublicURL":"","logoutPublicURL":""},"features":{"inactivityTimeoutMinutes":0,"clusterResourceOverridesEnabled":false},"extensions":{"scriptURLs":[],"stylesheetURLs":[],"properties":null}}
kind: ConfigMap
metadata:
  creationTimestamp: 2018-08-16T14:01:56Z
  name: webconsole-config
  namespace: openshift-web-console
  resourceVersion: "3109237"
  selfLink: /api/v1/namespaces/openshift-web-console/configmaps/webconsole-config
  uid: ef6f04ac-a15c-11e8-bf76-c85b764bc0a0

Note: I've also tried editing other values [inactivityTimeoutMinutes] and have seen the same result (pod restarted buth my change is not persisted).

siuser-interface

Most helpful comment

The docs are written for an ansible install. For cluster up, the config map is managed by an operator that will overwrite your changes. Try the command:

$ oc edit openshiftwebconsoleconfigs.webconsole.operator.openshift.io

and edit spec.config

cc @deads2k

All 8 comments

@openshift/sig-user-interface

The docs are written for an ansible install. For cluster up, the config map is managed by an operator that will overwrite your changes. Try the command:

$ oc edit openshiftwebconsoleconfigs.webconsole.operator.openshift.io

and edit spec.config

cc @deads2k

Thanks @spadgett. That does indeed work for me.

Glad it worked. Closing the issue

@spadgett
Can you please elaborate on your solution.
I need to edit configmaps and secrets of my monitoring stack deployed by default by ansible and I'm having same issue.

Thanks

Hi,
For for v3.10 (or prior V3.11), can I edit the configMap to add the script URLs programatically?
If so do you have example how can I get to the extension.scriptURLs?
Thank you.

@jasuryak if you installed via ansible, you should be able to edit the console config map directly in 3.10

@3RX0 if you are asking about Prometheus, I'd check the docs here: https://docs.okd.io/3.11/install_config/prometheus_cluster_monitoring.html

@spadgett
Thank you for your reply. I think I asked the wrong question.
I am able to update the extensions.scriptURLs for the openshift web console ConfigMap using GUI.
What I am need to do is being able to update that programmatically.
I am able to read and added scriptURLs field on open shift 3.11 using nodeJS script but not prior 3.11
The configMap for openshift webconsole look different.
Prior to 3.11 the open shift web console when I try to get the value in YAML and pipe it to a file, look like below:
apiVersion: v1
data:
webconsole-config.yaml: |
apiVersion: webconsole.config.openshift.io/v1
clusterInfo:
adminConsolePublicURL: https://console.apps.9.412.88.21.nip.io/
consolePublicURL: https://console.9.412.88.21.nip.io:8443/console/
...
extensions:
properties: {}
scriptURLs: null
stylesheetURLs: null
...
kind: WebConsoleConfiguration
....
kind: ConfigMap
...
labels:
app: openshift-web-console
name: webconsole-config
namespace: openshift-web-console
resourceVersion: "244541"
selfLink: /api/v1/namespaces/openshift-web-console/configmaps/webconsole-config
uid: c19a4cbd-ad56-11e9-a2d0-005056a082e1

I had a hard time to get the value of existing scriptURLs with nodeJS.

On version 3.11 it looks like below:
apiVersion: webconsole.operator.openshift.io/v1alpha1
kind: OpenShiftWebConsoleConfig
....
name: instance
resourceVersion: "8765"
selfLink: /apis/webconsole.operator.openshift.io/v1alpha1/openshiftwebconsoleconfigs/instance
uid: 5d45b6c2-b0ed-11e9-9ec1-0800277fb29b
spec:
config:
clusterInfo:
consolePublicURL: https://192.168.99.123:8443/console/
masterPublicURL: https://192.168.99.123:8443
......
extensions:
properties: null
scriptURLs: ["https://323.34.33.323:8080/myscript.js"]
stylesheetURLs: null

I am able to get the value of scriptURLs by doing spec.config.extension.scriptURLs but prior 3.11 I have a hard time to figure out the syntax to get the value of scriptURLs because of the format differences it contains this "webconsole-config.yaml: |".
Do you know the way to get to the scriptURLs using script?
I need to be able to get to the value and make update to add my script to scriptURLs field programmatically using script.
Thank you for your help in advance.

Was this page helpful?
0 / 5 - 0 ratings