Skip to content

Conversation

@benjaminapetersen
Copy link
Contributor

  • handles values set on console config
  • handle values set on operator config
  • report public hostname on status
    • oauth team dependent on this update

@benjaminapetersen benjaminapetersen changed the title Honor configs & report public hostname on status [WIP] Honor configs & report public hostname on status Feb 12, 2019
@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 12, 2019
@benjaminapetersen
Copy link
Contributor Author

benjaminapetersen commented Feb 12, 2019

/hold

This is a pretty quick stub in so far, needs some work to guard/check/validate/etc.

@jhadvig @zherman0 fyi, we will need this in this week.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 12, 2019
defaultDocumentationBaseURL = "https://docs.okd.io/4.0/"
defaultBranding = "okd"
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 functions may belong in util.go or somewhere else...


//operatorConfig.Spec.Customization.Brand
func getBrand(operatorConfig *operatorv1.Console) operatorv1.Brand {
// TODO: handle if not provided
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zherman0 this is related to your brand work PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#126
Just want to ensure they function together.

Copy link
Contributor Author

@benjaminapetersen benjaminapetersen Feb 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if brand is not EXPLICITLY set, it should just fallback to the default which is provided in #126 (baked into the image). Either okd or ocp.

@jhadvig
Copy link
Member

jhadvig commented Feb 12, 2019

/test unit

Copy link
Member

@jhadvig jhadvig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few quick comments. Also need to check SyncConsoleConfig() cause I have a feeling that that might mess things up.

func DefaultConfigMap(cr *operatorv1.Console, rt *routev1.Route) *corev1.ConfigMap {
// overridden by console config
const (
defaultLogoutURL = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont we have a default URL for logout ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, there should not be a default (empty string). See console auth/logout handling:

https://github.com/openshift/console/blob/e267fcf4e177da5858c5c63d021d4f19f71646b8/frontend/public/module/auth.js#L56

//consoleConfig.Spec.Authentication.LogoutRedirect
func getLogoutRedirect(consoleConfig *configv1.Console) string {
// TODO: handle if not provided
// return consoleConfig.Spec.Authentication.LogoutRedirect || defaultLogoutURL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets uncomment this and comment the below ? or am I missing something ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, you aren't missing anything. This is why its still WIP. I didn't have time to test everything before opening last night, but wanted to raise awareness early.

@jhadvig
Copy link
Member

jhadvig commented Feb 12, 2019

@benjaminapeterse we probrably need to update the tests

[INFO] Testing github.com/openshift/console-operator/pkg/console/subresource/configmap
# github.com/openshift/console-operator/pkg/console/subresource/configmap
pkg/console/subresource/configmap/configmap_test.go:100:30: not enough arguments in call to DefaultConfigMap
	have (*"github.com/openshift/console-operator/vendor/github.com/openshift/api/operator/v1".Console, *"github.com/openshift/console-operator/vendor/github.com/openshift/api/route/v1".Route)
	want (*"github.com/openshift/console-operator/vendor/github.com/openshift/api/operator/v1".Console, *"github.com/openshift/console-operator/vendor/github.com/openshift/api/config/v1".Console, *"github.com/openshift/console-operator/vendor/github.com/openshift/api/route/v1".Route)
pkg/console/subresource/configmap/configmap_test.go:170:14: undefined: NewYamlConfigString
FAIL	github.com/openshift/console-operator/pkg/console/subresource/configmap [build failed]

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 13, 2019
)

func getLogoutRedirect(consoleConfig *configv1.Console) string {
if len(consoleConfig.Spec.Authentication.LogoutRedirect) > 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is all we need to do. The config structs are not pointers, so when the YAML is instantiated, nested structs should be created with empty string values. Therefore if empty string is provided, we can return the default value instead.

@jhadvig @zherman0 work? Same treatment for all three of these.


host := rt.Spec.Host
config := NewYamlConfigString(host)
config := string(NewYamlConfig(host, logoutRedirect, brand, docURL))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I eliminated the one wrapper func NewYamlConfigString(), was unnecessary additional plumbing for passing these values down, when all it did was call string().

@benjaminapetersen
Copy link
Contributor Author

Updated the tests & filled out the defaults.

@jhadvig
Copy link
Member

jhadvig commented Feb 13, 2019

/test e2e-aws

@benjaminapetersen
Copy link
Contributor Author

/retest

one success. interesting.

@benjaminapetersen
Copy link
Contributor Author

So at present you should be able to update the console.config.openshift.io:

apiVersion: config.openshift.io/v1
kind: Console
spec:
  authentication:
    logoutRedirect: https://www.redhat.com/i/should/logout/i/think

and it will update the web console.

In addition, when the Route.Host is provided, this will be reported on the console.config.openshift.io:

oc get console.config.openshift.io console -o yaml
apiVersion: config.openshift.io/v1
kind: Console
metadata:
  name: console
  resourceVersion: "1542289"
  selfLink: /apis/config.openshift.io/v1/consoles/console
  uid: 9a327206-2fce-11e9-92db-021245e32db2
spec:
  authentication:
    logoutRedirect: https://www.redhat.com/i/should/logout/i/think
status:
  publicHostname: https://console-openshift-console.apps.betersen.devcluster.openshift.com

Also, the console.operator.openshift.io can be configured with:

oc get console.operator.openshift.io console -o yaml
apiVersion: operator.openshift.io/v1
kind: Console
metadata:
  name: console
  resourceVersion: "1483224"  
spec:
  customization:
    brand: online
    documentationBaseURL: https://www.redhat.com/someplace/for/docs/give/it/a/try/
  logLevel: ""
  managementState: Managed
  observedConfig: null
  operandSpecs: null
  unsupportedConfigOverrides: null

The customizations on branding & documentationBaseURL will be set on the console configmap, and will be updated & visible in the console.

@benjaminapetersen benjaminapetersen changed the title [WIP] Honor configs & report public hostname on status Honor configs & report public hostname on status Feb 13, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 13, 2019
@benjaminapetersen
Copy link
Contributor Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 13, 2019
@benjaminapetersen
Copy link
Contributor Author

/retest

flake

@jhadvig
Copy link
Member

jhadvig commented Feb 13, 2019

Last failure:

time="2019-02-13T21:57:19Z" level=info msg="finished syncing operator \"console\" (50.148µs) \n\n"
E0213 21:57:19.063215       1 controller.go:130] {🐼 🐼} failed with: Operation cannot be fulfilled on consoles.config.openshift.io "console": the object has been modified; please apply your changes to the latest version and try again
I0213 21:57:19.063575       1 option.go:62] Console: handling update openshift-console/console: /apis/apps/v1/namespaces/openshift-console/deployments/console

@jhadvig
Copy link
Member

jhadvig commented Feb 13, 2019

/test e2e-aws

@benjaminapetersen
Copy link
Contributor Author

That fail is interesting. Will check in a short bit.

@jhadvig
Copy link
Member

jhadvig commented Feb 14, 2019

flake
/test e2e-aws

@benjaminapetersen
Copy link
Contributor Author

all succeed. @jhadvig or @zherman0 just need a lgtm 👍

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 14, 2019
Copy link
Member

@jhadvig jhadvig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: benjaminapetersen, jhadvig

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 5c1ecb8 into openshift:master Feb 14, 2019
ericavonb pushed a commit to ericavonb/cluster-authentication-operator that referenced this pull request Feb 15, 2019
Console publishes its config under the name 'console' now.
Ref: openshift/console-operator#134
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants