Skip to content

Commit 0f43934

Browse files
Merge pull request #18114 from spadgett/console-config-api-changes
Automatic merge from submit-queue. Update cluster up for console config API changes Adopt API changes from openshift/api#31 For now, both the new and old config need to be written to avoid breaking cluster up until origin-web-console-server is updated. /assign @deads2k @jwforres FYI
2 parents 91d864d + 5ba8f2f commit 0f43934

File tree

4 files changed

+129
-47
lines changed

4 files changed

+129
-47
lines changed
Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
1-
kind: WebConsoleConfiguration
21
apiVersion: webconsole.config.openshift.io/v1
2+
kind: WebConsoleConfiguration
3+
clusterInfo:
4+
consolePublicURL: https://127.0.0.1:8443/console/
5+
loggingPublicURL: ""
6+
logoutPublicURL: ""
7+
masterPublicURL: https://127.0.0.1:8443
8+
metricsPublicURL: ""
9+
# TODO: The new extensions properties cannot be set until
10+
# origin-web-console-server has been updated with the API changes since
11+
# `extensions` in the old asset config was an array.
12+
#extensions:
13+
# scriptURLs: []
14+
# stylesheetURLs: []
15+
# properties: null
16+
features:
17+
inactivityTimeoutMinutes: 0
18+
servingInfo:
19+
bindAddress: 0.0.0.0:8443
20+
bindNetwork: tcp4
21+
certFile: /var/serving-cert/tls.crt
22+
clientCA: ""
23+
keyFile: /var/serving-cert/tls.key
24+
maxRequestsInFlight: 0
25+
namedCertificates: null
26+
requestTimeoutSeconds: 0
27+
28+
# START deprecated properties
29+
# These properties have been renamed and will be removed from the install
30+
# in a future pull. Keep both the old and new properties for now so that
31+
# the install is not broken while the origin-web-console image is updated.
332
extensionDevelopment: false
433
extensionProperties: null
534
extensionScripts: null
@@ -10,12 +39,4 @@ logoutURL: ""
1039
masterPublicURL: https://127.0.0.1:8443
1140
metricsPublicURL: ""
1241
publicURL: https://127.0.0.1:8443/console/
13-
servingInfo:
14-
bindAddress: 0.0.0.0:8443
15-
bindNetwork: tcp4
16-
certFile: /var/serving-cert/tls.crt
17-
clientCA: ""
18-
keyFile: /var/serving-cert/tls.key
19-
maxRequestsInFlight: 0
20-
namedCertificates: null
21-
requestTimeoutSeconds: 0
42+
# END deprecated properties

pkg/oc/bootstrap/bindata.go

Lines changed: 32 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/oc/bootstrap/docker/openshift/webconsole.go

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
consoleNamespace = "openshift-web-console"
2424
consoleRBACTemplateName = "web-console-server-rbac"
2525
consoleAPIServerTemplateName = "openshift-web-console"
26-
consoleAssetConfigFile = "install/origin-web-console/console-config.yaml"
26+
consoleConfigFile = "install/origin-web-console/console-config.yaml"
2727
)
2828

2929
// InstallWebConsole installs the web console server into the openshift-web-console namespace and waits for it to become ready
@@ -46,40 +46,59 @@ func (h *Helper) InstallWebConsole(f *clientcmd.Factory, imageFormat string, ser
4646
return errors.NewError("cannot instantiate template service broker permissions").WithCause(err)
4747
}
4848

49-
// read in the asset config YAML file like the installer
50-
assetConfigYaml, err := bootstrap.Asset(consoleAssetConfigFile)
49+
// read in the config YAML file like the installer
50+
consoleConfigYaml, err := bootstrap.Asset(consoleConfigFile)
5151
if err != nil {
52-
return errors.NewError("cannot read web console asset config file").WithCause(err)
52+
return errors.NewError("cannot read web console config file").WithCause(err)
5353
}
5454

5555
// prase the YAML to edit
56-
var assetConfig map[string]interface{}
57-
if err := yaml.Unmarshal(assetConfigYaml, &assetConfig); err != nil {
58-
return errors.NewError("cannot parse web console asset config as YAML").WithCause(err)
56+
var consoleConfig map[string]interface{}
57+
if err := yaml.Unmarshal(consoleConfigYaml, &consoleConfig); err != nil {
58+
return errors.NewError("cannot parse web console config as YAML").WithCause(err)
5959
}
6060

61-
// update asset config values
62-
assetConfig["publicURL"] = publicURL
63-
assetConfig["masterPublicURL"] = masterURL
61+
// update config values
62+
clusterInfo, ok := consoleConfig["clusterInfo"].(map[interface{}]interface{})
63+
if !ok {
64+
return errors.NewError("cannot read clusterInfo in web console config")
65+
}
66+
67+
clusterInfo["consolePublicURL"] = publicURL
68+
clusterInfo["masterPublicURL"] = masterURL
69+
if len(loggingURL) > 0 {
70+
clusterInfo["loggingPublicURL"] = loggingURL
71+
}
72+
if len(metricsURL) > 0 {
73+
clusterInfo["metricsPublicURL"] = metricsURL
74+
}
75+
76+
// START deprecated properties
77+
// These properties have been renamed and will be removed from cluster up
78+
// in a future pull. Keep both the old and new properties for now so that
79+
// the cluster up is not broken while the origin-web-console image is updated.
80+
consoleConfig["publicURL"] = publicURL
81+
consoleConfig["masterPublicURL"] = masterURL
6482
if len(loggingURL) > 0 {
65-
assetConfig["loggingPublicURL"] = loggingURL
83+
consoleConfig["loggingPublicURL"] = loggingURL
6684
}
6785
if len(metricsURL) > 0 {
68-
assetConfig["metricsPublicURL"] = metricsURL
86+
consoleConfig["metricsPublicURL"] = metricsURL
6987
}
88+
// END deprecated properties
7089

7190
// serialize it back out as a string to use as a template parameter
72-
updatedAssetConfig, err := yaml.Marshal(assetConfig)
91+
updatedConfig, err := yaml.Marshal(consoleConfig)
7392
if err != nil {
74-
return errors.NewError("cannot serialize web console asset config").WithCause(err)
93+
return errors.NewError("cannot serialize web console config").WithCause(err)
7594
}
7695

7796
imageTemplate := variable.NewDefaultImageTemplate()
7897
imageTemplate.Format = imageFormat
7998
imageTemplate.Latest = false
8099

81100
params := map[string]string{
82-
"API_SERVER_CONFIG": string(updatedAssetConfig),
101+
"API_SERVER_CONFIG": string(updatedConfig),
83102
"IMAGE": imageTemplate.ExpandOrDie("web-console"),
84103
"LOGLEVEL": fmt.Sprint(serverLogLevel),
85104
"NAMESPACE": consoleNamespace,

test/extended/testdata/bindata.go

Lines changed: 32 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)