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

Test ApiServerSource with Broker as sink #7096

Conversation

Leo6Leo
Copy link
Member

@Leo6Leo Leo6Leo commented Jul 18, 2023

Fixes #6933

Proposed Changes

  • A rekt-based e2e test for PingSource TLS support when using Broker as sink

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

Added a rekt-based e2e test for PingSource TLS support when using Broker as sink

Docs

@knative-prow
Copy link

knative-prow bot commented Jul 18, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/test-and-release Test infrastructure, tests or release labels Jul 18, 2023
@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 18, 2023
@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (0fd9aa1) 77.92% compared to head (4ea09c3) 77.92%.

❗ Current head 4ea09c3 differs from pull request most recent head a851f92. Consider uploading reports for the commit a851f92 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7096   +/-   ##
=======================================
  Coverage   77.92%   77.92%           
=======================================
  Files         248      248           
  Lines       13257    13257           
=======================================
  Hits        10330    10330           
  Misses       2400     2400           
  Partials      527      527           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 18, 2023
@Leo6Leo
Copy link
Member Author

Leo6Leo commented Jul 18, 2023

/retest

@Leo6Leo
Copy link
Member Author

Leo6Leo commented Jul 20, 2023

/cc @pierDipi
Would like to submit the work I have done so far as an early review to gain some feedback!

@knative-prow knative-prow bot requested a review from pierDipi July 20, 2023 04:09
test/rekt/features/apiserversource/feature.go Outdated Show resolved Hide resolved
test/rekt/features/apiserversource/feature.go Outdated Show resolved Hide resolved
test/rekt/features/apiserversource/feature.go Outdated Show resolved Hide resolved
@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 21, 2023
@Leo6Leo Leo6Leo requested a review from pierDipi July 21, 2023 06:12
@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 21, 2023
@Leo6Leo
Copy link
Member Author

Leo6Leo commented Jul 24, 2023

/cc @pierDipi
Last week during our weekly sync meeting with Christoph @creydr , I asked him some questions about this ticket. He suggested that we should only enable TLS for the broker as sink, not subscriber, because that should be handled in another test. WDYT?

test/rekt/features/apiserversource/data_plane.go Outdated Show resolved Hide resolved
test/rekt/features/apiserversource/data_plane.go Outdated Show resolved Hide resolved
test/rekt/features/apiserversource/data_plane.go Outdated Show resolved Hide resolved
test/rekt/features/apiserversource/data_plane.go Outdated Show resolved Hide resolved
@Leo6Leo Leo6Leo marked this pull request as ready for review July 26, 2023 05:36
@Leo6Leo Leo6Leo requested a review from pierDipi July 26, 2023 05:36
@Leo6Leo
Copy link
Member Author

Leo6Leo commented Jul 26, 2023

/retest

@Leo6Leo Leo6Leo changed the title [WIP] Test ApiServerSource with Broker as sink Test ApiServerSource with Broker as sink Jul 27, 2023
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 27, 2023
@Leo6Leo
Copy link
Member Author

Leo6Leo commented Jul 28, 2023

@pierDipi Would you mind helping me review this ticket? Thanks!

test/rekt/apiserversource_test.go Outdated Show resolved Hide resolved
test/rekt/features/apiserversource/data_plane.go Outdated Show resolved Hide resolved
test/rekt/features/apiserversource/data_plane.go Outdated Show resolved Hide resolved
@Leo6Leo Leo6Leo requested a review from creydr July 28, 2023 14:56
@Leo6Leo
Copy link
Member Author

Leo6Leo commented Jul 28, 2023

/retest

@Leo6Leo
Copy link
Member Author

Leo6Leo commented Jul 31, 2023

/cc @Cali0707

@knative-prow knative-prow bot requested a review from Cali0707 July 31, 2023 18:03
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.

The test will not run in CI since transport-encryption is disabled on CI, did you try running this test locally while setting transport-encryption to strict?

test/rekt/features/apiserversource/data_plane.go Outdated Show resolved Hide resolved
@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 1, 2023
@Leo6Leo
Copy link
Member Author

Leo6Leo commented Aug 2, 2023

@pierDipi @creydr I have tried in the local env, unfortunately it didn't work. When I configured the transport-encryption to "strict", it is just starting to fail when creating the broker. Are there something I might be missing?

@pierDipi
Copy link
Member

pierDipi commented Aug 2, 2023

@Leo6Leo describe the error you're getting

@Leo6Leo
Copy link
Member Author

Leo6Leo commented Aug 2, 2023

@pierDipi It just stuck there forever to wait for broker and trigger to become ready.

Here are some details:

The code snippet that related to this

f.Setup("broker is ready", broker.IsReady(brokerName))

What I did

  1. Apply the following yaml file to activate strict mode
apiVersion: v1
kind: ConfigMap
metadata:
  name: config-features
  namespace: knative-eventing
  labels:
    knative.dev/config-propagation: original
    knative.dev/config-category: eventing
