Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[system test] - Make it possible to use POSTGRES_IMAGE env #11044

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ public class Environment {
public static final String KAFKA_TIERED_STORAGE_BASE_IMAGE_ENV = "KAFKA_TIERED_STORAGE_BASE_IMAGE";
public static final String KANIKO_IMAGE_ENV = "KANIKO_IMAGE";

public static final String POSTGRES_IMAGE_ENV = "POSTGRES_IMAGE";

/**
* Defaults
*/
Expand Down Expand Up @@ -221,6 +223,8 @@ public class Environment {
public static final String KAFKA_TIERED_STORAGE_BASE_IMAGE_DEFAULT = STRIMZI_REGISTRY_DEFAULT + "/" + STRIMZI_ORG_DEFAULT + "/kafka:latest-kafka-" + ST_KAFKA_VERSION_DEFAULT;
public static final String KANIKO_IMAGE_DEFAULT = "gcr.io/kaniko-project/executor:v1.23.2";

public static final String POSTGRES_IMAGE_DEFAULT = "postgres:latest";

/**
* Set values
*/
Expand Down Expand Up @@ -281,6 +285,8 @@ public class Environment {
public static final String KAFKA_TIERED_STORAGE_BASE_IMAGE = getOrDefault(KAFKA_TIERED_STORAGE_BASE_IMAGE_ENV, KAFKA_TIERED_STORAGE_BASE_IMAGE_DEFAULT);
public static final String KANIKO_IMAGE = getOrDefault(KANIKO_IMAGE_ENV, KANIKO_IMAGE_DEFAULT);

public static final String POSTGRES_IMAGE = getOrDefault(POSTGRES_IMAGE_ENV, POSTGRES_IMAGE_DEFAULT);

private Environment() { }

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -103,6 +104,16 @@ private static void deployKeycloak(String namespaceName) {

private static void deployPostgres(String namespaceName) {
LOGGER.info("Deploying Postgres into Namespace: {}", namespaceName);

try {
final String postgresYaml = Files.readString(Paths.get(POSTGRES_FILE_PATH)).replace(
"${POSTGRES_IMAGE}", Environment.POSTGRES_IMAGE
);
Files.writeString(Paths.get(POSTGRES_FILE_PATH), postgresYaml);
} catch (IOException e) {
throw new RuntimeException("Failed to update the Postgres deployment YAML", e);
}

cmdKubeClient(namespaceName).apply(POSTGRES_FILE_PATH);
Frawless marked this conversation as resolved.
Show resolved Hide resolved

DeploymentUtils.waitForDeploymentAndPodsReady(namespaceName, "postgres", 1);
Expand Down
2 changes: 1 addition & 1 deletion systemtest/src/test/resources/oauth2/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
spec:
containers:
- name: postgres
image: postgres:latest
image: ${POSTGRES_IMAGE}
see-quick marked this conversation as resolved.
Show resolved Hide resolved
envFrom:
- configMapRef:
name: postgres-config
Expand Down
Loading