Search in sources :

Example 26 with V1ObjectMeta

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

the class HealthCheckHelperTest method createNamespace.

// Create a named namespace
private V1Namespace createNamespace(String name) throws Exception {
    CallBuilderFactory factory = new CallBuilderFactory(null);
    try {
        V1Namespace existing = factory.create().readNamespace(name);
        if (existing != null)
            return existing;
    } catch (ApiException ignore) {
    // Just ignore and try to create it
    }
    V1Namespace body = new V1Namespace();
    // Set the required api version and kind of resource
    body.setApiVersion("v1");
    body.setKind("Namespace");
    // Setup the standard object metadata
    V1ObjectMeta meta = new V1ObjectMeta();
    meta.setName(name);
    body.setMetadata(meta);
    return factory.create().createNamespace(body);
}
Also used : V1ObjectMeta(io.kubernetes.client.models.V1ObjectMeta) V1Namespace(io.kubernetes.client.models.V1Namespace) CallBuilderFactory(oracle.kubernetes.operator.helpers.CallBuilderFactory) ApiException(io.kubernetes.client.ApiException)

Example 27 with V1ObjectMeta

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

the class IngressWatcherTest method whenIngressHasNoDomainUid_returnNull.

@Test
public void whenIngressHasNoDomainUid_returnNull() throws Exception {
    V1beta1Ingress ingress = new V1beta1Ingress().metadata(new V1ObjectMeta());
    assertThat(IngressWatcher.getIngressDomainUID(ingress), nullValue());
}
Also used : V1beta1Ingress(io.kubernetes.client.models.V1beta1Ingress) V1ObjectMeta(io.kubernetes.client.models.V1ObjectMeta) Test(org.junit.Test)

Example 28 with V1ObjectMeta

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

the class IngressWatcherTest method whenIngressHasDomainUid_returnIt.

@Test
public void whenIngressHasDomainUid_returnIt() throws Exception {
    V1beta1Ingress ingress = new V1beta1Ingress().metadata(new V1ObjectMeta().labels(ImmutableMap.of(DOMAINUID_LABEL, "domain1")));
    assertThat(IngressWatcher.getIngressDomainUID(ingress), equalTo("domain1"));
}
Also used : V1beta1Ingress(io.kubernetes.client.models.V1beta1Ingress) V1ObjectMeta(io.kubernetes.client.models.V1ObjectMeta) Test(org.junit.Test)

Example 29 with V1ObjectMeta

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

the class IngressWatcherTest method whenIngressHasClusterName_returnIt.

@Test
public void whenIngressHasClusterName_returnIt() throws Exception {
    V1beta1Ingress ingress = new V1beta1Ingress().metadata(new V1ObjectMeta().labels(ImmutableMap.of(CLUSTERNAME_LABEL, "mycluster")));
    assertThat(IngressWatcher.getIngressClusterName(ingress), equalTo("mycluster"));
}
Also used : V1beta1Ingress(io.kubernetes.client.models.V1beta1Ingress) V1ObjectMeta(io.kubernetes.client.models.V1ObjectMeta) Test(org.junit.Test)

Example 30 with V1ObjectMeta

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

the class IngressWatcherTest method whenIngressHasNoClusterName_returnNull.

@Test
public void whenIngressHasNoClusterName_returnNull() throws Exception {
    V1beta1Ingress ingress = new V1beta1Ingress().metadata(new V1ObjectMeta());
    assertThat(IngressWatcher.getIngressClusterName(ingress), nullValue());
}
Also used : V1beta1Ingress(io.kubernetes.client.models.V1beta1Ingress) V1ObjectMeta(io.kubernetes.client.models.V1ObjectMeta) Test(org.junit.Test)

Aggregations

V1ObjectMeta (io.kubernetes.client.models.V1ObjectMeta)36 Test (org.junit.Test)12 V1Service (io.kubernetes.client.models.V1Service)10 ApiException (io.kubernetes.client.ApiException)7 CallBuilderFactory (oracle.kubernetes.operator.helpers.CallBuilderFactory)6 V1beta1Ingress (io.kubernetes.client.models.V1beta1Ingress)5 DomainPresenceInfo (oracle.kubernetes.operator.helpers.DomainPresenceInfo)4 IntOrString (io.kubernetes.client.custom.IntOrString)3 V1PodTemplateSpec (io.kubernetes.client.models.V1PodTemplateSpec)3 HashMap (java.util.HashMap)3 Domain (oracle.kubernetes.weblogic.domain.v1.Domain)3 DomainSpec (oracle.kubernetes.weblogic.domain.v1.DomainSpec)3 V1LabelSelector (io.kubernetes.client.models.V1LabelSelector)2 V1Namespace (io.kubernetes.client.models.V1Namespace)2 V1Secret (io.kubernetes.client.models.V1Secret)2 V1ServicePort (io.kubernetes.client.models.V1ServicePort)2 V1ServiceSpec (io.kubernetes.client.models.V1ServiceSpec)2 Method (java.lang.reflect.Method)2 ArrayList (java.util.ArrayList)2 ServerKubernetesObjects (oracle.kubernetes.operator.helpers.ServerKubernetesObjects)2