File tree Expand file tree Collapse file tree
stackgres-k8s/src/operator/src/main/java/io/stackgres/operator/conciliation/factory/distributedlogs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313import java .util .List ;
1414import java .util .Map ;
1515import java .util .Optional ;
16+ import java .util .Set ;
17+ import java .util .stream .Collectors ;
1618import java .util .stream .Stream ;
1719
1820import io .fabric8 .kubernetes .api .model .ConfigMapVolumeSourceBuilder ;
@@ -109,9 +111,14 @@ public static StackGresCluster getCluster(
109111 previousCluster
110112 .map (StackGresCluster ::getMetadata )
111113 .map (ObjectMeta ::getAnnotations )
112- .orElseGet (() -> Map .of (
113- StackGresContext .VERSION_KEY ,
114- StackGresVersion .getStackGresVersion (distributedLogs ).getVersion ())))
114+ .orElseGet (() -> Optional .of (distributedLogs )
115+ .map (StackGresDistributedLogs ::getMetadata )
116+ .map (ObjectMeta ::getAnnotations )
117+ .map (Map ::entrySet )
118+ .stream ()
119+ .flatMap (Set ::stream )
120+ .filter (annotation -> annotation .getKey ().equals (StackGresContext .VERSION_KEY ))
121+ .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue ))))
115122 .withLabels (labelFactory .genericLabels (distributedLogs ))
116123 .withNamespace (namespace )
117124 .withName (name )
Original file line number Diff line number Diff line change 1313import java .util .List ;
1414import java .util .Map ;
1515import java .util .Optional ;
16+ import java .util .Set ;
17+ import java .util .stream .Collectors ;
1618import java .util .stream .Stream ;
1719
1820import io .fabric8 .kubernetes .api .model .ConfigMapVolumeSourceBuilder ;
@@ -108,9 +110,14 @@ public static StackGresCluster getCluster(
108110 previousCluster
109111 .map (StackGresCluster ::getMetadata )
110112 .map (ObjectMeta ::getAnnotations )
111- .orElseGet (() -> Map .of (
112- StackGresContext .VERSION_KEY ,
113- StackGresVersion .getStackGresVersion (distributedLogs ).getVersion ())))
113+ .orElseGet (() -> Optional .of (distributedLogs )
114+ .map (StackGresDistributedLogs ::getMetadata )
115+ .map (ObjectMeta ::getAnnotations )
116+ .map (Map ::entrySet )
117+ .stream ()
118+ .flatMap (Set ::stream )
119+ .filter (annotation -> annotation .getKey ().equals (StackGresContext .VERSION_KEY ))
120+ .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue ))))
114121 .withLabels (labelFactory .genericLabels (distributedLogs ))
115122 .withNamespace (namespace )
116123 .withName (name )
You can’t perform that action at this time.
0 commit comments