use of io.fabric8.kubernetes.api.model.ConfigBuilder in project fabric8 by jboss-fuse.
the class PodIdToReplicationControllerIDExample method main.
public static void main(String[] args) {
if (args.length < 3) {
System.out.println("Arguments: kuberneteMasterUrl namespace podID");
return;
}
String kuberneteMasterUrl = args[0];
String namespace = args[1];
String podID = args[2];
System.out.println("Looking up ReplicationController for pod ID: " + podID);
KubernetesClient client = new DefaultKubernetesClient(new ConfigBuilder().withMasterUrl(kuberneteMasterUrl).build());
Pod pod = (Pod) client.pods().inNamespace(namespace).withName(podID);
pod.getMetadata().getLabels();
List<ReplicationController> replicationControllers = client.replicationControllers().inNamespace(namespace).withLabels(pod.getMetadata().getLabels()).list().getItems();
if (replicationControllers.size() == 1) {
ReplicationController replicationController = replicationControllers.get(0);
String id = KubernetesHelper.getName(replicationController);
System.out.println("Found replication controller: " + id);
} else {
System.out.println("Could not find replication controller!");
}
}
use of io.fabric8.kubernetes.api.model.ConfigBuilder in project jbosstools-openshift by jbosstools.
the class OdoCli method getConfig.
protected Config getConfig() {
ConfigBuilder builder = new ConfigBuilder();
try {
IProxyData data = getProxyData(new URI(builder.getMasterUrl()));
if (data != null) {
if (data.isRequiresAuthentication()) {
builder.withProxyUsername(data.getUserId());
builder.withProxyPassword(data.getPassword());
}
builder.withHttpsProxy("http://" + data.getHost() + ':' + data.getPort());
}
} catch (URISyntaxException e) {
OpenShiftUIActivator.log(IStatus.ERROR, e.getLocalizedMessage(), e);
}
return builder.build();
}
Aggregations