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

Support exposing the Audience of a Broker #3600

Conversation

gunishmatta
Copy link
Contributor

Fixes #3520

Proposed Changes

  • Support exposing the Audience of a Broker based on flag IsOIDCAuthentication

Copy link

linux-foundation-easycla bot commented Jan 14, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

knative-prow bot commented Jan 14, 2024

Welcome @gunishmatta! It looks like this is your first PR to knative-extensions/eventing-kafka-broker 🎉

@knative-prow knative-prow bot requested review from aliok and pierDipi January 14, 2024 19:33
@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 14, 2024
Copy link

knative-prow bot commented Jan 14, 2024

Hi @gunishmatta. Thanks for your PR.

I'm waiting for a knative-extensions member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@pierDipi
Copy link
Member

/cc @creydr @Leo6Leo

@knative-prow knative-prow bot requested review from creydr and Leo6Leo January 15, 2024 08:43
@pierDipi
Copy link
Member

@gunishmatta
Copy link
Contributor Author

gunishmatta commented Jan 15, 2024

@pierDipi I have fixed the formatting issues, can you please approve the workflow run?

@creydr
Copy link
Contributor

creydr commented Jan 15, 2024

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 15, 2024
Copy link
Contributor

@creydr creydr left a comment

Choose a reason for hiding this comment

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

Hello @gunishmatta,
thanks for working on this. Can you also add a test in

