Skip to content

Implement KReference.Group resolution for Subscriber.Ref#5440

Merged
knative-prow-robot merged 23 commits intoknative:mainfrom
slinkydeveloper:kreference_group
Jun 16, 2021
Merged

Implement KReference.Group resolution for Subscriber.Ref#5440
knative-prow-robot merged 23 commits intoknative:mainfrom
slinkydeveloper:kreference_group

Conversation

@slinkydeveloper
Copy link
Contributor

@slinkydeveloper slinkydeveloper commented May 27, 2021

Part of the experimental feature #5086
Requires knative/pkg#2127

Proposed Changes

  • 🎁 Add experimental feature kreference-group
  • 🎁 Implement KReference.Group resolution for Subscriber.Ref
  • 🎁 Included code to enable reading the experimental config map in the eventing-webhook (I can move these to another PR if you want to)

Pre-review Checklist

  • At least 80% unit test coverage: All the additional code is unit tested
  • E2E tests for any new behavior: Added a channel to channel e2e test
  • Docs PR for any user-facing impact Documentation for KReference.Group feature docs#3713
  • Spec PR for any new API feature: N/A (ALPHA feature)
  • Conformance test for any change to the spec: N/A (ALPHA feature)

Release Note

Added the experimental feature kreference-group. Enabling it, you can use Subscriber.Ref.Group instead of Subscriber.Ref.APIVersion to refer to another Resource, without being explicit about the resource version (e.g. v1beta1, v1, ...)

@knative-prow-robot knative-prow-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. area/test-and-release Test infrastructure, tests or release size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 27, 2021
@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 27, 2021
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label May 27, 2021
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 27, 2021
@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented May 27, 2021

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 27, 2021
slinkydeveloper added a commit to slinkydeveloper/eventing that referenced this pull request Jun 1, 2021
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
knative-prow-robot pushed a commit that referenced this pull request Jun 1, 2021
* Added tristate flags
Renamed experimental features config map

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Update doc

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* goimports

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Added some nits from #5440

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Boilerplate

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Fixed bad links in the doc and bad name

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 2, 2021
channelGroup := channelGVK.GroupKind().Group
channelAPIVersion, imcKind := channelGVK.ToAPIVersionAndKind()

channelAName := feature.MakeRandomK8sName("channel-a")
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is much more clear if you use the prober code. See the broker/channel conformance tests for an example.


f.Setup("Install channel A -> channel B subscription", func(ctx context.Context, t feature.T) {
namespace := environment.FromContext(ctx).Namespace()
_, err := eventingclient.Get(ctx).MessagingV1().Subscriptions(namespace).Create(ctx,
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than do this, you can use the subscription.Install resource package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBH I think this code is cleaner. Also I was worried to use it, because in order to do so, I need to modify the template to allow for the new group field. I would rather keep it this way and revisit in future.

@@ -24,7 +24,7 @@ import (
"testing"
Copy link
Contributor

Choose a reason for hiding this comment

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

This file needs a build flag set on it, maybe +build e2e,experimental

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need to have another flag, given we already have e2e? Isn't that enough? I see we don't make difference between e2e/conformance/rekt in terms of build flags, they all use e2e

@slinkydeveloper
Copy link
Contributor Author

Depends on #5479

@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 9, 2021
@slinkydeveloper slinkydeveloper requested a review from n3wscott June 10, 2021 16:13
@slinkydeveloper
Copy link
Contributor Author

pkg PR is merged, I've added the new changes here but I probably need to let #5495 go in before updating this one deps

…conformance tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Fix e2e tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/feature/store.go 88.2% 85.0% -3.2
pkg/reconciler/subscription/subscription.go 86.8% 85.9% -0.9

@codecov
Copy link

codecov bot commented Jun 15, 2021

Codecov Report

Merging #5440 (46afa33) into main (8a110a1) will decrease coverage by 0.07%.
The diff coverage is 61.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5440      +/-   ##
==========================================
- Coverage   82.69%   82.62%   -0.08%     
==========================================
  Files         198      198              
  Lines        6098     6117      +19     
==========================================
+ Hits         5043     5054      +11     
- Misses        731      737       +6     
- Partials      324      326       +2     
Impacted Files Coverage Δ
pkg/reconciler/subscription/subscription.go 80.40% <40.00%> (-1.72%) ⬇️
pkg/apis/feature/store.go 81.48% <50.00%> (-6.02%) ⬇️
pkg/reconciler/subscription/controller.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a110a1...46afa33. Read the comment docs.

@slinkydeveloper
Copy link
Contributor Author

/unhold

This is now ready to be merged

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 15, 2021
Copy link
Member

@matzew matzew left a comment

Choose a reason for hiding this comment

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

Thanks for this

/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew, slinkydeveloper

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:
  • OWNERS [matzew,slinkydeveloper]

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

@slinkydeveloper
Copy link
Contributor Author

/hold
let's let somebody else have a look before merging :)

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 16, 2021
data:
# ALPHA feature: The kreference-group allows you to use the Group field in KReferences.
# For more details: https://github.com/knative/eventing/issues/5086
kreference-group: "disabled"
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably fine for now but eventually it should look more like https://github.com/knative/serving/blob/main/config/core/configmaps/features.yaml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mhh yeah seems like we don't have the example, but do we really need it? Isn't simpler for the user to have the flags already configured? Also, considering at some point some of them will become enabled by default?

@lionelvillard
Copy link
Contributor

This is great, thanks for doing this!

/lgtm

@slinkydeveloper
Copy link
Contributor Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 16, 2021
@slinkydeveloper
Copy link
Contributor Author

/retest

@knative-prow-robot knative-prow-robot merged commit 6adafe5 into knative:main Jun 16, 2021
@slinkydeveloper slinkydeveloper deleted the kreference_group branch June 16, 2021 16:50
aliok added a commit to aliok/eventing that referenced this pull request Jun 21, 2021
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. area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants