Skip to content

Conversation

@ramr
Copy link
Contributor

@ramr ramr commented Dec 16, 2018

… assets.

Ref: https://jira.coreos.com/browse/NE-72
This is still work in progress - will add tests as well but first wanted to confirm this works
for you @ironcladlou PTAL Thx

@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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 16, 2018
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ramr
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: knobunc

If they are not already assigned, you can assign the PR to them by writing /assign @knobunc in a comment when ready.

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
Copy link
Contributor

@ramr: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws-operator 4000551 link /test e2e-aws-operator
ci/prow/e2e-aws 4000551 link /test e2e-aws

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

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. I understand the commands that are listed here.

// ensureRouterAsset ensures the expected router asset exists and returns the
// current asset information.
func (r *reconciler) ensureRouterAsset(key types.NamespacedName, obj runtime.Object) (runtime.Object, error) {
err := r.Client.Get(context.TODO(), key, obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is mutating the input which is surprising (no docs). Seems like a generic dynamic client concern, not something scoped to just router assets. Maybe extend the Client interface or something?

Also your deep copy additions reminded me that we're probably not being very safe generally in terms of mutating potentially cached items from our client rather than doing copies everywhere...

Copy link
Contributor

@ironcladlou ironcladlou left a comment

Choose a reason for hiding this comment

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

Looking pretty good so far. I'm really afraid of bundling too many state change handlers into this PR which could be incrementally introduced. What if we tried establishing the patterns with the easy ones first (like the cluster and namespace stuff) and then moved on to successively complex cases in followups?

}

current := cr.DeepCopy()
key := types.NamespacedName{Namespace: cr.Namespace, Name: cr.Name}
Copy link
Contributor

Choose a reason for hiding this comment

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

Cluster role isn't namespaced

} else if !errors.IsAlreadyExists(err) {
return fmt.Errorf("failed to create router cluster role %s: %v", cr.Name, err)
}
if err := r.ensureRouterClusterRole(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't namespaced, would it make sense to move it out of ensureRouterNamespace?

// TODO: Should we check for Secrets, ImagePullSecrets and
// AutomountServiceAccountToken - we don't really use those.
// TODO: should we check for label/annotation changes or ignore them?
modified := !reflect.DeepEqual(current.Labels, sa.Labels) || !reflect.DeepEqual(current.Annotations, sa.Annotations)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an annoying one since the struct has no Spec to reflectively compare... is there some util in library-go or elsewhere for a generic "has anything mutable changed" comparisons?

@ramr
Copy link
Contributor Author

ramr commented Dec 21, 2018

@ironcladlou thanks for the comments ... will do the suggested fixes and break this up into 2 PRs as you suggested over the next few days (one for the smaller change to cluster+namespace and the other for the rest). Keeping this around for reference for now.

@ramr
Copy link
Contributor Author

ramr commented Dec 22, 2018

Closing this out in favor of #94 which only updates a subset of the generated resources.

@ramr ramr closed this Dec 22, 2018
@ramr ramr deleted the ne-72 branch February 21, 2019 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

3 participants