Skip to content

Flow resource creation comes from the resource dir.#316

Merged
knative-prow-robot merged 2 commits into
knative:masterfrom
n3wscott:make-resources
Aug 10, 2018
Merged

Flow resource creation comes from the resource dir.#316
knative-prow-robot merged 2 commits into
knative:masterfrom
n3wscott:make-resources

Conversation

@n3wscott
Copy link
Copy Markdown
Contributor

@n3wscott n3wscott commented Aug 3, 2018

Taking the good parts of #281.

Using the type inspection for owner ref and the pattern for using resources dir to create the resources.

@google-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

If they are not already assigned, you can assign the PR to them by writing /assign @mattmoor 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

@google-prow-robot google-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 3, 2018
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-eventing-go-coverage to run the coverage report again

File Old Coverage New Coverage Delta
pkg/controller/flow/reconcile.go 45.2% 44.3% -0.9

@n3wscott
Copy link
Copy Markdown
Contributor Author

n3wscott commented Aug 3, 2018

/test pull-knative-eventing-integration-tests

1 similar comment
@n3wscott
Copy link
Copy Markdown
Contributor Author

n3wscott commented Aug 3, 2018

/test pull-knative-eventing-integration-tests

@n3wscott
Copy link
Copy Markdown
Contributor Author

n3wscott commented Aug 3, 2018

/assign @grantr

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

This is a reasonable cleanup, thanks @n3wscott.
/lgtm

I still don't like the type case but I've made my peace with it for now. 😄 I offer an optional suggestion for eliminating it, if you so choose. 😇

Name: channelName,
Namespace: flow.Namespace,
OwnerReferences: []metav1.OwnerReference{
*controller.NewControllerRef(flow),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A possible alternative to this and other controller references is https://github.com/kubernetes-sigs/controller-runtime/blob/471f9cde2471949c85c01c3baba2947d9929c908/pkg/controller/controllerutil/controllerutil.go, which can generate a controller ref between any two metav1.Objects, no type case needed.

import "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"

func MakeChannel(flow *v1alpha1.Flow) *channelsv1alpha1.Channel {
  channel := &channelsv1alpha1.Channel{}
  controllerutil.SetOwnerReference(flow, channel, scheme.Scheme)
  return channel
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let's make a bug and a follow-up to fix this here and in serving. I can do this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2018
@grantr
Copy link
Copy Markdown
Contributor

grantr commented Aug 6, 2018

/assign @evankanderson
for approval

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

},
},
}
if flow.Spec.ServiceAccountName != "" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not copy unconditionally?

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson, grantr, n3wscott

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2018
@knative-prow-robot knative-prow-robot merged commit 42a0c9e into knative:master Aug 10, 2018
n3wscott added a commit to n3wscott/eventing that referenced this pull request Aug 14, 2018
* Working on moving resource creation to resource dir.

* Update to not block owner ref.
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.

6 participants