Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger Reconciler for ConsumerGroup scaling #1569

Conversation

aavarghese
Copy link
Contributor

@aavarghese aavarghese commented Dec 3, 2021

Part of #1537 (triggerv2_test.go coming soon)

Proposed Changes

  • Adding new Trigger reconciler to create ConsumerGroup resources

Release Note


Docs

@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 3, 2021
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Dec 3, 2021
@knative-prow-robot knative-prow-robot added area/control-plane size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 3, 2021
@codecov
Copy link

codecov bot commented Dec 3, 2021

Codecov Report

Merging #1569 (96fc294) into main (6551287) will decrease coverage by 1.73%.
The diff coverage is 20.71%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1569      +/-   ##
============================================
- Coverage     74.87%   73.13%   -1.74%     
  Complexity      595      595              
============================================
  Files           116      118       +2     
  Lines          4211     4348     +137     
  Branches        171      171              
============================================
+ Hits           3153     3180      +27     
- Misses          802      909     +107     
- Partials        256      259       +3     
Flag Coverage Δ
java-unittests 81.80% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ls/kafka/eventing/v1alpha1/consumer_group_types.go 0.00% <ø> (ø)
...nternals/kafka/eventing/v1alpha1/consumer_types.go 0.00% <ø> (ø)
...ntrol-plane/pkg/reconciler/trigger/v2/triggerv2.go 0.00% <0.00%> (ø)
...ol-plane/pkg/reconciler/trigger/v2/controllerv2.go 50.00% <50.00%> (ø)
control-plane/pkg/reconciler/trigger/trigger.go 70.83% <66.66%> (ø)

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 6551287...96fc294. Read the comment docs.

@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch from 8c90821 to 69481b8 Compare December 3, 2021 19:41
@knative-prow-robot knative-prow-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 3, 2021
Copy link
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

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

We should create a new Trigger reconciler rather than changing the existing one since the logic is completely different between the 2.

