Skip to content

Commit

Permalink
Save the work progress: Blocked by the strict mode. Broker cannot be …
Browse files Browse the repository at this point in the history
…created under strict mode
  • Loading branch information
Leo6Leo committed Aug 1, 2023
1 parent a40c3b1 commit c76a892
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 41 deletions.
24 changes: 24 additions & 0 deletions test/config-transport-encryption/features.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2021 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

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"

Check failure on line 24 in test/config-transport-encryption/features.yaml

View workflow job for this annotation

GitHub Actions / style / Golang / Lint

[EOF Newline] reported by reviewdog 🐶 Missing newline Raw Output: test/config-transport-encryption/features.yaml:24: Missing newline
2 changes: 2 additions & 0 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ UNINSTALL_LIST=()

# Setup the Knative environment for running tests.
function knative_setup() {
install_cert_manager || fail_test "Could not install Cert Manager"

install_knative_eventing "HEAD"

install_mt_broker || fail_test "Could not install MT Channel Based Broker"
Expand Down
1 change: 1 addition & 0 deletions test/rekt/apiserversource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func TestApiServerSourceDataPlane_BrokerAsSinkTLS(t *testing.T) {
k8s.WithEventListener,
environment.Managed(t),
eventshub.WithTLS(t),
environment.WithPollTimings(5*time.Second, 2*time.Minute),
)

env.Test(ctx, t, apiserversourcefeatures.SendsEventsWithBrokerAsSinkTLS())
Expand Down
83 changes: 42 additions & 41 deletions test/rekt/features/apiserversource/data_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,53 +768,54 @@ func SendsEventsWithRetries() *feature.Feature {
}

func SendsEventsWithBrokerAsSinkTLS() *feature.Feature {
src := feature.MakeRandomK8sName("apiserversource")
//src := feature.MakeRandomK8sName("apiserversource")
brokerName := feature.MakeRandomK8sName("broker")
sinkName := feature.MakeRandomK8sName("sink") // keep the random name for the eventshub
triggerName := feature.MakeRandomK8sName("trigger")
//sinkName := feature.MakeRandomK8sName("sink") // keep the random name for the eventshub
//triggerName := feature.MakeRandomK8sName("trigger")
f := feature.NewFeature()

f.Prerequisite("transport encryption is strict", featureflags.TransportEncryptionStrict())
f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled())
//f.Prerequisite("transport encryption is strict", featureflags.TransportEncryptionStrict())
//f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled())

f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...))
f.Setup("broker is ready", broker.IsReady(brokerName))
f.Setup("broker is addressable", broker.IsAddressable(brokerName))
f.Setup("install sink", eventshub.Install(sinkName, eventshub.StartReceiverTLS)) // install eventshub as sink

// Install Trigger
f.Setup("Install trigger", trigger.Install(triggerName, brokerName, trigger.WithSubscriber(service.AsKReference(sinkName), "")))
f.Setup("Wait for Trigger to become ready", trigger.IsReady(triggerName))

f.Setup("Create Service Account for ApiServerSource with RBAC for v1.Event resources",
setupAccountAndRoleForPods(src))

f.Requirement("install ApiServerSource", func(ctx context.Context, t feature.T) {
brokeruri, err := broker.Address(ctx, brokerName)
brokeruri.CACerts = eventshub.GetCaCerts(ctx)
if err != nil {
t.Error("failed to get address of broker", err)
}
cfg := []manifest.CfgFn{
apiserversource.WithServiceAccountName(src),
apiserversource.WithEventMode(v1.ResourceMode),
apiserversource.WithSink(service.AsDestinationRef(brokerName)),
apiserversource.WithResources(v1.APIVersionKindSelector{
APIVersion: "v1",
Kind: "Event",
}),
}
apiserversource.Install(src, cfg...)(ctx, t)
})
f.Requirement("ApiServerSource goes ready", apiserversource.IsReady(src))

f.Stable("ApiServerSource as event source").
Must("delivers events on the broker sink",
eventasssert.OnStore(sinkName).MatchEvent(test.HasType(sources.ApiServerSourceUpdateEventType)).AtLeast(1)). // assert events on eventshub
Must("ApiServerSource has HTTPS sink",
source.ExpectHTTPSSink(v1.SchemeGroupVersion.WithResource("apiserversources"), src)). // assert HTTPS sink for ApiServerSource
Must("ApiServerSource has CA certs",
source.ExpectCACerts(v1.SchemeGroupVersion.WithResource("apiserversources"), src)) // assert CA certs for ApiServerSource
//f.Setup("broker is addressable", broker.IsAddressable(brokerName))
//f.Setup("install sink", eventshub.Install(sinkName, eventshub.StartReceiverTLS)) // install eventshub as sink
//
//// Install Trigger
////f.Setup("Install trigger", trigger.Install(triggerName, brokerName, trigger.WithSubscriber(service.AsKReference(sinkName), "")))
////f.Setup("Wait for Trigger to become ready", trigger.IsReady(triggerName))
//
//f.Setup("Create Service Account for ApiServerSource with RBAC for v1.Event resources",
// setupAccountAndRoleForPods(src))
//
//f.Requirement("install ApiServerSource", func(ctx context.Context, t feature.T) {
// brokeruri, err := broker.Address(ctx, brokerName)
// brokeruri.CACerts = eventshub.GetCaCerts(ctx)
// if err != nil {
// t.Error("failed to get address of broker", err)
// }
// cfg := []manifest.CfgFn{
// apiserversource.WithServiceAccountName(src),
// apiserversource.WithEventMode(v1.ResourceMode),
// apiserversource.WithSink(service.AsDestinationRef(brokerName)),
// apiserversource.WithResources(v1.APIVersionKindSelector{
// APIVersion: "v1",
// Kind: "Event",
// }),
// }
// apiserversource.Install(src, cfg...)
//})
//
//f.Requirement("ApiServerSource goes ready", apiserversource.IsReady(src))
//
//f.Stable("ApiServerSource as event source").
// Must("delivers events on the broker sink",
// eventasssert.OnStore(sinkName).MatchEvent(test.HasType(sources.ApiServerSourceUpdateEventType)).AtLeast(1)). // assert events on eventshub
// Must("ApiServerSource has HTTPS sink",
// source.ExpectHTTPSSink(v1.SchemeGroupVersion.WithResource("apiserversources"), src)). // assert HTTPS sink for ApiServerSource
// Must("ApiServerSource has CA certs",
// source.ExpectCACerts(v1.SchemeGroupVersion.WithResource("apiserversources"), src)) // assert CA certs for ApiServerSource

return f
}

0 comments on commit c76a892

Please sign in to comment.