Skip to content

Commit 7d4ecf4

Browse files
committed
wip
Signed-off-by: csviri <[email protected]>
1 parent a1194b6 commit 7d4ecf4

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

src/main/java/io/csviri/operator/resourceglue/Utils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import java.util.*;
44

5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
7+
58
import io.csviri.operator.resourceglue.customresource.glue.DependentResourceSpec;
69
import io.csviri.operator.resourceglue.customresource.glue.Glue;
710
import io.fabric8.kubernetes.api.model.GenericKubernetesResource;
@@ -14,6 +17,8 @@
1417

1518
public class Utils {
1619

20+
private static final Logger log = LoggerFactory.getLogger(Utils.class);
21+
1722
public static final String RESOURCE_NAME_DELIMITER = "#";
1823

1924
private Utils() {}
@@ -38,6 +43,7 @@ public static Map<String, GenericKubernetesResource> getActualResourcesByNameInW
3843

3944
glue.getSpec().getRelatedResources().forEach(r -> {
4045
var gvk = new GroupVersionKind(r.getApiVersion(), r.getKind());
46+
log.debug("Getting event source for gvk: {}", gvk);
4147
var es =
4248
(InformerEventSource<GenericKubernetesResource, Glue>) context
4349
.eventSourceRetriever()

src/main/java/io/csviri/operator/resourceglue/reconciler/glue/GlueReconciler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public UpdateControl<Glue> reconcile(Glue primary,
4444

4545
log.debug("Reconciling glue. name: {} namespace: {}",
4646
primary.getMetadata().getName(), primary.getMetadata().getNamespace());
47+
addFinalizersToParentResource(primary);
4748
registerRelatedResourceInformers(context, primary);
4849
if (ownersBeingDeleted(primary, context)) {
4950
return UpdateControl.noUpdate();
@@ -56,6 +57,13 @@ public UpdateControl<Glue> reconcile(Glue primary,
5657
return UpdateControl.noUpdate();
5758
}
5859

60+
// todo issue, condition if resource exists (related resource exists)
61+
// todo, also remove finalizer on cleanup
62+
// add just
63+
private void addFinalizersToParentResource(Glue primary) {
64+
65+
}
66+
5967
/**
6068
* If a parent gets deleted, the glue is reconciled still, but we don't want that in that case.
6169
* Glue us deleted / marked for deleted eventually by the garbage collector but want to make the

src/test/java/io/csviri/operator/resourceglue/GlueOperatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void templating() {
8181

8282
delete(cr);
8383

84-
await().untilAsserted(() -> {
84+
await().timeout(Duration.ofMinutes(5)).untilAsserted(() -> {
8585
var cm1 = get(ConfigMap.class, name);
8686
var actualCR = get(TestCustomResource.class, name);
8787
assertThat(cm1).isNull();

src/test/java/io/csviri/operator/resourceglue/GlueTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ void simpleConcurrencyTest() {
140140
}));
141141

142142
glueList.forEach(this::delete);
143-
await().timeout(Duration.ofMinutes(5))
144-
.untilAsserted(() -> IntStream.range(0, num).forEach(index -> {
145-
var w = get(Glue.class, "testglue" + index);
146-
assertThat(w).isNull();
147-
}));
143+
await().untilAsserted(() -> IntStream.range(0, num).forEach(index -> {
144+
var w = get(Glue.class, "testglue" + index);
145+
assertThat(w).isNull();
146+
}));
148147
}
149148

150149
@Test

0 commit comments

Comments
 (0)