当前位置: 首页>>代码示例>>Java>>正文


Java Watcher.Action方法代码示例

本文整理汇总了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);
    }
  }
}
 
开发者ID:spotify,项目名称:styx,代码行数:17,代码来源:KubernetesDockerRunner.java

示例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);
}
 
开发者ID:spotify,项目名称:styx,代码行数:11,代码来源:KubernetesDockerRunner.java

示例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;
}
 
开发者ID:fabric8io,项目名称:fabric8-devops,代码行数:14,代码来源:NotifyConfig.java

示例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);
	}
}
 
开发者ID:jenkinsci,项目名称:openshift-sync-plugin,代码行数:59,代码来源:BuildConfigWatcher.java

示例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"));
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:5,代码来源:PodDeletionBlocker.java

示例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")));
}
 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:5,代码来源:MultiPodDeletionBlocker.java

示例7: continueBlocking

import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
public abstract boolean continueBlocking(Watcher.Action eventAction, Pod eventPod); 
开发者ID:qaware,项目名称:gradle-cloud-deployer,代码行数:2,代码来源:BasePodDeletionBlocker.java

示例8: configUpdated

import io.fabric8.kubernetes.client.Watcher; //导入方法依赖的package包/类
void configUpdated(Watcher.Action action, ConfigMap configMap) throws IOException; 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:2,代码来源:ConfigSubscriber.java


注:本文中的io.fabric8.kubernetes.client.Watcher.Action方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。