Skip to content

Conversation

@jhadvig
Copy link
Member

@jhadvig jhadvig commented Oct 31, 2019

Syncing the router-ca from openshift-config-managed namespace to openshift-console namespace and pasing to the console deployment.

Will update the unit tests after the first round of review to avoid unnecessary rewrites.

/assign @benjaminapetersen

@openshift-ci-robot
Copy link
Contributor

@jhadvig: This pull request references Bugzilla bug 1764704, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Bug 1764704: Sync router-ca to the console namespace

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 31, 2019
@spadgett
Copy link
Member

cc @csrwng @sjenning

{
name: api.RouterCAConfigMapName,
readOnly: true,
path: "/var/router-ca",
Copy link
Member

Choose a reason for hiding this comment

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

We need to set this as the oauthEndpointCAFile in the console config map.

Copy link
Contributor

@benjaminapetersen benjaminapetersen Nov 5, 2019

Choose a reason for hiding this comment

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

Should we conditionally fall back to the previous CA (not add this volume) if the router-ca does not exist for some reason?

Copy link
Contributor

Choose a reason for hiding this comment

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

Like, if we hit FailedGet or MissingRouterCABundle on the RouterCAValidation check, can we still roll out a usable console.

@jhadvig
Copy link
Member Author

jhadvig commented Oct 31, 2019

@benjaminapetersen @spadgett comments addressed

@jhadvig
Copy link
Member Author

jhadvig commented Nov 4, 2019

/retest

1 similar comment
@jhadvig
Copy link
Member Author

jhadvig commented Nov 4, 2019

/retest

@jhadvig
Copy link
Member Author

jhadvig commented Nov 5, 2019

53) Modal Annotations
A Jasmine spec timed out. Resetting the WebDriver Control Flow.

/retest

@jhadvig jhadvig force-pushed the bz1764704 branch 2 times, most recently from f3bf5cf to cb632ca Compare November 5, 2019 14:24
@jhadvig
Copy link
Member Author

jhadvig commented Nov 5, 2019

@benjaminapetersen updated the PR, with couple of nits I've found... PTAL

recorder events.Recorder
}

