Skip to content

Commit 15135eb

Browse files
authored
docs: why the pods deleted on web page sample (#1321)
1 parent 0a3714a commit 15135eb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

sample-operators/webpage/src/main/java/io/javaoperatorsdk/operator/sample/ConfigMapDependentResource.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public ConfigMap update(ConfigMap actual, ConfigMap target, WebPage primary,
5151
var ns = actual.getMetadata().getNamespace();
5252
log.info("Restarting pods because HTML has changed in {}",
5353
ns);
54+
// not that this is not necessary, eventually mounted config map would be updated, just this way
55+
// is much faster; what is handy for demo purposes.
56+
// https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#mounted-configmaps-are-updated-automatically
5457
getKubernetesClient()
5558
.pods()
5659
.inNamespace(ns)

sample-operators/webpage/src/main/java/io/javaoperatorsdk/operator/sample/WebPageReconciler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ public UpdateControl<WebPage> reconcile(WebPage webPage, Context<WebPage> contex
126126
existingIngress.ifPresent(
127127
ingress -> kubernetesClient.resource(ingress).delete());
128128

129+
// not that this is not necessary, eventually mounted config map would be updated, just this way
130+
// is much faster; what is handy for demo purposes.
131+
// https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#mounted-configmaps-are-updated-automatically
129132
if (previousConfigMap != null && !StringUtils.equals(
130133
previousConfigMap.getData().get(INDEX_HTML),
131134
desiredHtmlConfigMap.getData().get(INDEX_HTML))) {

0 commit comments

Comments
 (0)