set applicationId of FES CRD by taking label from manifest

This commit is contained in:
Felix Kunde 2021-12-03 19:17:01 +01:00
parent 50a8bf5fee
commit 8f2f70b4fe
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*

View File

@ -108,8 +108,14 @@ func (c *Cluster) syncPostgresConfig() error {
} }
func (c *Cluster) generateFabricEventStream() *zalandov1alpha1.FabricEventStream { func (c *Cluster) generateFabricEventStream() *zalandov1alpha1.FabricEventStream {
var applicationId string
eventStreams := make([]zalandov1alpha1.EventStream, 0) eventStreams := make([]zalandov1alpha1.EventStream, 0)
// take application label from manifest
if spec, err := c.GetSpec(); err == nil {
applicationId = spec.ObjectMeta.Labels["application"]
}
for _, stream := range c.Spec.Streams { for _, stream := range c.Spec.Streams {
for tableName, table := range stream.Tables { for tableName, table := range stream.Tables {
streamSource := c.getEventStreamSource(stream, tableName, table.IdColumn) streamSource := c.getEventStreamSource(stream, tableName, table.IdColumn)
@ -136,7 +142,7 @@ func (c *Cluster) generateFabricEventStream() *zalandov1alpha1.FabricEventStream
OwnerReferences: c.ownerReferences(), OwnerReferences: c.ownerReferences(),
}, },
Spec: zalandov1alpha1.FabricEventStreamSpec{ Spec: zalandov1alpha1.FabricEventStreamSpec{
ApplicationId: "", ApplicationId: applicationId,
EventStreams: eventStreams, EventStreams: eventStreams,
}, },
} }