Skip to content

Commit 35ecdfc

Browse files
committed
fix: SGShardedCluster fail adding Citus extensions for Postgres 17
1 parent f3d4739 commit 35ecdfc

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

stackgres-k8s/src/common/src/main/java/io/stackgres/common/StackGresUtil.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,22 @@ static List<ExtensionTuple> getDefaultCitusShardedClusterExtensions(StackGresSha
398398
.map(Tuple2::v2)
399399
.findAny()
400400
.get();
401+
long pg17Index = pgComponent
402+
.streamOrderedMajorVersions()
403+
.zipWithIndex()
404+
.filter(t -> t.v1.equals("17"))
405+
.map(Tuple2::v2)
406+
.findAny()
407+
.get();
401408
return List.of(
402-
pgMajorVersionIndex <= pg14Index
403-
? new ExtensionTuple("citus", "12.1-1")
404-
: new ExtensionTuple("citus", "11.3-1"),
405-
new ExtensionTuple("citus_columnar", "11.3-1"));
409+
pgMajorVersionIndex <= pg17Index
410+
? new ExtensionTuple("citus", "13.0.1")
411+
: pgMajorVersionIndex <= pg14Index
412+
? new ExtensionTuple("citus", "12.1-1")
413+
: new ExtensionTuple("citus", "11.3-1"),
414+
pgMajorVersionIndex <= pg17Index
415+
? new ExtensionTuple("citus_columnar", "13.0.1")
416+
: new ExtensionTuple("citus_columnar", "11.3-1"));
406417
}
407418

408419
static List<ExtensionTuple> getDefaultDdpShardedClusterExtensions(StackGresShardedCluster cluster) {

stackgres-k8s/src/operator/src/test/java/io/stackgres/operator/validation/shardedcluster/ExtensionsValidatorTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ void givenACreationWithMissingExtensions_shouldFail() {
114114

115115
ValidationUtils.assertValidationFailed(() -> validator.validate(review),
116116
ErrorType.EXTENSION_NOT_FOUND,
117-
"Some extensions were not found: citus 12.1-1 (available 1.0.0),"
118-
+ " citus_columnar 11.3-1 (available 1.0.0)");
117+
"Some extensions were not found: citus 13.0.1 (available 1.0.0), citus_columnar 13.0.1 (available 1.0.0)");
119118
}
120119

121120
private StackGresShardedClusterReview getCreationReview() {

stackgres-k8s/src/operator/src/test/java/io/stackgres/operator/validation/shardedcluster/ShardedClusterValidationQuarkusTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void given_withoutInstalledExtensions_shouldFail() throws Exception {
202202
assertThat(body.get("kind").asText(), is("AdmissionReview"));
203203
assertThat(body.get("response").get("status").get("code").asInt(), is(400));
204204
assertThat(body.get("response").get("status").get("message").asText(),
205-
is("Some extensions were not found: citus 12.1-1, citus_columnar 11.3-1"));
205+
is("Some extensions were not found: citus 13.0.1, citus_columnar 13.0.1"));
206206
} catch (AssertionError ae) {
207207
throw new AssertionError("Body " + body + " has unexpected values", ae);
208208
}

0 commit comments

Comments
 (0)