Skip to content

Commit 34fbd76

Browse files
committed
fix: SGShardedCluster's SGCluster is not able to bootstrap due to missing citus extension
1 parent e357ab1 commit 34fbd76

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

stackgres-k8s/src/operator/src/main/java/io/stackgres/operator/conciliation/shardedcluster/context/ShardedClusterCoordinatorClusterContextAppender.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
import io.stackgres.common.crd.sgcluster.StackGresCluster;
99
import io.stackgres.common.crd.sgshardedcluster.StackGresShardedCluster;
1010
import io.stackgres.common.crd.sgshardedcluster.StackGresShardingType;
11-
import io.stackgres.operator.conciliation.ContextAppender;
1211
import io.stackgres.operator.conciliation.factory.shardedcluster.StackGresShardedClusterForCitusUtil;
1312
import io.stackgres.operator.conciliation.factory.shardedcluster.StackGresShardedClusterForDdpUtil;
1413
import io.stackgres.operator.conciliation.factory.shardedcluster.StackGresShardedClusterForShardingSphereUtil;
1514
import io.stackgres.operator.conciliation.shardedcluster.StackGresShardedClusterContext.Builder;
1615
import jakarta.enterprise.context.ApplicationScoped;
1716

1817
@ApplicationScoped
19-
public class ShardedClusterCoordinatorClusterContextAppender
20-
extends ContextAppender<StackGresShardedCluster, Builder> {
18+
public class ShardedClusterCoordinatorClusterContextAppender {
2119

2220
private final ShardedClusterCoordinatorPrimaryEndpointsContextAppender
2321
shardedClusterCoordinatorPrimaryEndpointsContextAppender;
@@ -29,7 +27,6 @@ public ShardedClusterCoordinatorClusterContextAppender(
2927
shardedClusterCoordinatorPrimaryEndpointsContextAppender;
3028
}
3129

32-
@Override
3330
public void appendContext(StackGresShardedCluster cluster, Builder contextBuilder) {
3431
StackGresCluster coordinator = getCoordinatorCluster(cluster);
3532
contextBuilder.coordinator(coordinator);

stackgres-k8s/src/operator/src/main/java/io/stackgres/operator/conciliation/shardedcluster/context/ShardedClusterPostgresVersionContextAppender.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,26 @@ public class ShardedClusterPostgresVersionContextAppender
4444
private final ShardedClusterShardsPostgresConfigContextAppender clusterShardsPostgresConfigContextAppender;
4545
private final ShardedClusterRestoreBackupContextAppender clusterRestoreBackupContextAppender;
4646
private final ShardedClusterExtensionsContextAppender clusterExtensionsContextAppender;
47+
private final ShardedClusterCoordinatorClusterContextAppender clusterCoordinatorContextAppender;
48+
private final ShardedClusterShardsClustersContextAppender clusterShardsContextAppender;
4749

4850
@Inject
4951
public ShardedClusterPostgresVersionContextAppender(
5052
EventEmitter<StackGresShardedCluster> eventController,
5153
ShardedClusterCoordinatorPostgresConfigContextAppender clusterCoordinatorPostgresConfigContextAppender,
5254
ShardedClusterShardsPostgresConfigContextAppender clusterShardsPostgresConfigContextAppender,
5355
ShardedClusterRestoreBackupContextAppender clusterRestoreBackupContextAppender,
54-
ShardedClusterExtensionsContextAppender clusterExtensionsContextAppender) {
56+
ShardedClusterExtensionsContextAppender clusterExtensionsContextAppender,
57+
ShardedClusterCoordinatorClusterContextAppender clusterCoordinatorContextAppender,
58+
ShardedClusterShardsClustersContextAppender clusterShardsContextAppender) {
5559
this(
5660
eventController,
5761
clusterCoordinatorPostgresConfigContextAppender,
5862
clusterShardsPostgresConfigContextAppender,
5963
clusterRestoreBackupContextAppender,
6064
clusterExtensionsContextAppender,
65+
clusterCoordinatorContextAppender,
66+
clusterShardsContextAppender,
6167
ValidationUtil.SUPPORTED_POSTGRES_VERSIONS);
6268
}
6369

@@ -67,12 +73,16 @@ public ShardedClusterPostgresVersionContextAppender(
6773
ShardedClusterShardsPostgresConfigContextAppender clusterShardsPostgresConfigContextAppender,
6874
ShardedClusterRestoreBackupContextAppender clusterRestoreBackupContextAppender,
6975
ShardedClusterExtensionsContextAppender clusterExtensionsContextAppender,
76+
ShardedClusterCoordinatorClusterContextAppender clusterCoordinatorContextAppender,
77+
ShardedClusterShardsClustersContextAppender clusterShardsContextAppender,
7078
Map<StackGresComponent, Map<StackGresVersion, List<String>>> supportedPostgresVersions) {
7179
this.eventController = eventController;
7280
this.clusterCoordinatorPostgresConfigContextAppender = clusterCoordinatorPostgresConfigContextAppender;
7381
this.clusterShardsPostgresConfigContextAppender = clusterShardsPostgresConfigContextAppender;
7482
this.clusterRestoreBackupContextAppender = clusterRestoreBackupContextAppender;
7583
this.clusterExtensionsContextAppender = clusterExtensionsContextAppender;
84+
this.clusterCoordinatorContextAppender = clusterCoordinatorContextAppender;
85+
this.clusterShardsContextAppender = clusterShardsContextAppender;
7686
this.supportedPostgresVersions = supportedPostgresVersions;
7787
}
7888

@@ -160,6 +170,8 @@ public void appendContext(StackGresShardedCluster cluster, Builder contextBuilde
160170
clusterRestoreBackupContextAppender.appendContext(cluster, contextBuilder, version);
161171
clusterExtensionsContextAppender.appendContext(cluster, contextBuilder, version,
162172
buildVersion, previousVersion, previousBuildVersion);
173+
clusterCoordinatorContextAppender.appendContext(cluster, contextBuilder);
174+
clusterShardsContextAppender.appendContext(cluster, contextBuilder);
163175
}
164176

165177
if ((version == null && previousVersion.isEmpty())

stackgres-k8s/src/operator/src/main/java/io/stackgres/operator/conciliation/shardedcluster/context/ShardedClusterShardsClustersContextAppender.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111
import io.stackgres.common.crd.sgcluster.StackGresCluster;
1212
import io.stackgres.common.crd.sgshardedcluster.StackGresShardedCluster;
1313
import io.stackgres.common.crd.sgshardedcluster.StackGresShardingType;
14-
import io.stackgres.operator.conciliation.ContextAppender;
1514
import io.stackgres.operator.conciliation.factory.shardedcluster.StackGresShardedClusterForCitusUtil;
1615
import io.stackgres.operator.conciliation.factory.shardedcluster.StackGresShardedClusterForDdpUtil;
1716
import io.stackgres.operator.conciliation.factory.shardedcluster.StackGresShardedClusterForShardingSphereUtil;
1817
import io.stackgres.operator.conciliation.shardedcluster.StackGresShardedClusterContext.Builder;
1918
import jakarta.enterprise.context.ApplicationScoped;
2019

2120
@ApplicationScoped
22-
public class ShardedClusterShardsClustersContextAppender
23-
extends ContextAppender<StackGresShardedCluster, Builder> {
21+
public class ShardedClusterShardsClustersContextAppender {
2422

2523
private final ShardedClusterShardsPrimaryEndpointsContextAppender
2624
shardedClusterShardsPrimaryEndpointsContextAppender;
@@ -32,7 +30,6 @@ public ShardedClusterShardsClustersContextAppender(
3230
shardedClusterShardsPrimaryEndpointsContextAppender;
3331
}
3432

35-
@Override
3633
public void appendContext(StackGresShardedCluster cluster, Builder contextBuilder) {
3734
List<StackGresCluster> shards = getShardsClusters(cluster);
3835
contextBuilder.shards(shards);

stackgres-k8s/src/operator/src/test/java/io/stackgres/operator/conciliation/shardedcluster/context/ShardedClusterPostgresVersionContextAppenderTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ class ShardedClusterPostgresVersionContextAppenderTest {
106106
@Mock
107107
private ShardedClusterExtensionsContextAppender clusterExtensionsContextAppender;
108108

109+
@Mock
110+
private ShardedClusterCoordinatorClusterContextAppender clusterCoordinatorContextAppender;
111+
112+
@Mock
113+
private ShardedClusterShardsClustersContextAppender clusterShardsContextAppender;
114+
109115
@BeforeEach
110116
void setUp() {
111117
cluster = Fixtures.shardedCluster().loadDefault().get();
@@ -116,6 +122,8 @@ void setUp() {
116122
clusterShardsPostgresConfigContextAppender,
117123
clusterRestoreBackupContextAppender,
118124
clusterExtensionsContextAppender,
125+
clusterCoordinatorContextAppender,
126+
clusterShardsContextAppender,
119127
ALL_SUPPORTED_POSTGRES_VERSIONS);
120128
}
121129

0 commit comments

Comments
 (0)