From 6120ef7da414dc1a4590f2aa0b3bfc0dcfa49e44 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Fri, 20 Aug 2021 12:51:40 +0200 Subject: [PATCH] name FES like the Postgres cluster --- docs/reference/cluster_manifest.md | 4 ++-- pkg/cluster/streams.go | 4 ++-- pkg/cluster/streams_test.go | 3 +-- pkg/util/constants/streams.go | 1 - 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/reference/cluster_manifest.md b/docs/reference/cluster_manifest.md index 66867872c..4b380dbf3 100644 --- a/docs/reference/cluster_manifest.md +++ b/docs/reference/cluster_manifest.md @@ -479,8 +479,8 @@ Those parameters are grouped under the `tls` top-level key. This sections enables change data capture (CDC) streams e.g. into Zalando’s distributed event broker [Nakadi](https://nakadi.io/). Parameters grouped under the `streams` top-level key will be used by the operator to create a -CRD for Zalando's internal CDC operator. Each stream can have the following -properties: +CRD for Zalando's internal CDC operator named like the Postgres cluster. +Each stream object can have the following properties: * **streamType** Defines the sink. Either `nakadi`, `sqs` or `wal` (which is just plain wal diff --git a/pkg/cluster/streams.go b/pkg/cluster/streams.go index bbfe17eca..d9cc19e1f 100644 --- a/pkg/cluster/streams.go +++ b/pkg/cluster/streams.go @@ -131,7 +131,7 @@ func (c *Cluster) generateFabricEventStream() *zalandov1alpha1.FabricEventStream return &zalandov1alpha1.FabricEventStream{ ObjectMeta: metav1.ObjectMeta{ - Name: c.Name + constants.FESsuffix, + Name: c.Name, Namespace: c.Namespace, Annotations: c.AnnotationsToPropagate(c.annotationsSet(nil)), }, @@ -239,7 +239,7 @@ func (c *Cluster) syncStreams() error { return fmt.Errorf("could not update Postgres config for event streaming: %v", err) } - effectiveStreams, err := c.KubeClient.FabricEventStreamsGetter.FabricEventStreams(c.Namespace).Get(context.TODO(), c.Name+constants.FESsuffix, metav1.GetOptions{}) + effectiveStreams, err := c.KubeClient.FabricEventStreamsGetter.FabricEventStreams(c.Namespace).Get(context.TODO(), c.Name, metav1.GetOptions{}) if err != nil { if !k8sutil.ResourceNotFound(err) { return fmt.Errorf("error during reading of event streams: %v", err) diff --git a/pkg/cluster/streams_test.go b/pkg/cluster/streams_test.go index 8119168b0..5ba6a5147 100644 --- a/pkg/cluster/streams_test.go +++ b/pkg/cluster/streams_test.go @@ -10,7 +10,6 @@ import ( acidv1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1" fakezalandov1alpha1 "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/fake" "github.com/zalando/postgres-operator/pkg/util/config" - "github.com/zalando/postgres-operator/pkg/util/constants" "github.com/zalando/postgres-operator/pkg/util/k8sutil" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -93,7 +92,7 @@ func TestGenerateFabricEventStream(t *testing.T) { err := cluster.syncStreams() assert.NoError(t, err) - streamCRD, err := cluster.KubeClient.FabricEventStreams(namespace).Get(context.TODO(), cluster.Name+constants.FESsuffix, metav1.GetOptions{}) + streamCRD, err := cluster.KubeClient.FabricEventStreams(namespace).Get(context.TODO(), cluster.Name, metav1.GetOptions{}) assert.NoError(t, err) result := cluster.generateFabricEventStream() diff --git a/pkg/util/constants/streams.go b/pkg/util/constants/streams.go index 7a2c9f81f..a7ea2b0b8 100644 --- a/pkg/util/constants/streams.go +++ b/pkg/util/constants/streams.go @@ -2,7 +2,6 @@ package constants // PostgreSQL specific constants const ( - FESsuffix = "-event-streams" EventStreamSourcePGType = "PostgresLogicalReplication" EventStreamSourceSlotPrefix = "fes_" EventStreamSourceAuthType = "DatabaseAuthenticationSecret"