func NewResourceSyncController(
Copy link
Contributor

Choose a reason for hiding this comment

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

I may be inclined to use the previous name, or come up with something that isn't so similar to the resourcesynccontroller.NewResourceSyncController() in starter.go. This might get confusing later.

resourcesynccontroller.NewResourceSyncController() is responsible for grabbing source files from other namespaces and syncing them to destination files in our namespace.

This ctrl is currently tasked with maintaining these resources (delete mostly) based in management state.


switch operatorConfig.Spec.ManagementState {
case operatorsv1.Managed:
klog.V(4).Infoln("console is in a managed state: syncing secrets and configmaps")
Copy link
Contributor

Choose a reason for hiding this comment

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

For now, we are only syncing the one, router-ca. Lets update the comment to this to ensure the logs are accurate. Perhaps we can comment on ResourceSyncController struct above indicating the future intent, that this ctrl could maintain all the boring resources like configmaps/secrets that just need to exist/not exist based on ManagementState.

return okToMount, reason, err
}

func (c *consoleOperator) ValidateRouterCAConfigMap() (routerCA *corev1.ConfigMap, reason string, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Pondering if this can live in the new controller instead of adding it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, probably not now yet, as the actualDeployment, depChanged, depErrReason, depErr := co.SyncDeployment(set.Operator, cm, serviceCAConfigMap, routerCAConfigMap, trustedCAConfigMap, sec, rt, set.Proxy, customLogoCanMount) needs it. Future TODO: break that down into smaller bits.


// resourceSyncController contains additional locig for all the secrets and
// configmaps that we resourceSyncer is taking care of
resourceSyncController := resourcesync.NewResourceSyncController(
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: I still think we should pair up client-informer for related resources:

// operatorconfig
operatorConfigClient.OperatorV1().Consoles(),
operatorConfigInformers.Operator().V1().Consoles(), 
// configmap
kubeClient.CoreV1(),
kubeInformersNamespaced.Core().V1().ConfigMaps(), 

Copy link
Member Author

Choose a reason for hiding this comment

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

Dont have any any strong feelings against. Done it this way cause the controllers we started to create have the arguments structured in this way - clients | informers | ...

Copy link
Contributor

Choose a reason for hiding this comment

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

@jhadvig
Copy link
Member Author

jhadvig commented Nov 6, 2019

/hold

@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 Nov 6, 2019
@jhadvig
Copy link
Member Author

jhadvig commented Nov 6, 2019

@benjaminapetersen updated the PR with additional commit that is adding the fallback to the /var/run/secrets/kubernetes.io/serviceaccount/ca.crt if the router-ca is not synced in the openshift-console namespace.
Will update also the unit tests after the review... PTAL

// If the `router-ca` configmap in `openshift-console` exist we should mount that to the console container,
// otherwise default to `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`
_, rcaErr := co.configMapClient.ConfigMaps(api.OpenShiftConsoleNamespace).Get(api.RouterCAConfigMapName, metav1.GetOptions{})
if rcaErr != nil && apierrors.IsNotFound(rcaErr) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what about other errors? this only covers 404.

Copy link
Contributor

Choose a reason for hiding this comment

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

is there anything else that would matter?

Copy link
Member Author

Choose a reason for hiding this comment

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

was thinking about it and wasn't really sure if any other errors should matter in this context... saying that not really sure what should be the reason and type of the created condition, if there will be other error type... also if it makes sense to even create one in this case...

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should just add a log and call it good:

if rcaErr != nil {
  klog.V(4).Infof("router-ca GET error: %s",rcaErr)
}

Agree with you, probably doesn't matter, unless there is some funny state we aren't thinking about. But a 4+ log level dumping some detail may be helpful.

clientSecretFilePath = "/var/oauth-config/clientSecret"
oauthEndpointCAFilePath = "/var/router-ca/ca-bundle.crt"
clientSecretFilePath = "/var/oauth-config/clientSecret"
oauthEndpointCAFilePath = "/var/router-ca/ca-bundle.crt"
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets fix the name here as well, routerCAFIlePath vs oauthEndpointCAFilePath.
oauthEndpointCAFilePath and defaultOAuthEndpointCAFilePath sound like the same thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, probably it will be better to give the true names with an additional comment

statusPageID string
customProductName string
customLogoFile string
routerCA string
Copy link
Contributor

@benjaminapetersen benjaminapetersen Nov 6, 2019

Choose a reason for hiding this comment

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

This property should prob be generically CAFile, as it may be the router-CA, or it may not. The if check below decides which.

Copy link
Member Author

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

@benjaminapetersen comments addressed.
Wasn't really sure if it make sense to have report and condition here since if there is not the router-ca than we have a valid fallback...

PTAL

"github.com/openshift/console-operator/pkg/console/operator"
"github.com/openshift/console-operator/pkg/console/starter"
"github.com/openshift/console-operator/pkg/console/subresource/configmap"
"github.com/openshift/console-operator/pkg/console/subresource/consoleserver"
Copy link
Member Author

Choose a reason for hiding this comment

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

It appears we have been missing this pkg in our unit tests

Copy link
Contributor

Choose a reason for hiding this comment

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

Not ideal to have to manually add these eh? Prob should update this script to loop the directory instead, but looks good for now.


func (b *ConsoleServerCLIConfigBuilder) authServer() Auth {
// we need this fallback due to the way our unit test are structured,
// where the ConsoleServerCLIConfigBuilder object is being instantiated empty
Copy link
Member Author

Choose a reason for hiding this comment

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

not a bad thing I thing... It's good to have a fallback here...

Copy link
Contributor

Choose a reason for hiding this comment

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

It can't function correctly without one or the other, correct? Is it just because of unit test structure, or is the config broken without an entry?

@jhadvig
Copy link
Member Author

jhadvig commented Nov 7, 2019

/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 Nov 7, 2019
clientID: console
clientSecretFile: /var/oauth-config/clientSecret
oauthEndpointCAFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
oauthEndpointCAFile: /var/router-ca/ca-bundle.crt
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we may want to add 2 new tests here:

name: "Test configmap with router-ca",
name: "Test configmap without router-ca",

Probably can duplicate the test name: "Test default configmap, no customization", and just swap the bool & output. This would make it explicit.

@benjaminapetersen
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2019
@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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 7, 2019
@jhadvig
Copy link
Member Author

jhadvig commented Nov 7, 2019

/retest

@openshift-merge-robot openshift-merge-robot merged commit a4f6120 into openshift:master Nov 7, 2019
@openshift-ci-robot
Copy link
Contributor

@jhadvig: All pull requests linked via external trackers have merged. Bugzilla bug 1764704 has been moved to the MODIFIED state.

Details

In response to this:

Bug 1764704: Sync router-ca to the console namespace

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. 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.

5 participants