Search in sources :

Example 1 with DaemonSetSpec

use of io.fabric8.kubernetes.api.model.apps.DaemonSetSpec in project fabric8-maven-plugin by fabric8io.

the class KubernetesResourceUtil method getPodLabelSelector.

public static LabelSelector getPodLabelSelector(HasMetadata entity) {
    LabelSelector selector = null;
    if (entity instanceof Deployment) {
        Deployment resource = (Deployment) entity;
        DeploymentSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    } else if (entity instanceof ReplicaSet) {
        ReplicaSet resource = (ReplicaSet) entity;
        ReplicaSetSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    } else if (entity instanceof DeploymentConfig) {
        DeploymentConfig resource = (DeploymentConfig) entity;
        DeploymentConfigSpec spec = resource.getSpec();
        if (spec != null) {
            selector = toLabelSelector(spec.getSelector());
        }
    } else if (entity instanceof ReplicationController) {
        ReplicationController resource = (ReplicationController) entity;
        ReplicationControllerSpec spec = resource.getSpec();
        if (spec != null) {
            selector = toLabelSelector(spec.getSelector());
        }
    } else if (entity instanceof DaemonSet) {
        DaemonSet resource = (DaemonSet) entity;
        DaemonSetSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    } else if (entity instanceof StatefulSet) {
        StatefulSet resource = (StatefulSet) entity;
        StatefulSetSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    } else if (entity instanceof Job) {
        Job resource = (Job) entity;
        JobSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    }
    return selector;
}
Also used : StatefulSetSpec(io.fabric8.kubernetes.api.model.apps.StatefulSetSpec) ReplicaSetSpec(io.fabric8.kubernetes.api.model.apps.ReplicaSetSpec) LabelSelector(io.fabric8.kubernetes.api.model.LabelSelector) Deployment(io.fabric8.kubernetes.api.model.apps.Deployment) DaemonSetSpec(io.fabric8.kubernetes.api.model.apps.DaemonSetSpec) DeploymentSpec(io.fabric8.kubernetes.api.model.apps.DeploymentSpec) ReplicationController(io.fabric8.kubernetes.api.model.ReplicationController) DaemonSet(io.fabric8.kubernetes.api.model.apps.DaemonSet) JobSpec(io.fabric8.kubernetes.api.model.batch.JobSpec) DeploymentConfig(io.fabric8.openshift.api.model.DeploymentConfig) DeploymentConfigSpec(io.fabric8.openshift.api.model.DeploymentConfigSpec) StatefulSet(io.fabric8.kubernetes.api.model.apps.StatefulSet) Job(io.fabric8.kubernetes.api.model.batch.Job) ReplicaSet(io.fabric8.kubernetes.api.model.apps.ReplicaSet) ReplicationControllerSpec(io.fabric8.kubernetes.api.model.ReplicationControllerSpec)

Example 2 with DaemonSetSpec

use of io.fabric8.kubernetes.api.model.apps.DaemonSetSpec in project fabric8-maven-plugin by fabric8io.

the class KubernetesResourceUtil method getPodLabelSelector.

public static LabelSelector getPodLabelSelector(HasMetadata entity) {
    LabelSelector selector = null;
    if (entity instanceof Deployment) {
        Deployment resource = (Deployment) entity;
        DeploymentSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    } else if (entity instanceof ReplicaSet) {
        ReplicaSet resource = (ReplicaSet) entity;
        ReplicaSetSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    } else if (entity instanceof DeploymentConfig) {
        DeploymentConfig resource = (DeploymentConfig) entity;
        DeploymentConfigSpec spec = resource.getSpec();
        if (spec != null) {
            selector = toLabelSelector(spec.getSelector());
        }
    } else if (entity instanceof ReplicationController) {
        ReplicationController resource = (ReplicationController) entity;
        ReplicationControllerSpec spec = resource.getSpec();
        if (spec != null) {
            selector = toLabelSelector(spec.getSelector());
        }
    } else if (entity instanceof DaemonSet) {
        DaemonSet resource = (DaemonSet) entity;
        DaemonSetSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    } else if (entity instanceof StatefulSet) {
        StatefulSet resource = (StatefulSet) entity;
        StatefulSetSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    } else if (entity instanceof Job) {
        Job resource = (Job) entity;
        JobSpec spec = resource.getSpec();
        if (spec != null) {
            selector = spec.getSelector();
        }
    }
    return selector;
}
Also used : StatefulSetSpec(io.fabric8.kubernetes.api.model.extensions.StatefulSetSpec) ReplicaSetSpec(io.fabric8.kubernetes.api.model.extensions.ReplicaSetSpec) LabelSelector(io.fabric8.kubernetes.api.model.LabelSelector) Deployment(io.fabric8.kubernetes.api.model.extensions.Deployment) DaemonSetSpec(io.fabric8.kubernetes.api.model.extensions.DaemonSetSpec) DeploymentSpec(io.fabric8.kubernetes.api.model.extensions.DeploymentSpec) ReplicationController(io.fabric8.kubernetes.api.model.ReplicationController) DaemonSet(io.fabric8.kubernetes.api.model.extensions.DaemonSet) JobSpec(io.fabric8.kubernetes.api.model.JobSpec) DeploymentConfig(io.fabric8.openshift.api.model.DeploymentConfig) DeploymentConfigSpec(io.fabric8.openshift.api.model.DeploymentConfigSpec) StatefulSet(io.fabric8.kubernetes.api.model.extensions.StatefulSet) Job(io.fabric8.kubernetes.api.model.Job) ReplicaSet(io.fabric8.kubernetes.api.model.extensions.ReplicaSet) ReplicationControllerSpec(io.fabric8.kubernetes.api.model.ReplicationControllerSpec)

Aggregations

LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)2 ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)2 ReplicationControllerSpec (io.fabric8.kubernetes.api.model.ReplicationControllerSpec)2 DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)2 DeploymentConfigSpec (io.fabric8.openshift.api.model.DeploymentConfigSpec)2 Job (io.fabric8.kubernetes.api.model.Job)1 JobSpec (io.fabric8.kubernetes.api.model.JobSpec)1 DaemonSet (io.fabric8.kubernetes.api.model.apps.DaemonSet)1 DaemonSetSpec (io.fabric8.kubernetes.api.model.apps.DaemonSetSpec)1 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)1 DeploymentSpec (io.fabric8.kubernetes.api.model.apps.DeploymentSpec)1 ReplicaSet (io.fabric8.kubernetes.api.model.apps.ReplicaSet)1 ReplicaSetSpec (io.fabric8.kubernetes.api.model.apps.ReplicaSetSpec)1 StatefulSet (io.fabric8.kubernetes.api.model.apps.StatefulSet)1 StatefulSetSpec (io.fabric8.kubernetes.api.model.apps.StatefulSetSpec)1 Job (io.fabric8.kubernetes.api.model.batch.Job)1 JobSpec (io.fabric8.kubernetes.api.model.batch.JobSpec)1 DaemonSet (io.fabric8.kubernetes.api.model.extensions.DaemonSet)1 DaemonSetSpec (io.fabric8.kubernetes.api.model.extensions.DaemonSetSpec)1 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)1