-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bumping knative.dev/reconciler-test 03cc77c...785e0bd: > 785e0bd Improve error message when deleting resources (# 618) > 7d36fe9 Copy pull secrets to SA for eventshub (# 615) > e52650f upgrade to latest dependencies (# 606) bumping knative.dev/pkg bd99f2f...56bfe0d: > 56bfe0d [release-1.11] [CVE-2023-44487] Disable http2 for webhooks (# 2875) bumping knative.dev/eventing 6a695cb...0dadfd9: > 0dadfd9 [release-1.11] Scheduler: fix reserved replicas handling, blocking autoscaler and overcommitted pods (# 7374) > c1626f1 [release-1.11] Update dependencies (# 7362) > 46cc775 [release-1.11] TLS certificate rotation tests (# 7103) (# 7346) Signed-off-by: Knative Automation <[email protected]>
- Loading branch information
1 parent
5b654fb
commit 2554ed2
Showing
17 changed files
with
525 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
vendor/knative.dev/eventing/test/rekt/features/broker/eventing_tls_feature.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
Copyright 2023 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 | ||
http://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. | ||
*/ | ||
|
||
package broker | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
cetest "github.com/cloudevents/sdk-go/v2/test" | ||
"github.com/google/uuid" | ||
"k8s.io/apimachinery/pkg/types" | ||
"knative.dev/pkg/system" | ||
"knative.dev/reconciler-test/pkg/eventshub" | ||
"knative.dev/reconciler-test/pkg/eventshub/assert" | ||
"knative.dev/reconciler-test/pkg/feature" | ||
"knative.dev/reconciler-test/pkg/resources/service" | ||
"knative.dev/reconciler-test/resources/certificate" | ||
|
||
"knative.dev/eventing/test/rekt/features/featureflags" | ||
"knative.dev/eventing/test/rekt/resources/addressable" | ||
"knative.dev/eventing/test/rekt/resources/broker" | ||
"knative.dev/eventing/test/rekt/resources/trigger" | ||
) | ||
|
||
func RotateMTChannelBrokerTLSCertificates() *feature.Feature { | ||
ingressCertificateName := "mt-broker-ingress-server-tls" | ||
ingressSecretName := "mt-broker-ingress-server-tls" | ||
|
||
filterCertificateName := "mt-broker-filter-server-tls" | ||
|
||
brokerName := feature.MakeRandomK8sName("broker") | ||
triggerName := feature.MakeRandomK8sName("trigger") | ||
sink := feature.MakeRandomK8sName("sink") | ||
source := feature.MakeRandomK8sName("source") | ||
|
||
f := feature.NewFeatureNamed("Rotate MTChannelBroker TLS certificate") | ||
|
||
f.Prerequisite("transport encryption is strict", featureflags.TransportEncryptionStrict()) | ||
f.Prerequisite("should not run when Istio is enabled", featureflags.IstioDisabled()) | ||
|
||
f.Setup("Rotate ingress certificate", certificate.Rotate(certificate.RotateCertificate{ | ||
Certificate: types.NamespacedName{ | ||
Namespace: system.Namespace(), | ||
Name: ingressCertificateName, | ||
}, | ||
})) | ||
// We cannot externally verify this certificate rotation | ||
f.Setup("Rotate filter certificate", certificate.Rotate(certificate.RotateCertificate{ | ||
Certificate: types.NamespacedName{ | ||
Namespace: system.Namespace(), | ||
Name: filterCertificateName, | ||
}, | ||
})) | ||
|
||
f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiverTLS)) | ||
f.Setup("install broker", broker.Install(brokerName, broker.WithEnvConfig()...)) | ||
f.Setup("Broker is ready", broker.IsReady(brokerName)) | ||
f.Setup("install trigger", func(ctx context.Context, t feature.T) { | ||
d := service.AsDestinationRef(sink) | ||
d.CACerts = eventshub.GetCaCerts(ctx) | ||
trigger.Install(triggerName, brokerName, trigger.WithSubscriberFromDestination(d))(ctx, t) | ||
}) | ||
f.Setup("trigger is ready", trigger.IsReady(triggerName)) | ||
f.Setup("Broker has HTTPS address", broker.ValidateAddress(brokerName, addressable.AssertHTTPSAddress)) | ||
|
||
event := cetest.FullEvent() | ||
event.SetID(uuid.New().String()) | ||
|
||
f.Requirement("install source", eventshub.Install(source, | ||
eventshub.StartSenderToResourceTLS(broker.GVR(), brokerName, nil), | ||
eventshub.InputEvent(event), | ||
// Send multiple events so that we take into account that the certificate rotation might | ||
// be detected by the server after some time. | ||
eventshub.SendMultipleEvents(100, 3*time.Second), | ||
)) | ||
|
||
f.Assert("Event sent", assert.OnStore(source). | ||
MatchSentEvent(cetest.HasId(event.ID())). | ||
AtLeast(1), | ||
) | ||
f.Assert("Event received", assert.OnStore(sink). | ||
MatchReceivedEvent(cetest.HasId(event.ID())). | ||
AtLeast(1), | ||
) | ||
f.Assert("Source match updated peer certificate", assert.OnStore(source). | ||
MatchPeerCertificatesReceived(assert.MatchPeerCertificatesFromSecret(system.Namespace(), ingressSecretName, "tls.crt")). | ||
AtLeast(1), | ||
) | ||
|
||
return f | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.