Skip to content

Commit

Permalink
Merge branch 'main' into eventType-test-logical-error
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo6Leo committed Aug 17, 2023
2 parents c385d9a + 0e88db1 commit ddaeae0
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 25 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
fail-fast: false # Keep running if one leg fails.
matrix:
k8s-version:
- v1.25.3
- v1.25.11
- v1.27.3

test-suite:
- ./test/rekt/...
Expand All @@ -29,9 +30,12 @@ jobs:
# This is attempting to make it a bit clearer what's being tested.
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.20.0
include:
- k8s-version: v1.25.3
- k8s-version: v1.25.11
kind-version: v0.20.0
kind-image-sha: sha256:cd248d1438192f7814fbca8fede13cfe5b9918746dfa12583976158a834fd5c5
kind-image-sha: sha256:227fa11ce74ea76a0474eeefb84cb75d8dad1b08638371ecf0e86259b35be0c8
- k8s-version: v1.27.3
kind-version: v0.20.0
kind-image-sha: sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72

# Add the flags we use for each of these test suites.
- test-suite: ./test/e2e
Expand Down
4 changes: 4 additions & 0 deletions config/core/configmaps/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ data:
# ALPHA feature: The eventtype-auto-create flag allows automatic creation of Even Type instances based on Event's type being processed.
# For more details: https://github.com/knative/eventing/issues/6909
eventtype-auto-create: "disabled"

# ALPHA feature: The authentication.oidc flag allows you to use OIDC authentication for Eventing.
# For more details: https://github.com/knative/eventing/issues/7174
authentication.oidc: "disabled"
4 changes: 2 additions & 2 deletions hack/create-kind-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ set -o nounset
set -o pipefail

CLUSTER_SUFFIX=${CLUSTER_SUFFIX:-"cluster.local"}
NODE_VERSION=${NODE_VERSION:-"v1.20.0"}
NODE_SHA=${NODE_SHA:-"sha256:b40ecf8bcb188f6a0d0f5d406089c48588b75edc112c6f635d26be5de1c89040"}
NODE_VERSION=${NODE_VERSION:-"v1.27.3"}
NODE_SHA=${NODE_SHA:-"sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72"}

cat <<EOF | kind create cluster --config=-
apiVersion: kind.x-k8s.io/v1alpha4
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/feature/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ func (e Flags) IsDisabledTransportEncryption() bool {
return e != nil && e[TransportEncryption] == Disabled
}

func (e Flags) IsOIDCAuthentication() bool {
return e != nil && e[OIDCAuthentication] == Enabled
}

func (e Flags) String() string {
return fmt.Sprintf("%+v", map[string]Flag(e))
}
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/feature/flag_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ const (
NewTriggerFilters = "new-trigger-filters"
TransportEncryption = "transport-encryption"
EvenTypeAutoCreate = "eventtype-auto-create"
OIDCAuthentication = "authentication.oidc"
)
52 changes: 32 additions & 20 deletions test/experimental/features/new_trigger_filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"knative.dev/reconciler-test/pkg/manifest"
"knative.dev/reconciler-test/pkg/resources/service"

eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1"
"knative.dev/eventing/test/rekt/resources/broker"
"knative.dev/eventing/test/rekt/resources/trigger"
)
Expand All @@ -43,20 +44,45 @@ func FiltersFeatureSet(brokerName string) *feature.FeatureSet {

features := make([]*feature.Feature, 0, 8)
tests := map[string]struct {
filters string
filters []eventingv1.SubscriptionsAPIFilter
step feature.StepFn
}{
"Exact filter": {
filters: fmt.Sprintf(snippetFor("exact"), matchedEvent.Type(), matchedEvent.Source()),
filters: []eventingv1.SubscriptionsAPIFilter{
{
Exact: map[string]string{
"type": matchedEvent.Type(),
"source": matchedEvent.Source(),
},
},
},
},
"Prefix filter": {
filters: fmt.Sprintf(snippetFor("prefix"), matchedEvent.Type()[:4], matchedEvent.Source()[:4]),
filters: []eventingv1.SubscriptionsAPIFilter{
{
Prefix: map[string]string{
"type": matchedEvent.Type()[:4],
"source": matchedEvent.Source()[:4],
},
},
},
},
"Suffix filter": {
filters: fmt.Sprintf(snippetFor("suffix"), matchedEvent.Type()[5:], matchedEvent.Source()[5:]),
filters: []eventingv1.SubscriptionsAPIFilter{
{
Suffix: map[string]string{
"type": matchedEvent.Type()[5:],
"source": matchedEvent.Source()[5:],
},
},
},
},
"CloudEvents SQL filter": {
filters: fmt.Sprintf(`- cesql: "type = '%s' AND source = '%s'" `, matchedEvent.Type(), matchedEvent.Source()),
filters: []eventingv1.SubscriptionsAPIFilter{
{
CESQL: fmt.Sprintf("type = '%s' AND source = '%s'", matchedEvent.Type(), matchedEvent.Source()),
},
},
},
}

Expand All @@ -73,7 +99,7 @@ func FiltersFeatureSet(brokerName string) *feature.FeatureSet {
// Set the Trigger subscriber.
cfg := []manifest.CfgFn{
trigger.WithSubscriber(service.AsKReference(subscriber), ""),
WithNewFilters(fs.filters),
trigger.WithNewFilters(fs.filters),
}

f.Setup("Install trigger", trigger.Install(triggerName, brokerName, cfg...))
Expand Down Expand Up @@ -101,17 +127,3 @@ func FiltersFeatureSet(brokerName string) *feature.FeatureSet {
Features: features,
}
}

func snippetFor(key string) string {
return fmt.Sprintf(`
- %s:
type: %%s
source: %%s`, key)
}

// WithNewFilters adds a filter config to a Trigger spec using the new filters API.
func WithNewFilters(filters string) manifest.CfgFn {
return func(cfg map[string]interface{}) {
cfg["filters"] = filters
}
}

0 comments on commit ddaeae0

Please sign in to comment.