provide event stream API

completed codegen manually
provide update and compare code for fes
add db check for specified databases and tables
add unit test
This commit is contained in:
Felix Kunde
2021-07-27 19:48:34 +02:00
parent 2057ad8191
commit 1bd12961fd
33 changed files with 1779 additions and 14 deletions
+17
View File
@@ -0,0 +1,17 @@
package constants
// PostgreSQL specific constants
const (
FESsuffix = "-event-streams"
EventStreamSourcePGType = "PostgresLogicalReplication"
EventStreamSourceSlotName = "fes"
EventStreamSourceAuthType = "DatabaseAuthenticationSecret"
EventStreamFlowPgNakadiType = "PostgresWalToNakadiDataEvent"
EventStreamFlowPgApiType = "PostgresWalToApiCallHomeEvent"
EventStreamFlowDataTypeColumn = "data_type"
EventStreamFlowDataOpColumn = "data_op"
EventStreamFlowMetadataColumn = "metadata"
EventStreamFlowDataColumn = "data"
EventStreamSinkNakadiType = "Nakadi"
EventStreamSinkSqsType = "Sqs"
)
+12 -4
View File
@@ -12,8 +12,9 @@ import (
clientbatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1"
apiacidv1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
acidv1client "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned"
zalandoclient "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned"
acidv1 "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/acid.zalan.do/v1"
zalandov1alpha1 "github.com/zalando/postgres-operator/pkg/generated/clientset/versioned/typed/zalando.org/v1alpha1"
"github.com/zalando/postgres-operator/pkg/spec"
apiappsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
@@ -58,9 +59,11 @@ type KubernetesClient struct {
acidv1.OperatorConfigurationsGetter
acidv1.PostgresTeamsGetter
acidv1.PostgresqlsGetter
zalandov1alpha1.FabricEventStreamsGetter
RESTClient rest.Interface
AcidV1ClientSet *acidv1client.Clientset
RESTClient rest.Interface
AcidV1ClientSet *zalandoclient.Clientset
ZalandoV1Alpha1ClientSet *zalandoclient.Clientset
}
type mockSecret struct {
@@ -158,14 +161,19 @@ func NewFromConfig(cfg *rest.Config) (KubernetesClient, error) {
kubeClient.CustomResourceDefinitionsGetter = apiextClient.ApiextensionsV1()
kubeClient.AcidV1ClientSet = acidv1client.NewForConfigOrDie(cfg)
kubeClient.AcidV1ClientSet = zalandoclient.NewForConfigOrDie(cfg)
if err != nil {
return kubeClient, fmt.Errorf("could not create acid.zalan.do clientset: %v", err)
}
kubeClient.ZalandoV1Alpha1ClientSet = zalandoclient.NewForConfigOrDie(cfg)
if err != nil {
return kubeClient, fmt.Errorf("could not create zalando.org clientset: %v", err)
}
kubeClient.OperatorConfigurationsGetter = kubeClient.AcidV1ClientSet.AcidV1()
kubeClient.PostgresTeamsGetter = kubeClient.AcidV1ClientSet.AcidV1()
kubeClient.PostgresqlsGetter = kubeClient.AcidV1ClientSet.AcidV1()
kubeClient.FabricEventStreamsGetter = kubeClient.ZalandoV1Alpha1ClientSet.ZalandoV1alpha1()
return kubeClient, nil
}