func brokerReconciliation(t *testing.T, format string, env config.Env) {
for this behavior?

You can check on knative/eventing#7237 too, how this was done for the Broker in eventing-core.

@Leo6Leo
Copy link
Contributor

Leo6Leo commented Jan 15, 2024

@gunishmatta Thanks for the PR! As we can see from the error log of the failing tests, we can see there problems with your code. Hope this information give you some hint!

containerID: containerd://783e4cd89babfca38b1dec1b2fafc1e65d30ccbe2ca0c444a3f64891c2d6bee3
      image: sha256:47ff6e6f1028017bd4e6fefb9b5046f630f6913d16a7750dbd91da68804e6bb7
      imageID: gcr.io/knative-boskos-80/eventing-kafka-broker-e2e-img/7587/kafka-controller-409c76cb00d7d7c46941c7e4c366e4a6@sha256:cfb93cd819ad68831e609a727e848822f10413ed458f53e58ef473c5e19b215d
      lastState:
        terminated:
          containerID: containerd://783e4cd89babfca38b1dec1b2fafc1e65d30ccbe2ca0c444a3f64891c2d6bee3
          exitCode: 2
          finishedAt: "2024-01-15T12:39:41Z"
          message: "cileKind(0xc00007d4a0, {0x2591bc8, 0xc001805620}, 0xc000fbaa80)\n\tknative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/broker/broker.go:271
            +0x2836\nknative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/broker.(*Reconciler).ReconcileKind.func1()\n\tknative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/broker/broker.go:90
            +0x25\nk8s.io/client-go/util/retry.OnError.func1()\n\tk8s.io/client-go@v0.28.5/util/retry/util.go:51
            +0x30\nk8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtection(0x2202727?)\n\tk8s.io/apimachinery@v0.28.5/pkg/util/wait/wait.go:145
            +0x3e\nk8s.io/apimachinery/pkg/util/wait.ExponentialBackoff({0x989680,
            0x4014000000000000, 0x3fb999999999999a, 0x4, 0x0}, 0xc000fbab98?)\n\tk8s.io/apimachinery@v0.28.5/pkg/util/wait/backoff.go:461
            +0x5a\nk8s.io/client-go/util/retry.OnError({0x989680, 0x4014000000000000,
            0x3fb999999999999a, 0x4, 0x0}, 0x2202727?, 0x5?)\n\tk8s.io/client-go@v0.28.5/util/retry/util.go:50
            +0xa5\nk8s.io/client-go/util/retry.RetryOnConflict(...)\n\tk8s.io/client-go@v0.28.5/util/retry/util.go:104\nknative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/broker.(*Reconciler).ReconcileKind(0x6?,
            {0x2591bc8?, 0xc001805620?}, 0xc000fbab98?)\n\tknative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/broker/broker.go:89
            +0xb5\nknative.dev/eventing/pkg/client/injection/reconciler/eventing/v1/broker.(*reconcilerImpl).Reconcile(0xc0002654a0,
            {0x2591bc8, 0xc0018055c0}, {0xc0016cbf60, 0xd})\n\tknative.dev/eventing@v0.39.1-0.20240111175334-3cbddd640f53/pkg/client/injection/reconciler/eventing/v1/broker/reconciler.go:251
            +0x5f9\nknative.dev/pkg/controller.(*Impl).processNextWorkItem(0xc0005e8a20)\n\tknative.dev/pkg@v0.0.0-20240111013350-bc230ae58d14/controller/controller.go:542
            +0x4ad\nknative.dev/pkg/controller.(*Impl).RunContext.func3()\n\tknative.dev/pkg@v0.0.0-20240111013350-bc230ae58d14/controller/controller.go:491
            +0x59\ncreated by knative.dev/pkg/controller.(*Impl).RunContext in goroutine
            365\n\tknative.dev/pkg@v0.0.0-20240111013350-bc230ae58d14/controller/controller.go:489
            +0x349\n"
          reason: Error
          startedAt: "2024-01-15T12:39:09Z"

You can get the complete log here. Let us know if you have any other questions!

@creydr
Copy link
Contributor

creydr commented Jan 19, 2024

Hello @gunishmatta,
can we help you somehow on this?

@gunishmatta
Copy link
Contributor Author

@creydr sorry was busy with work during the week, will debug it today

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 21, 2024
@gunishmatta
Copy link
Contributor Author

/retest-required

1 similar comment
@gunishmatta
Copy link
Contributor Author

/retest-required

@gunishmatta
Copy link
Contributor Author

Hi Team @pierDipi @creydr , Please give a final review to the PR and provide the feedback.

Thanks a lot

Looking forward to contribute more to knative community.

@gunishmatta
Copy link
Contributor Author

Thanks for the feedback, I will be working on the feedback, you can expect an update within a few days.

@creydr
Copy link
Contributor

creydr commented Jan 29, 2024

Hey @gunishmatta,
can I help you somehow on this?
I am working on exposing the audience from a KafkaChannel in #3622. Maybe this helps you a bit.

Two/three main things what I've seen, what's missing:

@gunishmatta
Copy link
Contributor Author

HI @creydr very sorry, was occupied with work commitments last week, I will try to get out time and update the PR before this weekend.

Thanks for the support.

@Leo6Leo
Copy link
Contributor

Leo6Leo commented Feb 5, 2024

@gunishmatta Hey Gunish, are you being blocked by any issue? anything we could help you with on this PR?

@creydr
Copy link
Contributor

creydr commented Feb 8, 2024

@gunishmatta Since it seemed you were occupied with other work and there was not much left to do, I added the missing bits from my comment in 6d9b33d (and run gofmt & goimports 5f7bd8b). I hope that's ok.

@Leo6Leo looks OK from my side. Can you recheck (as I committed to this PR now too 😄 )

/assign @Leo6Leo

@creydr
Copy link
Contributor

creydr commented Feb 8, 2024

/test channel-reconciler-tests-ssl

@creydr
Copy link
Contributor

creydr commented Feb 8, 2024

/test reconciler-tests-namespaced-broker

@creydr
Copy link
Contributor

creydr commented Feb 8, 2024

@Leo6Leo can you PTAL

@Leo6Leo
Copy link
Contributor

Leo6Leo commented Feb 8, 2024

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2024
@Leo6Leo Leo6Leo dismissed creydr’s stale review February 8, 2024 20:58

As the comments have been addressed

Copy link

knative-prow bot commented Feb 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr, gunishmatta

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 knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 8, 2024
@creydr
Copy link
Contributor

creydr commented Feb 8, 2024

/test reconciler-tests

@creydr
Copy link
Contributor

creydr commented Feb 9, 2024

/retest-required

@creydr
Copy link
Contributor

creydr commented Feb 9, 2024

/test reconciler-tests-namespaced-broker

@knative-prow knative-prow bot merged commit d6a383f into knative-extensions:main Feb 9, 2024
37 checks passed
creydr added a commit to creydr/knative-eventing-kafka-broker that referenced this pull request Feb 21, 2024
* Support exposing the Audience of a Broker

* fix formatting

* fix formatting

* test fixes

* Populate broker.status.addresses[*].audience field too

* Run goimports and gofmt

* Fix unit test

---------

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>
creydr added a commit to creydr/knative-eventing-kafka-broker that referenced this pull request Mar 18, 2024
* Support exposing the Audience of a Broker

* fix formatting

* fix formatting

* test fixes

* Populate broker.status.addresses[*].audience field too

* Run goimports and gofmt

* Fix unit test

---------

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>
creydr added a commit to creydr/knative-eventing-kafka-broker that referenced this pull request Apr 2, 2024
* Support exposing the Audience of a Broker

* fix formatting

* fix formatting

* test fixes

* Populate broker.status.addresses[*].audience field too

* Run goimports and gofmt

* Fix unit test

---------

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>
openshift-merge-bot bot pushed a commit to openshift-knative/eventing-kafka-broker that referenced this pull request Apr 3, 2024
* Update contract with fields for OIDC information (knative-extensions#3632)

* Update contract to include OIDC information

* Run hack/update-codegen.sh

* Move OIDC SA to egress

* Expose OIDC audience of KafkaChannel in its status (knative-extensions#3622)

* Provision .status.address.audience and .status.addresses[*].audience in KafkaChannel

* Add kafka Channel e2e test to check if audience is provisioned

* Run goimport

* Update deps

* Auto generate Triggers OIDC identity service account and expose in its status (knative-extensions#3604)

* Support auto generation of Triggers identity service account and expose in AuthStatus

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* make ServiceAccountLister public

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* add oidc unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* integrate oidc unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* add some logic to reconcile triggers, if the features config map gets updated

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* revert vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix Verify Deps and Codegen test

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* fix unit test and reconcile triggers, in case of the features configmap changes

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

---------

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

* Create KafkaSources OIDC service account and expose in its status (knative-extensions#3660)

* Create KafkaSources OIDC service account and expose in its status

* Run goimport

* Provision contract with OIDC information (knative-extensions#3646)

* Provision contract with OIDC information

* Add DLS audience in KafkaChannel CRD

* Update KafkaSource to expose its sinks audience in status

* Update Trigger test to include OIDC SA in contract

* Propagate KafkaSources OIDC serviceAccountName to consumer and consumergroup

* Propagate triggerv2s serviceAccountName to consumergroup

* Fix unit test

* [data-plane] Add the caching for OIDC JWT token to tokenprovider (knative-extensions#3663)

* Add the caching to tokenprovider

* Add the boiler

* Running the codegen

* Running the codegen

* Revert "Running the codegen"

This reverts commit 0ccf69c.

* Use constant, set buffer before token expire, remove unnecessary change

* Codegen changes

* Codegen changes

* Update data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/oidc/TokenProvider.java

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>

* Fix the review comments

* Run codegen

* Codegen changes

* Code gen again

---------

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>

* Receiver reject requests for wrong audience (knative-extensions#3675)

* Receiver: reject request for wrong audience

* Switch to AuthenticationHandler

* Fix "Request has already been read" issue

* Change TokenVerifier to an interface

* Initialize TokenVerifier in main

* Add test for AuthenticationHandler

* Only initialize OIDC discovery config in main and create a TokenVerifier per verticle instance.

* Rerun hack/update-codegen.sh

* Move TokenVerifier setup into setup() to prevent null pointer exception when vertx is null

* Update KafkaChannel OIDC e2e tests, to run OIDC conformance tests so the receiver is tested too.

* Run OIDC e2e tests as part of the reconciler suite

* Fix KafkaChannelOIDC e2e test

* Fix lint issue

* Address review comments

* Dispatcher authenticate requests (knative-extensions#3677)

* Change TokenProvider to return future to get a token

* Dispatcher add OIDC to token, when target has an audience set

* Add e2e test

* Support exposing the Audience of a Broker (knative-extensions#3600)

* Support exposing the Audience of a Broker

* fix formatting

* fix formatting

* test fixes

* Populate broker.status.addresses[*].audience field too

* Run goimports and gofmt

* Fix unit test

---------

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>

* Add broker OIDC e2e tests (knative-extensions#3685)

* Add broker OIDC e2e tests

* Fix broker template to allow TLS & OIDC configuration on dead letter sink

* Remove unneeded check when setting broker audience (knative-extensions#3708)

* Check status code of OIDC discovery response (knative-extensions#3707)

* Check status code of OIDC discovery endpoint

* Run update-codegen.sh

* Only allow 200 status code on OIDC discovery endpoint

* Run update-deps.sh

* Add OIDC tests to encryption/auth test suite

* run make generate-release

* TokenVerifier: execute blocking calls in parallel (knative-extensions#3728)

* TokenVerifier: execute blocking calls in parallel

* Revert "TokenVerifier: execute blocking calls in parallel"

This reverts commit f3dbde9.

* Revert: removed changes in contract.pb.go

* Cancel receiver pod start on invalid OIDC config only if authentication.oidc is enabled (knative-extensions#3761)

* Cancel pod start on invalid OIDC config only if authentication.oidc is enabled

* Update namespaced broker to copy features configmap too.

* Add unit test for FeaturesConfig class (knative-extensions#3771)

* Add unit test for FeaturesConfig class

* Update data-plane/core/src/test/java/dev/knative/eventing/kafka/broker/core/features/FeaturesConfigTest.java

Co-authored-by: Calum Murray <cmurray@redhat.com>

---------

Co-authored-by: Calum Murray <cmurray@redhat.com>

* Run make generate-release again

---------

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>
Co-authored-by: cola <45722758+xiangpingjiang@users.noreply.github.com>
Co-authored-by: Leo Li <leoli@redhat.com>
Co-authored-by: Gunish Matta <33680363+gunishmatta@users.noreply.github.com>
Co-authored-by: Partha Ghosh <112557191+parth721@users.noreply.github.com>
Co-authored-by: Calum Murray <cmurray@redhat.com>
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 lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

[control-plane]: Support exposing the Audience of a Broker
4 participants