io.fabric8.kubernetes.api.model.TCPSocketAction Java Examples

The following examples show how to use io.fabric8.kubernetes.api.model.TCPSocketAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractAddProbeDecorator.java    From dekorate with Apache License 2.0 6 votes vote down vote up
@Override
public void andThenVisit(ContainerFluent<?> container) {
  if (probe == null) {
    return;
  }

  final ExecAction execAction = execAction(probe);
  final TCPSocketAction tcpSocketAction = tcpSocketAction(probe);
  final boolean defaultToHttpGetAction = (execAction == null) && (tcpSocketAction == null);
  final HTTPGetAction httpGetAction = defaultToHttpGetAction ? httpGetAction(probe, container) : null;
  if (defaultToHttpGetAction && (httpGetAction == null)) {
    return;
  }

  doCreateProbe(container, new Actions(execAction, tcpSocketAction, httpGetAction));
}
 
Example #2
Source File: ProbeHandler.java    From jkube with Eclipse Public License 2.0 5 votes vote down vote up
public Probe getProbe(ProbeConfig probeConfig)  {
    if (probeConfig == null) {
        return null;
    }

    Probe probe = new Probe();
    Integer initialDelaySeconds = probeConfig.getInitialDelaySeconds();
    if (initialDelaySeconds != null) {
        probe.setInitialDelaySeconds(initialDelaySeconds);
    }
    Integer timeoutSeconds = probeConfig.getTimeoutSeconds();
    if (timeoutSeconds != null) {
        probe.setTimeoutSeconds(timeoutSeconds);
    }
    Integer failureThreshold = probeConfig.getFailureThreshold();
    if(failureThreshold != null) {
        probe.setFailureThreshold(failureThreshold);
    }
    Integer successThreshold = probeConfig.getSuccessThreshold();
    if(successThreshold != null) {
        probe.setSuccessThreshold(successThreshold);
    }
    HTTPGetAction getAction = getHTTPGetAction(probeConfig.getGetUrl());
    if (getAction != null) {
        probe.setHttpGet(getAction);
        return probe;
    }
    ExecAction execAction = getExecAction(probeConfig.getExec());
    if (execAction != null) {
        probe.setExec(execAction);
        return probe;
    }
    TCPSocketAction tcpSocketAction = getTCPSocketAction(probeConfig.getGetUrl(), probeConfig.getTcpPort());
    if (tcpSocketAction != null) {
        probe.setTcpSocket(tcpSocketAction);
        return probe;
    }

    return null;
}
 
Example #3
Source File: KnativeServiceHandler.java    From module-ballerina-kubernetes with Apache License 2.0 5 votes vote down vote up
private Probe generateProbe(ProbeModel probeModel) {
    if (null == probeModel) {
        return null;
    }
    TCPSocketAction tcpSocketAction = new TCPSocketActionBuilder()
            .withNewPort(probeModel.getPort())
            .build();
    return new ProbeBuilder()
            .withInitialDelaySeconds(probeModel.getInitialDelaySeconds())
            .withPeriodSeconds(probeModel.getPeriodSeconds())
            .withTcpSocket(tcpSocketAction)
            .build();
}
 
Example #4
Source File: DeploymentHandler.java    From module-ballerina-kubernetes with Apache License 2.0 5 votes vote down vote up
private Probe generateProbe(ProbeModel probeModel) {
    if (null == probeModel) {
        return null;
    }
    TCPSocketAction tcpSocketAction = new TCPSocketActionBuilder()
            .withNewPort(probeModel.getPort())
            .build();
    return new ProbeBuilder()
            .withInitialDelaySeconds(probeModel.getInitialDelaySeconds())
            .withPeriodSeconds(probeModel.getPeriodSeconds())
            .withTcpSocket(tcpSocketAction)
            .build();
}
 
Example #5
Source File: AbstractAddProbeDecorator.java    From dekorate with Apache License 2.0 5 votes vote down vote up
private TCPSocketAction tcpSocketAction(Probe probe) {
  if (Strings.isNullOrEmpty(probe.getTcpSocketAction()))  {
    return null;
  }

  String[] parts = probe.getTcpSocketAction().split(":");
  if (parts.length != 2) {
    throw  new RuntimeException("Invalid format for tcp socket action! Expected: <host>:<port>. Found:"+probe.getTcpSocketAction()+".");
  }

  return new TCPSocketAction(parts[0], new IntOrString(parts[1]));
}
 
Example #6
Source File: AbstractAddProbeDecorator.java    From dekorate with Apache License 2.0 4 votes vote down vote up
protected Actions(ExecAction execAction, TCPSocketAction tcpSocketAction, HTTPGetAction httpGetAction) {
  this.execAction = execAction;
  this.tcpSocketAction = tcpSocketAction;
  this.httpGetAction = httpGetAction;
}