Search in sources :

Example 6 with V1ServiceList

use of io.kubernetes.client.models.V1ServiceList in project java by kubernetes-client.

the class CoreV1ApiTest method listNamespacedServiceTest.

/**
 * list or watch objects of kind Service
 *
 * @throws ApiException
 *          if the Api call fails
 */
@Test
public void listNamespacedServiceTest() throws ApiException {
    String namespace = null;
    String pretty = null;
    String _continue = null;
    String fieldSelector = null;
    Boolean includeUninitialized = null;
    String labelSelector = null;
    Integer limit = null;
    String resourceVersion = null;
    Integer timeoutSeconds = null;
    Boolean watch = null;
    V1ServiceList response = api.listNamespacedService(namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
// TODO: test validations
}
Also used : V1ServiceList(io.kubernetes.client.models.V1ServiceList) Test(org.junit.Test)

Example 7 with V1ServiceList

use of io.kubernetes.client.models.V1ServiceList in project java by kubernetes-client.

the class CoreV1ApiTest method listServiceForAllNamespacesTest.

/**
 * list or watch objects of kind Service
 *
 * @throws ApiException
 *          if the Api call fails
 */
@Test
public void listServiceForAllNamespacesTest() throws ApiException {
    String _continue = null;
    String fieldSelector = null;
    Boolean includeUninitialized = null;
    String labelSelector = null;
    Integer limit = null;
    String pretty = null;
    String resourceVersion = null;
    Integer timeoutSeconds = null;
    Boolean watch = null;
    V1ServiceList response = api.listServiceForAllNamespaces(_continue, fieldSelector, includeUninitialized, labelSelector, limit, pretty, resourceVersion, timeoutSeconds, watch);
// TODO: test validations
}
Also used : V1ServiceList(io.kubernetes.client.models.V1ServiceList) Test(org.junit.Test)

Example 8 with V1ServiceList

use of io.kubernetes.client.models.V1ServiceList in project weblogic-kubernetes-operator by oracle.

the class ServiceHelperTest method createReadListUpdate.

@Test
public void createReadListUpdate() throws Exception {
    CallBuilderFactory factory = new CallBuilderFactory(null);
    // Domain
    Domain dom = new Domain();
    V1ObjectMeta metadata = new V1ObjectMeta();
    metadata.setResourceVersion("12345");
    metadata.setNamespace("tests");
    dom.setMetadata(metadata);
    DomainSpec spec = new DomainSpec();
    spec.setDomainUID("domain-uid");
    spec.setDomainName("base_domain");
    dom.setSpec(spec);
    // Create a new service.
    System.out.println("Creating service");
    Step s = ServiceHelper.createForServerStep(null);
    Engine e = new Engine("ServiceHelperTest");
    Packet p = new Packet();
    DomainPresenceInfo info = new DomainPresenceInfo(dom);
    p.getComponents().put(ProcessingConstants.DOMAIN_COMPONENT_NAME, Component.createFor(info));
    p.put(ProcessingConstants.SERVER_NAME, "admin");
    p.put(ProcessingConstants.PORT, Integer.valueOf(7001));
    Fiber f = e.createFiber();
    f.start(s, p, null);
    f.get();
    // Read the service we just created.
    System.out.println("Reading service");
    V1Service service = factory.create().readService("domain-uid-admin", "tests");
    checkService(service, false);
    // Get a list of services.
    System.out.println("Listing services");
    V1ServiceList serviceList = factory.create().listService("tests");
    boolean serviceFound = false;
    for (V1Service item : serviceList.getItems()) {
        if (item.getMetadata().getName().equals("domain-uid-admin")) {
            serviceFound = true;
            break;
        }
    }
    Assert.assertTrue("Expected service domain-uid-admin not found in list", serviceFound);
    // Add a second selector to this service.
    Map<String, String> selector = service.getSpec().getSelector();
    selector.put("domain", "domain-uid");
    service.getSpec().setSelector(selector);
// TODO: uncomment out when bug calling replace service is fixed.
// System.out.println("Replacing service");
// service = serviceHelper.replace("domain-uid-admin", service);
// checkService(service, true);
}
Also used : Packet(oracle.kubernetes.operator.work.Packet) V1ServiceList(io.kubernetes.client.models.V1ServiceList) V1ObjectMeta(io.kubernetes.client.models.V1ObjectMeta) Fiber(oracle.kubernetes.operator.work.Fiber) V1Service(io.kubernetes.client.models.V1Service) CallBuilderFactory(oracle.kubernetes.operator.helpers.CallBuilderFactory) Step(oracle.kubernetes.operator.work.Step) DomainPresenceInfo(oracle.kubernetes.operator.helpers.DomainPresenceInfo) DomainSpec(oracle.kubernetes.weblogic.domain.v1.DomainSpec) Domain(oracle.kubernetes.weblogic.domain.v1.Domain) Engine(oracle.kubernetes.operator.work.Engine) Test(org.junit.Test)

Aggregations

V1ServiceList (io.kubernetes.client.models.V1ServiceList)8 Type (java.lang.reflect.Type)4 Test (org.junit.Test)3 ProgressRequestBody (io.kubernetes.client.ProgressRequestBody)2 ProgressResponseBody (io.kubernetes.client.ProgressResponseBody)2 V1ObjectMeta (io.kubernetes.client.models.V1ObjectMeta)2 V1Service (io.kubernetes.client.models.V1Service)2 ApiException (io.kubernetes.client.ApiException)1 JSON (io.kubernetes.client.JSON)1 V1ConfigMap (io.kubernetes.client.models.V1ConfigMap)1 V1DeleteOptions (io.kubernetes.client.models.V1DeleteOptions)1 V1EnvVar (io.kubernetes.client.models.V1EnvVar)1 V1PersistentVolumeClaimList (io.kubernetes.client.models.V1PersistentVolumeClaimList)1 V1Pod (io.kubernetes.client.models.V1Pod)1 V1PodList (io.kubernetes.client.models.V1PodList)1 V1Status (io.kubernetes.client.models.V1Status)1 V1beta1Ingress (io.kubernetes.client.models.V1beta1Ingress)1 V1beta1IngressList (io.kubernetes.client.models.V1beta1IngressList)1 Watch (io.kubernetes.client.util.Watch)1 IOException (java.io.IOException)1