data:
  transport-encryption: "strict"
  1. Run the rekt test with the command

SYSTEM_NAMESPACE=knative-eventing go test -v -tags=e2e -count=1 -run TestApiServerSourceDataPlane_BrokerAsSinkTLS -parallel=12 -timeout=30m ./test/rekt

The error log

=== NAME  TestApiServerSourceDataPlane_BrokerAsSinkTLS/SendsEventsWithBrokerAsSinkTLS/Setup/broker_is_ready
    wait.go:200: test-rlvwfksg/broker-hifpjhla condition is {"type":"Ready","status":"False","lastTransitionTime":"2023-08-02T15:09:23Z","reason":"NoAddress","message":"Channel does not have an address."}
=== NAME  TestApiServerSourceDataPlane_BrokerAsSinkTLS/SendsEventsWithBrokerAsSinkTLS/Setup/Wait_for_Trigger_to_become_ready
    wait.go:200: test-rlvwfksg/trigger-imdhsydn condition is {"type":"Ready","status":"False","lastTransitionTime":"2023-08-02T15:09:23Z","reason":"NoAddress","message":"Channel does not have an address."}

My guess on what is happening

"Channel does not have an address" might suggesting that channel need some TLS config, but I don't get it why channel is involved here

@creydr
Copy link
Member

creydr commented Aug 2, 2023

@Leo6Leo Thanks for the summary. This makes it easier to follow.
The channel is created, because the MTChannelBasedBroker is a broker, which is based on a channel. docs/mt-channel-based-broker gives an overview on the MTChannelBasedBroker.

Can you check on the involved components, while the tests are running against your local cluster?
-> start the tests and then check in the test namespace (check via kubectl get ns which got created latest) on the involved components (Broker, channel, etc.).

@pierDipi
Copy link
Member

pierDipi commented Aug 2, 2023

@Leo6Leo make sure to rebase/merge main, so that you pick up the latest changes that fixed a few issues (de2e8ff and 5e76ff2)

@Leo6Leo
Copy link
Member Author

Leo6Leo commented Aug 3, 2023

@Leo6Leo Thanks for the summary. This makes it easier to follow. The channel is created, because the MTChannelBasedBroker is a broker, which is based on a channel. docs/mt-channel-based-broker gives an overview on the MTChannelBasedBroker.

Can you check on the involved components, while the tests are running against your local cluster? -> start the tests and then check in the test namespace (check via kubectl get ns which got created latest) on the involved components (Broker, channel, etc.).

As I can see, only sink is running. Broker is not running.

Currently I am in the process of debugging, with the help from @Cali0707 to set up the debugger and guide me how to start debugging with kubernetes.

What I have tried

  1. Write a yaml file to create a broker
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
  annotations:
    eventing.knative.dev/broker.class: MTChannelBasedBroker
  name: hahabrokersss
  namespace: knative-eventing
  1. Set up the break point at here
    logging.FromContext(ctx).Infow("Reconciling", zap.Any("Broker", b))

The broker can be created, but I checked the log, and it is still saying Channel does not have an address..

And the debugger didn't stop at that line.

I will continue working on this tomorrow. If you could provide any insights that would be really helpful! @pierDipi @creydr

@pierDipi
Copy link
Member

pierDipi commented Aug 3, 2023

@Leo6Leo I believe your installation is not done correctly, creating a broker with strict transport encryption works fine for me

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 3, 2023
@pierDipi
Copy link
Member

pierDipi commented Aug 3, 2023

Can you show how are you installing eventing? Are you using hack/install.sh?

@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 3, 2023
@Leo6Leo
Copy link
Member Author

Leo6Leo commented Aug 3, 2023

export KO_DOCKER_REPO=docker.io/leo6leoredhat
ko apply -f config/
ko apply -Rf config/channels/in-memory-channel/
ko apply -f config/brokers/mt-channel-broker/
kubectl apply -f third_party/cert-manager
ko apply -f test/config/sugar.yaml
ko apply -f test/config-transport-encryption/features.yaml

This is the way I install eventing. I didn't run install.sh
@pierDipi
@creydr
But I am trying to run it right now, encountering some errors while running install.sh. It is prompting ERROR: Knative Monitoring did not come up . Debugging right now

It is working right now by running install.sh

@Leo6Leo Leo6Leo closed this Aug 4, 2023
@Leo6Leo Leo6Leo force-pushed the add-test-ApiServerSource-with-broker-as-sink branch from a851f92 to 37a5651 Compare August 4, 2023 13:26
@knative-prow
Copy link

knative-prow bot commented Aug 4, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Leo6Leo

The full list of commands accepted by this bot can be found 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 size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 4, 2023
@knative-prow
Copy link

knative-prow bot commented Aug 4, 2023

@Leo6Leo: 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
upgrade-tests_eventing_main 37a5651 link true /test upgrade-tests

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test-and-release Test infrastructure, tests or release size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eventing TLS: Test ApiServerSource with Broker as sink
5 participants