Skip to content

Commit abc5774

Browse files
authored
Operator configmap: use KAAP as prefix (#134)
1 parent 59b807c commit abc5774

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

helm/kaap/templates/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ data:
2828
{{ printf "QUARKUS_%s" ($key | replace "-" "." | replace "\"" "." | snakecase | upper | replace "." "_" ) }}: {{ $val | toString | replace "\"" "" | trim | quote }}
2929
{{- end }}
3030
{{- range $key, $val := $.Values.operator.config.operator }}
31-
{{ printf "PULSAR_OPERATOR_%s" ($key | replace "-" "." | snakecase | upper | replace "." "_" | replace "\"" "_") }}: {{ $val | toString | replace "\"" "" | trim | quote }}
31+
{{ printf "KAAP_%s" ($key | replace "-" "." | snakecase | upper | replace "." "_" | replace "\"" "_") }}: {{ $val | toString | replace "\"" "" | trim | quote }}
3232
{{- end }}
3333
{{- end }}

operator/src/main/java/com/datastax/oss/kaap/LeaderElectionConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
@Unremovable
2424
public class LeaderElectionConfig extends LeaderElectionConfiguration {
2525

26-
public static final String PULSAR_OPERATOR_LEASE_NAME = "kaap-lease";
26+
public static final String LEASE_NAME = "kaap-lease";
2727

2828
public LeaderElectionConfig() {
29-
super(PULSAR_OPERATOR_LEASE_NAME);
29+
super(LEASE_NAME);
3030
}
3131
}

tests/src/test/java/com/datastax/oss/kaap/tests/BaseK8sEnvTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
@Slf4j
8282
public abstract class BaseK8sEnvTest {
8383

84-
public static final Path PULSAR_OPERATOR_CHART_PATH = Paths.get("..", "helm", "kaap");
84+
public static final Path OPERATOR_CHART_PATH = Paths.get("..", "helm", "kaap");
8585

8686
public static final String OPERATOR_IMAGE = System.getProperty("kaap.tests.operator.image",
8787
"datastax/kaap:latest-dev");
@@ -116,7 +116,7 @@ public BaseK8sEnvTest() {
116116
@SneakyThrows
117117
private static List<Path> getCRDsManifests() {
118118
return Files.list(
119-
Paths.get(PULSAR_OPERATOR_CHART_PATH.toFile().getAbsolutePath(), "crds")
119+
Paths.get(OPERATOR_CHART_PATH.toFile().getAbsolutePath(), "crds")
120120
).filter(p -> p.toFile().getName().endsWith(".yml"))
121121
.collect(Collectors.toList());
122122
}
@@ -179,18 +179,18 @@ public void onClose(WatcherException cause) {
179179
private String getRbacManifest() throws IOException {
180180
List<String> allRbac = new ArrayList<>();
181181
allRbac.addAll(Files.readAllLines(
182-
Paths.get(PULSAR_OPERATOR_CHART_PATH.toFile().getAbsolutePath(), "templates", "rbac.yaml")));
182+
Paths.get(OPERATOR_CHART_PATH.toFile().getAbsolutePath(), "templates", "rbac.yaml")));
183183
allRbac.add("---");
184184
allRbac.addAll(Files.readAllLines(
185-
Paths.get(PULSAR_OPERATOR_CHART_PATH.toFile().getAbsolutePath(), "templates", "serviceaccount.yaml")));
185+
Paths.get(OPERATOR_CHART_PATH.toFile().getAbsolutePath(), "templates", "serviceaccount.yaml")));
186186

187187
return simulateHelmRendering(allRbac);
188188
}
189189

190190
private String getOperatorDeploymentManifest() throws IOException {
191191
List<String> manifests = new ArrayList<>();
192192
manifests.addAll(Files.readAllLines(
193-
Paths.get(PULSAR_OPERATOR_CHART_PATH.toFile().getAbsolutePath(), "templates", "operator.yaml")));
193+
Paths.get(OPERATOR_CHART_PATH.toFile().getAbsolutePath(), "templates", "operator.yaml")));
194194
manifests.add("---");
195195
manifests.addAll(Arrays.stream("""
196196
apiVersion: v1

tests/src/test/java/com/datastax/oss/kaap/tests/helm/BaseHelmTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public class BaseHelmTest extends BasePulsarClusterTest {
4242
"https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.crds.yaml";
4343

4444
private static final String HELM_RELEASE_PREFIX = "pothr-";
45-
public static final String HELM_BIND_PULSAR_OPERATOR = "/helm-kaap";
46-
public static final String HELM_BIND_PULSAR_STACK = "/helm-kaap-stack";
45+
public static final String HELM_BIND_OPERATOR = "/helm-kaap";
46+
public static final String HELM_BIND_STACK = "/helm-kaap-stack";
4747

4848
protected String helmReleaseName;
4949

@@ -58,10 +58,10 @@ public void beforeBaseHelmTest() throws Exception {
5858
+ namespace + "-r-" + RandomStringUtils.randomAlphabetic(8).toLowerCase();
5959
cleanupNonNamespaceableResources();
6060
env.withHelmContainer(helm -> {
61-
final Path operatorPath = PULSAR_OPERATOR_CHART_PATH;
61+
final Path operatorPath = OPERATOR_CHART_PATH;
6262
final Path stackPath = Paths.get("..", "helm", "kaap-stack");
63-
helm.withFileSystemBind(operatorPath.toFile().getAbsolutePath(), HELM_BIND_PULSAR_OPERATOR);
64-
helm.withFileSystemBind(stackPath.toFile().getAbsolutePath(), HELM_BIND_PULSAR_STACK);
63+
helm.withFileSystemBind(operatorPath.toFile().getAbsolutePath(), HELM_BIND_OPERATOR);
64+
helm.withFileSystemBind(stackPath.toFile().getAbsolutePath(), HELM_BIND_STACK);
6565
log.info("loaded helm charts from {} and {}", operatorPath, stackPath);
6666
});
6767
}
@@ -100,9 +100,9 @@ protected void helmInstall(Chart chart, String values) {
100100

101101
private static String getChartPath(Chart chart) {
102102
if (chart == Chart.OPERATOR) {
103-
return HELM_BIND_PULSAR_OPERATOR;
103+
return HELM_BIND_OPERATOR;
104104
} else {
105-
return HELM_BIND_PULSAR_STACK;
105+
return HELM_BIND_STACK;
106106
}
107107
}
108108

tests/src/test/java/com/datastax/oss/kaap/tests/helm/HelmTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ public void testHelm() throws Exception {
6565
"debug");
6666
Assert.assertEquals(configMap.getData().get("QUARKUS_OPERATOR_SDK_CONTROLLERS__CONTROLLERS__RETRY_INTERVAL_INITIAL"),
6767
"2500");
68-
Assert.assertEquals(configMap.getData().get("PULSAR_OPERATOR_RECONCILIATION_RESCHEDULE_SECONDS"),
68+
Assert.assertEquals(configMap.getData().get("KAAP_RECONCILIATION_RESCHEDULE_SECONDS"),
6969
"3");
7070

7171
final List<Pod> pods = getOperatorPods();
7272
Assert.assertEquals(pods.size(), 2);
7373
Awaitility.await().untilAsserted(() -> {
7474
Assert.assertNotNull(client.leases()
7575
.inNamespace(namespace)
76-
.withName(LeaderElectionConfig.PULSAR_OPERATOR_LEASE_NAME)
76+
.withName(LeaderElectionConfig.LEASE_NAME)
7777
.get());
7878
});
7979

0 commit comments

Comments
 (0)