control-plane/pkg/reconciler/trigger/trigger.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/trigger.go Outdated Show resolved Hide resolved
@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch 2 times, most recently from 19e6eb3 to c4122fa Compare December 7, 2021 14:18
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 7, 2021
@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch 2 times, most recently from afd1b3f to 3f3fd62 Compare December 8, 2021 06:36
@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 8, 2021
@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch from 3f3fd62 to 07af0c9 Compare December 8, 2021 17:18
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 8, 2021
@aavarghese aavarghese changed the title [WIP] Trigger Reconciler for ConsumerGroup scaling Trigger Reconciler for ConsumerGroup scaling Dec 8, 2021
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 8, 2021
control-plane/pkg/reconciler/trigger/triggerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/triggerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/triggerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/triggerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/triggerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/triggerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/triggerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/triggerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/controllerv2.go Outdated Show resolved Hide resolved
control-plane/pkg/reconciler/trigger/controllerv2.go Outdated Show resolved Hide resolved
@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch from d9301fe to 5cf4f38 Compare December 9, 2021 18:13
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 9, 2021
@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch from 5cf4f38 to c03a124 Compare December 9, 2021 22:25
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 9, 2021
@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch from c03a124 to 160ab6c Compare December 9, 2021 23:10
Spec: internalscg.ConsumerGroupSpec{
Template: internalscg.ConsumerTemplateSpec{
Spec: internalscg.ConsumerSpec{
Topics: []string{}, //todo from contract resource
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we should get topics from the broker status.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure - will add in my next iteration along with unit test

Template: internalscg.ConsumerTemplateSpec{
Spec: internalscg.ConsumerSpec{
Topics: []string{}, //todo from contract resource
Configs: internalscg.ConsumerConfigs{Configs: map[string]string{"group.id": string(trigger.UID)}},
Copy link
Member

Choose a reason for hiding this comment

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

We should also set bootstrap.servers that we, ideally, get from the broker status.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above

@pierDipi
Copy link
Member

/lgtm

=== RUN   TestNewControllerV2
    logger.go:130: 2021-12-10T13:32:17.206Z	PANIC	dynamicclient/dynamicclient.go:45	Unable to fetch k8s.io/client-go/dynamic.Interface from context.
--- FAIL: TestNewControllerV2 (0.00s)
panic: Unable to fetch k8s.io/client-go/dynamic.Interface from context. [recovered]
	panic: Unable to fetch k8s.io/client-go/dynamic.Interface from context.

goroutine 13 [running]:
testing.tRunner.func1.2({0x23c4120, 0xc0000afa00})
	/root/.gvm/gos/go1.17.2/src/testing/testing.go:1209 +0x36c
testing.tRunner.func1()
	/root/.gvm/gos/go1.17.2/src/testing/testing.go:1212 +0x3b6
panic({0x23c4120, 0xc0000afa00})
	/root/.gvm/gos/go1.17.2/src/runtime/panic.go:1047 +0x266
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc000241080, {0x0, 0x0, 0x0})
	/home/prow/go/src/knative.dev/eventing-kafka-broker/vendor/go.uber.org/zap/zapcore/entry.go:232 +0x5e9
go.uber.org/zap.(*SugaredLogger).log(0xc00061c350, 0x4, {0x0, 0x0}, {0xc00031dc08, 0x1, 0x1}, {0x0, 0x0, 0x0})
	/home/prow/go/src/knative.dev/eventing-kafka-broker/vendor/go.uber.org/zap/sugar.go:227 +0x13b
go.uber.org/zap.(*SugaredLogger).Panic(...)
	/home/prow/go/src/knative.dev/eventing-kafka-broker/vendor/go.uber.org/zap/sugar.go:123
knative.dev/pkg/injection/clients/dynamicclient.Get({0x2c7a660, 0xc000185c20})
	/home/prow/go/src/knative.dev/eventing-kafka-broker/vendor/knative.dev/pkg/injection/clients/dynamicclient/dynamicclient.go:45 +0xfc
knative.dev/pkg/client/injection/ducks/duck/v1/addressable.WithDuck({0x2c7a660, 0xc000185c20})
	/home/prow/go/src/knative.dev/eventing-kafka-broker/vendor/knative.dev/pkg/client/injection/ducks/duck/v1/addressable/addressable.go:40 +0x5a
knative.dev/pkg/injection.(*impl).SetupInformers(0x2c7a5b8, {0x2c7a660, 0xc000185710}, 0x3c7d410)
	/home/prow/go/src/knative.dev/eventing-kafka-broker/vendor/knative.dev/pkg/injection/informers.go:116 +0x1ef
knative.dev/pkg/reconciler/testing.SetupFakeContextWithCancel({0x2cd11d0, 0xc000627a00}, {0x0, 0x0, 0xc0000abe78})
	/home/prow/go/src/knative.dev/eventing-kafka-broker/vendor/knative.dev/pkg/reconciler/testing/context.go:57 +0x238
knative.dev/pkg/reconciler/testing.SetupFakeContext(...)
	/home/prow/go/src/knative.dev/eventing-kafka-broker/vendor/knative.dev/pkg/reconciler/testing/context.go:44
knative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/trigger/v2.TestNewControllerV2(0xc000627a00)
	/home/prow/go/src/knative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/trigger/v2/controllerv2_test.go:36 +0x45
testing.tRunner(0xc000627a00, 0x27bd1e0)
	/root/.gvm/gos/go1.17.2/src/testing/testing.go:1259 +0x230
created by testing.(*T).Run
	/root/.gvm/gos/go1.17.2/src/testing/testing.go:1306 +0x727

We can merge this once the test is fixed.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 13, 2021
Signed-off-by: aavarghese <avarghese@us.ibm.com>
Signed-off-by: aavarghese <avarghese@us.ibm.com>
@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch from 10c35f6 to 0fb095b Compare December 13, 2021 16:38
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 13, 2021
Signed-off-by: aavarghese <avarghese@us.ibm.com>
@aavarghese aavarghese force-pushed the consumer-scheduling-scaling-trigger branch from 0fb095b to 97af4f1 Compare December 13, 2021 16:56
@pierDipi
Copy link
Member

This should be the fix:

diff --git a/control-plane/pkg/reconciler/trigger/v2/controllerv2_test.go b/control-plane/pkg/reconciler/trigger/v2/controllerv2_test.go
index 5bb5a0a0..0f2edc46 100644
--- a/control-plane/pkg/reconciler/trigger/v2/controllerv2_test.go
+++ b/control-plane/pkg/reconciler/trigger/v2/controllerv2_test.go
@@ -21,14 +21,15 @@ import (
 
        reconcilertesting "knative.dev/pkg/reconciler/testing"
 
-       _ "knative.dev/eventing-kafka-broker/control-plane/pkg/client/internals/kafka/injection/informers/eventing/v1alpha1/consumergroup/fake"
        _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1/broker/fake"
        _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1/trigger/fake"
-       _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable/fake"
+       _ "knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
        _ "knative.dev/pkg/client/injection/kube/informers/core/v1/configmap/fake"
        _ "knative.dev/pkg/client/injection/kube/informers/core/v1/pod/fake"
        _ "knative.dev/pkg/client/injection/kube/informers/core/v1/secret/fake"
 
+       _ "knative.dev/eventing-kafka-broker/control-plane/pkg/client/internals/kafka/injection/informers/eventing/v1alpha1/consumergroup/fake"
+
        "knative.dev/eventing-kafka-broker/control-plane/pkg/config"
 )

Signed-off-by: aavarghese <avarghese@us.ibm.com>
@knative-metrics-robot
Copy link

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

File Old Coverage New Coverage Delta
control-plane/pkg/reconciler/trigger/v2/controllerv2.go Do not exist 34.1%
control-plane/pkg/reconciler/trigger/v2/triggerv2.go Do not exist 0.0%

@knative-prow-robot
Copy link
Contributor

knative-prow-robot commented Dec 13, 2021

@aavarghese: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-knative-sandbox-eventing-kafka-broker-go-coverage 96fc294 link false /test pull-knative-sandbox-eventing-kafka-broker-go-coverage

Full PR test history. Your PR dashboard.

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.

Copy link
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aavarghese, pierDipi

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

The pull request process is described here

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 Dec 13, 2021
@knative-prow-robot knative-prow-robot merged commit 40e33d2 into knative-extensions:main Dec 13, 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/control-plane cla: yes Indicates the PR's author has signed the CLA. 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