Skip to content

Commit

Permalink
🔥 Apply carried patches.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanfx authored and aliok committed Jun 21, 2021
1 parent 40c10e0 commit dea3cfb
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 190 deletions.
73 changes: 0 additions & 73 deletions config/channels/in-memory-channel/configmaps/observability.yaml

This file was deleted.

59 changes: 0 additions & 59 deletions config/channels/in-memory-channel/configmaps/tracing.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion config/core/deployments/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ spec:
# will NOT be considered by the sinkbinding webhook.
# The default is `exclusion`.
- name: SINK_BINDING_SELECTION_MODE
value: "exclusion"
value: "inclusion"
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
41 changes: 1 addition & 40 deletions openshift/release/knative-eventing-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3437,7 +3437,7 @@ spec:
- name: WEBHOOK_PORT
value: "8443"
- name: SINK_BINDING_SELECTION_MODE
value: "exclusion"
value: "inclusion"
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down Expand Up @@ -3735,45 +3735,6 @@ data:
MaxIdleConnections: "1000"
MaxIdleConnectionsPerHost: "100"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: config-observability
namespace: knative-eventing
labels:
eventing.knative.dev/release: devel
knative.dev/config-propagation: original
knative.dev/config-category: eventing
annotations:
knative.dev/example-checksum: "f46cf09d"
data:
_example: |
metrics.backend-destination: prometheus
metrics.request-metrics-backend-destination: prometheus
metrics.stackdriver-project-id: "<your stackdriver project id>"
metrics.allow-stackdriver-custom-metrics: "false"
profiling.enable: "false"
sink-event-error-reporting.enable: "false"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: config-tracing
namespace: knative-eventing
labels:
eventing.knative.dev/release: devel
knative.dev/config-propagation: original
knative.dev/config-category: eventing
annotations:
knative.dev/example-checksum: "4002b4c2"
data:
_example: |
backend: "none"
zipkin-endpoint: "http://zipkin.istio-system.svc.cluster.local:9411/api/v2/spans"
stackdriver-project-id: "my-project"
debug: "false"
sample-rate: "0.1"
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
7 changes: 7 additions & 0 deletions pkg/reconciler/source/crd/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"knative.dev/pkg/logging"
pkgreconciler "knative.dev/pkg/reconciler"

"knative.dev/eventing/pkg/apis/sources"
"knative.dev/eventing/pkg/reconciler/source/duck"
)

Expand Down Expand Up @@ -60,6 +61,12 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, crd *v1.CustomResourceDe
// 2. Dynamically create a controller for it, if not present already. Such controller is in charge of reconciling
// duckv1.Source resources with that particular GVR..

filterFunc := pkgreconciler.LabelFilterFunc(sources.SourceDuckLabelKey, sources.SourceDuckLabelValue, false)
if ok := filterFunc(crd); !ok {
logging.FromContext(ctx).Errorw("Passed crd does not have source duck label", zap.String("CRD", crd.Name))
return nil //Avoid requeuing object
}

gvr, gvk, err := r.resolveGroupVersions(crd)
if err != nil {
logging.FromContext(ctx).Errorw("Error while resolving GVR and GVK", zap.String("CRD", crd.Name), zap.Error(err))
Expand Down
21 changes: 18 additions & 3 deletions pkg/reconciler/source/crd/crd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,23 @@ func TestAllCases(t *testing.T) {
Key: crdName,
Ctx: ctx,
},
{
Name: "crd missing duck label",
Objects: []runtime.Object{
NewCustomResourceDefinition(crdName,
WithCustomResourceDefinitionGroup(crdGroup),
WithCustomResourceDefinitionNames(apiextensionsv1.CustomResourceDefinitionNames{
Kind: crdKind,
Plural: crdPlural,
}),
WithCustomResourceDefinitionVersions([]apiextensionsv1.CustomResourceDefinitionVersion{{
Name: crdVersionServed,
Served: true,
}})),
},
Key: crdName,
Ctx: ctx,
},
}

