From 1c40b06c3cdfad91ca311fad5bcb6cdd65258d93 Mon Sep 17 00:00:00 2001 From: Thandayuthapani Subramanian Date: Wed, 9 Feb 2022 14:03:42 +0100 Subject: [PATCH 1/4] Unify the usages of EVENT_TYPE_PREFIX and LEGACY_EVENT_TYPE_PREFIX --- .../cmd/event-publisher-proxy/nats/nats.go | 2 +- .../config/event-publisher-nats/200-deployment.yaml | 2 +- .../event-publisher-proxy/pkg/env/nats_config.go | 8 ++++---- .../pkg/handler/nats/mock/mock.go | 10 +++++----- components/eventing-controller/README.md | 4 ++-- .../pkg/deployment/publisher_deployment.go | 11 ----------- resources/eventing/values.yaml | 4 ++-- 7 files changed, 15 insertions(+), 26 deletions(-) diff --git a/components/event-publisher-proxy/cmd/event-publisher-proxy/nats/nats.go b/components/event-publisher-proxy/cmd/event-publisher-proxy/nats/nats.go index 8c5422a067c2..42651d3cadcb 100644 --- a/components/event-publisher-proxy/cmd/event-publisher-proxy/nats/nats.go +++ b/components/event-publisher-proxy/cmd/event-publisher-proxy/nats/nats.go @@ -115,7 +115,7 @@ func (c *Commander) Start() error { c.logger.Info("Informers are synced successfully") // configure event type cleaner - eventTypeCleaner := eventtype.NewCleaner(c.envCfg.LegacyEventTypePrefix, applicationLister, c.logger) + eventTypeCleaner := eventtype.NewCleaner(c.envCfg.EventTypePrefix, applicationLister, c.logger) // start handler which blocks until it receives a shutdown signal if err := nats.NewHandler(messageReceiver, &messageSenderToNats, c.envCfg.RequestTimeout, legacyTransformer, c.opts, diff --git a/components/event-publisher-proxy/config/event-publisher-nats/200-deployment.yaml b/components/event-publisher-proxy/config/event-publisher-nats/200-deployment.yaml index 29b5c927e874..1079766d8af6 100644 --- a/components/event-publisher-proxy/config/event-publisher-nats/200-deployment.yaml +++ b/components/event-publisher-proxy/config/event-publisher-nats/200-deployment.yaml @@ -35,7 +35,7 @@ spec: value: 5s - name: LEGACY_NAMESPACE value: kyma - - name: LEGACY_EVENT_TYPE_PREFIX + - name: EVENT_TYPE_PREFIX value: sap.kyma.custom image: ko://github.com/kyma-project/kyma/components/event-publisher-proxy/cmd/event-publisher-proxy imagePullPolicy: IfNotPresent diff --git a/components/event-publisher-proxy/pkg/env/nats_config.go b/components/event-publisher-proxy/pkg/env/nats_config.go index 8df0f3e9e664..a8ccfa3e4224 100644 --- a/components/event-publisher-proxy/pkg/env/nats_config.go +++ b/components/event-publisher-proxy/pkg/env/nats_config.go @@ -19,9 +19,9 @@ type NatsConfig struct { // Legacy Namespace is used as the event source for legacy events LegacyNamespace string `envconfig:"LEGACY_NAMESPACE" default:"kyma"` - // LegacyEventTypePrefix is the prefix of each event as per the eventing specification, used for legacy events - // It follows the eventType format: ... - LegacyEventTypePrefix string `envconfig:"LEGACY_EVENT_TYPE_PREFIX" default:"kyma"` + // EventTypePrefix is the prefix of each event as per the eventing specification + // It follows the eventType format: ... + EventTypePrefix string `envconfig:"EVENT_TYPE_PREFIX" default:"kyma"` // JetStream-specific configs JSStreamName string `envconfig:"JS_STREAM_NAME" default:"kyma"` @@ -32,7 +32,7 @@ type NatsConfig struct { func (c *NatsConfig) ToConfig() *BebConfig { cfg := &BebConfig{ BEBNamespace: c.LegacyNamespace, - EventTypePrefix: c.LegacyEventTypePrefix, + EventTypePrefix: c.EventTypePrefix, } return cfg } diff --git a/components/event-publisher-proxy/pkg/handler/nats/mock/mock.go b/components/event-publisher-proxy/pkg/handler/nats/mock/mock.go index 84ff53766f60..bf77242df0d7 100644 --- a/components/event-publisher-proxy/pkg/handler/nats/mock/mock.go +++ b/components/event-publisher-proxy/pkg/handler/nats/mock/mock.go @@ -155,7 +155,7 @@ func WithEventTypePrefix(eventTypePrefix string) NatsHandlerMockOpt { // WithSubscription returns NatsHandlerMockOpt which sets the subscribed.Processor for the given NatsHandlerMock. func WithSubscription(scheme *runtime.Scheme, subscription *eventingv1alpha1.Subscription) NatsHandlerMockOpt { return func(m *NatsHandlerMock) { - m.natsConfig.LegacyEventTypePrefix = m.eventTypePrefix + m.natsConfig.EventTypePrefix = m.eventTypePrefix dynamicTestClient := dynamicfake.NewSimpleDynamicClient(scheme, subscription) dFilteredSharedInfFactory := dynamicinformer.NewFilteredDynamicSharedInformerFactory(dynamicTestClient, 10*time.Second, v1.NamespaceAll, nil) genericInf := dFilteredSharedInfFactory.ForResource(subscribed.GVR) @@ -191,9 +191,9 @@ func WithJetstream(jsEnabled bool) NatsHandlerMockOpt { func newNatsConfig(port int) *env.NatsConfig { return &env.NatsConfig{ - Port: port, - LegacyNamespace: testingutils.MessagingNamespace, - LegacyEventTypePrefix: testingutils.MessagingEventTypePrefix, - JSStreamName: testingutils.StreamName, + Port: port, + LegacyNamespace: testingutils.MessagingNamespace, + EventTypePrefix: testingutils.MessagingEventTypePrefix, + JSStreamName: testingutils.StreamName, } } diff --git a/components/eventing-controller/README.md b/components/eventing-controller/README.md index d78262f0fec2..a6253c08b2fe 100644 --- a/components/eventing-controller/README.md +++ b/components/eventing-controller/README.md @@ -56,7 +56,7 @@ This section explains how to use the Eventing Controller. It expects the followi | `PUBLISHER_LIMITS_MEMORY` | The memory limits of the Event Publisher Proxy. | | **For NATS** | | | `NATS_URL` | The URL for the NATS server. | -| `EVENT_TYPE_PREFIX` | The Event Type Prefix for the NATS backend. | +| `EVENT_TYPE_PREFIX` | The event type prefix for the NATS backend. | | `MAX_IDLE_CONNS` | The maximum number of idle connections for the HTTP transport of the NATS backend. | | `MAX_CONNS_PER_HOST` | The maximum connections per host for the HTTP transport of the NATS backend. | | `MAX_IDLE_CONNS_PER_HOST` | The maximum idle connections per host for the HTTP transport of the NATS backend. | @@ -183,7 +183,7 @@ kubectl port-forward -n kyma-system svc/eventing-nats 4222 |--------------------------|----------------------------------------------------|----------|-----------------------------| | `KUBECONFIG` | Path to a local kubeconfig file. | yes | ~/.kube/config | | `NATS_URL` | URL of the NATS server. | no | nats.nats.svc.cluster.local | -| `EVENT_TYPE_PREFIX` | Path to a local kubeconfig file. | yes | sap.kyma.custom | +| `EVENT_TYPE_PREFIX` | The Event Type Prefix for the NATS backend. | yes | sap.kyma.custom | | `WEBHOOK_TOKEN_ENDPOINT` | The Kyma public endpoint to provide Access Tokens. | yes | WEBHOOK_TOKEN_ENDPOINT | | `DOMAIN` | Domain. | yes | example.com | diff --git a/components/eventing-controller/pkg/deployment/publisher_deployment.go b/components/eventing-controller/pkg/deployment/publisher_deployment.go index 1f39f3134a3b..5e5df2edf82d 100644 --- a/components/eventing-controller/pkg/deployment/publisher_deployment.go +++ b/components/eventing-controller/pkg/deployment/publisher_deployment.go @@ -308,17 +308,6 @@ func getNATSEnvVars(natsConfig env.NatsConfig, publisherConfig env.PublisherConf {Name: "NATS_URL", Value: natsURL}, {Name: "REQUEST_TIMEOUT", Value: publisherConfig.RequestTimeout}, {Name: "LEGACY_NAMESPACE", Value: "kyma"}, - { - Name: "LEGACY_EVENT_TYPE_PREFIX", - ValueFrom: &v1.EnvVarSource{ - ConfigMapKeyRef: &v1.ConfigMapKeySelector{ - LocalObjectReference: v1.LocalObjectReference{ - Name: configMapName, - }, - Key: configMapKeyEventTypePrefix, - }, - }, - }, { Name: "EVENT_TYPE_PREFIX", ValueFrom: &v1.EnvVarSource{ diff --git a/resources/eventing/values.yaml b/resources/eventing/values.yaml index 0b0ab75cd4a2..f26ce073bea7 100644 --- a/resources/eventing/values.yaml +++ b/resources/eventing/values.yaml @@ -5,11 +5,11 @@ global: images: eventing_controller: name: eventing-controller - version: PR-14209 + version: PR-13329 pullPolicy: "IfNotPresent" publisher_proxy: name: event-publisher-proxy - version: PR-14268 + version: PR-13329 nats: name: nats version: 2.8.2-alpine From 34477bc967225bea2817eaf6e88e9817715166eb Mon Sep 17 00:00:00 2001 From: Thandayuthapani Subramanian Date: Wed, 27 Apr 2022 12:12:22 +0200 Subject: [PATCH 2/4] Address review comments --- components/eventing-controller/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/eventing-controller/README.md b/components/eventing-controller/README.md index a6253c08b2fe..42ab43bbd98a 100644 --- a/components/eventing-controller/README.md +++ b/components/eventing-controller/README.md @@ -183,7 +183,7 @@ kubectl port-forward -n kyma-system svc/eventing-nats 4222 |--------------------------|----------------------------------------------------|----------|-----------------------------| | `KUBECONFIG` | Path to a local kubeconfig file. | yes | ~/.kube/config | | `NATS_URL` | URL of the NATS server. | no | nats.nats.svc.cluster.local | -| `EVENT_TYPE_PREFIX` | The Event Type Prefix for the NATS backend. | yes | sap.kyma.custom | +| `EVENT_TYPE_PREFIX` | The event type prefix for the NATS backend. | yes | sap.kyma.custom | | `WEBHOOK_TOKEN_ENDPOINT` | The Kyma public endpoint to provide Access Tokens. | yes | WEBHOOK_TOKEN_ENDPOINT | | `DOMAIN` | Domain. | yes | example.com | From a0882ea7f94658f094866fafc7b1651f4d2f9710 Mon Sep 17 00:00:00 2001 From: Thandayuthapani Subramanian Date: Thu, 12 May 2022 21:39:11 +0200 Subject: [PATCH 3/4] Address review comments --- components/eventing-controller/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/eventing-controller/README.md b/components/eventing-controller/README.md index 42ab43bbd98a..a6851c4de2fa 100644 --- a/components/eventing-controller/README.md +++ b/components/eventing-controller/README.md @@ -56,7 +56,7 @@ This section explains how to use the Eventing Controller. It expects the followi | `PUBLISHER_LIMITS_MEMORY` | The memory limits of the Event Publisher Proxy. | | **For NATS** | | | `NATS_URL` | The URL for the NATS server. | -| `EVENT_TYPE_PREFIX` | The event type prefix for the NATS backend. | +| `EVENT_TYPE_PREFIX` | The event type prefix for the NATS and BEB backend. | | `MAX_IDLE_CONNS` | The maximum number of idle connections for the HTTP transport of the NATS backend. | | `MAX_CONNS_PER_HOST` | The maximum connections per host for the HTTP transport of the NATS backend. | | `MAX_IDLE_CONNS_PER_HOST` | The maximum idle connections per host for the HTTP transport of the NATS backend. | @@ -183,7 +183,7 @@ kubectl port-forward -n kyma-system svc/eventing-nats 4222 |--------------------------|----------------------------------------------------|----------|-----------------------------| | `KUBECONFIG` | Path to a local kubeconfig file. | yes | ~/.kube/config | | `NATS_URL` | URL of the NATS server. | no | nats.nats.svc.cluster.local | -| `EVENT_TYPE_PREFIX` | The event type prefix for the NATS backend. | yes | sap.kyma.custom | +| `EVENT_TYPE_PREFIX` | The event type prefix for the NATS and BEB backend. | yes | sap.kyma.custom | | `WEBHOOK_TOKEN_ENDPOINT` | The Kyma public endpoint to provide Access Tokens. | yes | WEBHOOK_TOKEN_ENDPOINT | | `DOMAIN` | Domain. | yes | example.com | From e7eb222cbdc72789b7adfb3c97b5548e7befaab8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 May 2022 19:40:20 +0000 Subject: [PATCH 4/4] gomod(deps): bump github.com/sirupsen/logrus Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.6.0 to 1.8.1. - [Release notes](https://github.com/sirupsen/logrus/releases) - [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md) - [Commits](https://github.com/sirupsen/logrus/compare/v1.6.0...v1.8.1) --- updated-dependencies: - dependency-name: github.com/sirupsen/logrus dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- components/connector-service/go.mod | 3 +-- components/connector-service/go.sum | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/components/connector-service/go.mod b/components/connector-service/go.mod index 72d90f7946ef..572062cd1880 100644 --- a/components/connector-service/go.mod +++ b/components/connector-service/go.mod @@ -6,7 +6,7 @@ require ( github.com/gorilla/mux v1.7.3 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/prometheus/client_golang v1.12.1 - github.com/sirupsen/logrus v1.6.0 + github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.4.0 github.com/tidwall/gjson v1.9.3 k8s.io/api v0.18.15 @@ -23,7 +23,6 @@ require ( github.com/google/gofuzz v1.1.0 // indirect github.com/googleapis/gnostic v0.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect diff --git a/components/connector-service/go.sum b/components/connector-service/go.sum index 30503a320ce3..16caa20a7a40 100644 --- a/components/connector-service/go.sum +++ b/components/connector-service/go.sum @@ -159,8 +159,6 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -201,8 +199,8 @@ github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -316,7 +314,6 @@ golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -324,6 +321,7 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=