@Override public void eventReceived(Action action, ConfigMap configMap) { LOGGER.debug("'{}' event received, triggering leadership update", action); if (!Action.ERROR.equals(action)) { leadershipController.update(); } }
resourceVersion.compareAndSet(currentResourceVersion, newResourceVersion); Watcher.Action action = Watcher.Action.valueOf(event.getType()); watcher.eventReceived(action, obj); } else if (event.getObject() instanceof Status) {
resourceVersion.compareAndSet(currentResourceVersion, newResourceVersion); Watcher.Action action = Watcher.Action.valueOf(event.getType()); watcher.eventReceived(action, obj); } else if (event.getObject() instanceof Status) {
private void onPod(Watcher.Action action, Pod pod, KubernetesClient kubernetes, String namespace, String ctrlCMessage, boolean followLog) { String name = KubernetesHelper.getName(pod); if (action.equals(Watcher.Action.DELETED)) { addedPods.remove(name); if (Objects.equals(watchingPodName, name)) { watchingPodName = null; addedPods.remove(name); } } else { if (action.equals(Watcher.Action.ADDED) || action.equals(Watcher.Action.MODIFIED)) { addedPods.put(name, pod); } } Pod watchPod = KubernetesResourceUtil.getNewestPod(addedPods.values()); newestPodName = KubernetesHelper.getName(watchPod); Logger statusLog = Objects.equals(name, newestPodName) ? context.getNewPodLog() : context.getOldPodLog(); if (!action.equals(Watcher.Action.MODIFIED) || watchingPodName == null || !watchingPodName.equals(name)) { statusLog.info("%s status: %s%s", name, getPodStatusDescription(pod), getPodStatusMessagePostfix(action)); } if (watchPod != null && KubernetesHelper.isPodRunning(watchPod)) { watchLogOfPodName(kubernetes, namespace, ctrlCMessage, followLog, watchPod, KubernetesHelper.getName(watchPod)); } }
protected void onWatchEvent(io.fabric8.kubernetes.client.Watcher.Action action, HasMetadata entity, NotifyConfig notifyConfig) { if (!notifyConfig.isEnabled(action)) { return; } String kind = KubernetesHelper.getKind(entity); String name = KubernetesHelper.getName(entity); String namespace = getNamespace(); String actionText = action.toString().toLowerCase(); String room = this.roomExpression.replace("${namespace}", namespace).replace("${kind}", kind).replace("${name}", name); String postfix = ""; if (action.equals(Watcher.Action.ADDED) || action.equals(Watcher.Action.MODIFIED)) { if (Strings.isNotBlank(consoleLink)) { postfix += " " + consoleLink + "/kubernetes/namespace/" + namespace + "/" + kind.toLowerCase() + "s/" + name; } } String message = actionText + " " + decapitalize(kind) + " " + namespace + " / " + name + postfix; notifier.notifyRoom(room, message); } }
resourceVersion.compareAndSet(currentResourceVersion, newResourceVersion); Watcher.Action action = Watcher.Action.valueOf(event.getType()); watcher.eventReceived(action, obj); } else if (object instanceof KubernetesResourceList) { resourceVersion.compareAndSet(currentResourceVersion, newResourceVersion); Watcher.Action action = Watcher.Action.valueOf(event.getType()); List<HasMetadata> items = list.getItems(); if (items != null) {