logger := logtesting.TestLogger(t)
Expand All @@ -181,9 +198,7 @@ func TestControllerRunning(t *testing.T) {
Name: "reconcile succeeded",
Objects: []runtime.Object{
NewCustomResourceDefinition(crdName,
WithCustomResourceDefinitionLabels(map[string]string{
sources.SourceDuckLabelKey: sources.SourceDuckLabelValue,
}),
WithCustomResourceDefinitionLabels(map[string]string{sources.SourceDuckLabelKey: sources.SourceDuckLabelValue}),
WithCustomResourceDefinitionGroup(crdGroup),
WithCustomResourceDefinitionNames(apiextensionsv1.CustomResourceDefinitionNames{
Kind: crdKind,
Expand Down
1 change: 1 addition & 0 deletions test/e2e/source_sinkbinding_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func TestSinkBindingV1Deployment(t *testing.T) {
}

func TestSinkBindingV1CronJob(t *testing.T) {
t.Skip("SRVKE-500: Skipping since we set bindings to inclusion")
const (
sinkBindingName = "e2e-sink-binding"
deploymentName = "e2e-sink-binding-cronjob"
Expand Down
1 change: 1 addition & 0 deletions test/rekt/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestBrokerAsMiddleware(t *testing.T) {

// TestBrokerDLQ
func TestBrokerWithDLQ(t *testing.T) {
t.Skip("skipping for test reasons...")
class := eventing.MTChannelBrokerClassValue

ctx, env := global.Environment(
Expand Down
1 change: 1 addition & 0 deletions test/rekt/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ EventSource ---> Channel ---> Subscription ---> Channel ---> Subscription ---->
-----------> Service(Transformation)
*/
func TestEventTransformationForSubscriptionV1(t *testing.T) {
t.Skip("skipping for now...")
t.Parallel()

ctx, env := global.Environment(
Expand Down
2 changes: 1 addition & 1 deletion test/rekt/features/apiserversource/data_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
)

const (
exampleImage = "ko://knative.dev/eventing/test/test_images/print"
exampleImage = "registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-print"
)

func DataPlane_SinkTypes() *feature.FeatureSet {
Expand Down
2 changes: 1 addition & 1 deletion test/rekt/resources/containersource/containersource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
spec:
containers:
- name: heartbeats
image: ko://knative.dev/eventing/test/test_images/heartbeats
image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-heartbeats
args:
- --period=1
env:
Expand Down
4 changes: 2 additions & 2 deletions test/rekt/resources/containersource/containersource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Example_min() {
// spec:
// containers:
// - name: heartbeats
// image: ko://knative.dev/eventing/test/test_images/heartbeats
// image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-heartbeats
// args:
// - --period=1
// env:
Expand Down Expand Up @@ -106,7 +106,7 @@ func Example_full() {
// spec:
// containers:
// - name: heartbeats
// image: ko://knative.dev/eventing/test/test_images/heartbeats
// image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-heartbeats
// args:
// - --period=1
// env:
Expand Down
2 changes: 1 addition & 1 deletion test/rekt/resources/eventlibrary/eventlibrary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
restartPolicy: "Never"
containers:
- name: library
image: ko://knative.dev/eventing/test/test_images/event-library
image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-event-library
imagePullPolicy: "IfNotPresent"

---
Expand Down
2 changes: 1 addition & 1 deletion test/rekt/resources/eventlibrary/eventlibrary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func Example() {
images := map[string]string{
"ko://knative.dev/eventing/test/test_images/event-library": "gcr.io/knative-samples/helloworld-go",
"registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-event-library": "gcr.io/knative-samples/helloworld-go",
}
cfg := map[string]interface{}{
"name": "foo",
Expand Down
2 changes: 1 addition & 1 deletion test/rekt/resources/flaker/flaker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
restartPolicy: "Never"
containers:
- name: flaker
image: ko://knative.dev/eventing/test/test_images/event-flaker
image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-event-flaker
imagePullPolicy: "IfNotPresent"
env:
- name: "K_SINK"
Expand Down
2 changes: 1 addition & 1 deletion test/rekt/resources/flaker/flaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func Example() {
images := map[string]string{
"ko://knative.dev/eventing/test/test_images/event-flaker": "gcr.io/knative-samples/helloworld-go",
"registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-event-flaker": "gcr.io/knative-samples/helloworld-go",
}
cfg := map[string]interface{}{
"name": "foo",
Expand Down
4 changes: 2 additions & 2 deletions vendor/knative.dev/pkg/controller/stats_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (r *reporter) ReportReconcile(duration time.Duration, success string, key t
return err
}

metrics.RecordBatch(ctx, reconcileCountStat.M(1),
reconcileLatencyStat.M(duration.Milliseconds()))
// TODO skonto: fix latency histogram
metrics.RecordBatch(ctx, reconcileCountStat.M(1))
return nil
}
5 changes: 2 additions & 3 deletions vendor/knative.dev/pkg/webhook/stats_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ func (r *reporter) ReportRequest(req *admissionv1.AdmissionRequest, resp *admiss
return err
}

metrics.RecordBatch(ctx, requestCountM.M(1),
// Convert time.Duration in nanoseconds to milliseconds
responseTimeInMsecM.M(float64(d.Milliseconds())))
// TODO skonto: fix latency histogram
metrics.Record(ctx, requestCountM.M(1))
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
restartPolicy: "Never"
containers:
- name: eventshub
image: ko://knative.dev/reconciler-test/cmd/eventshub
image: registry.ci.openshift.org/openshift/knative-nightly:knative-eventing-test-eventshub
imagePullPolicy: "IfNotPresent"
env:
- name: "SYSTEM_NAMESPACE"
Expand Down

0 comments on commit dea3cfb

Please sign in to comment.