本文整理汇总了Java中io.fabric8.kubernetes.client.Watcher.Action方法的典型用法代码示例。如果您正苦于以下问题:Java Watcher.Action方法的具体用法?Java Watcher.Action怎么用?Java Watcher.Action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.fabric8.kubernetes.client.Watcher
的用法示例。
在下文中一共展示了Watcher.Action方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emitPodEvents
import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
private void emitPodEvents(Watcher.Action action, Pod pod, RunState runState) {
final List<Event> events = translate(runState.workflowInstance(), runState, action, pod, stats);
for (Event event : events) {
if (event.accept(new PullImageErrorMatcher())) {
stats.recordPullImageError();
}
try {
stateManager.receive(event);
} catch (IsClosedException isClosedException) {
LOG.warn("Could not receive kubernetes event", isClosedException);
throw new RuntimeException(isClosedException);
}
}
}
示例2: logEvent
import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
private void logEvent(Watcher.Action action, Pod pod, String resourceVersion,
boolean polled) {
final String podName = pod.getMetadata().getName();
final String workflowInstance = pod.getMetadata().getAnnotations()
.getOrDefault(KubernetesDockerRunner.STYX_WORKFLOW_INSTANCE_ANNOTATION, "N/A");
final String status = readStatus(pod);
LOG.info("{}Pod event for {} at resource version {}, action: {}, workflow instance: {}, status: {}",
polled ? "Polled: " : "", podName, resourceVersion, action, workflowInstance, status);
}
示例3: isEnabled
import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
public boolean isEnabled(Watcher.Action action) {
switch (action) {
case ADDED:
return isNotifyAdd();
case MODIFIED:
return isNotifyModify();
case DELETED:
return isNotifyDelete();
case ERROR:
return isNotifyError();
}
return false;
}
示例4: eventReceived
import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
@SuppressFBWarnings("SF_SWITCH_NO_DEFAULT")
@Override
public synchronized void eventReceived(Watcher.Action action, BuildConfig buildConfig) {
try {
switch (action) {
case ADDED:
upsertJob(buildConfig);
break;
case DELETED:
deleteEventToJenkinsJob(buildConfig);
break;
case MODIFIED:
modifyEventToJenkinsJob(buildConfig);
break;
}
// if bc event came after build events, let's
// poke the BuildWatcher builds with no BC list to create job
// runs
BuildWatcher.flushBuildsWithNoBCList();
// now, if the build event was lost and never received, builds
// will stay in
// new for 5 minutes ... let's launch a background thread to
// clean them up
// at a quicker interval than the default 5 minute general build
// relist function
if (action == Watcher.Action.ADDED) {
Runnable backupBuildQuery = new SafeTimerTask() {
@Override
public void doRun() {
if (!CredentialsUtils.hasCredentials()) {
logger.fine("No Openshift Token credential defined.");
return;
}
BuildList buildList = getAuthenticatedOpenShiftClient()
.builds()
.inNamespace(
buildConfig.getMetadata()
.getNamespace())
.withField(OPENSHIFT_BUILD_STATUS_FIELD,
BuildPhases.NEW)
.withLabel(OPENSHIFT_LABELS_BUILD_CONFIG_NAME,
buildConfig.getMetadata().getName())
.list();
if (buildList.getItems().size() > 0) {
logger.info("build backup query for "
+ buildConfig.getMetadata().getName()
+ " found new builds");
BuildWatcher.onInitialBuilds(buildList);
}
}
};
Timer.get().schedule(backupBuildQuery, 10 * 1000,
TimeUnit.MILLISECONDS);
}
} catch (Exception e) {
logger.log(Level.WARNING, "Caught: " + e, e);
}
}
示例5: continueBlocking
import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
@Override
public boolean continueBlocking(Watcher.Action eventAction, Pod eventPod) {
return !(podEquals(pod, eventPod) && eventAction.name().equals("DELETED"));
}
示例6: continueBlocking
import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
@Override
public boolean continueBlocking(Watcher.Action eventAction, Pod eventPod) {
return !(pods.stream().anyMatch(pod -> podEquals(pod, eventPod) && eventAction.name().equals("DELETED")));
}
示例7: continueBlocking
import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
public abstract boolean continueBlocking(Watcher.Action eventAction, Pod eventPod);
示例8: configUpdated
import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
void configUpdated(Watcher.Action action, ConfigMap configMap) throws IOException;