Search in sources :

Example 1 with DaemonSetSpec

use of io.fabric8.kubernetes.api.model.extensions.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

Job (io.fabric8.kubernetes.api.model.Job)1 JobSpec (io.fabric8.kubernetes.api.model.JobSpec)1 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)1 ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)1 ReplicationControllerSpec (io.fabric8.kubernetes.api.model.ReplicationControllerSpec)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 DeploymentSpec (io.fabric8.kubernetes.api.model.extensions.DeploymentSpec)1 ReplicaSet (io.fabric8.kubernetes.api.model.extensions.ReplicaSet)1 ReplicaSetSpec (io.fabric8.kubernetes.api.model.extensions.ReplicaSetSpec)1 StatefulSet (io.fabric8.kubernetes.api.model.extensions.StatefulSet)1 StatefulSetSpec (io.fabric8.kubernetes.api.model.extensions.StatefulSetSpec)1 DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)1 DeploymentConfigSpec (io.fabric8.openshift.api.model.DeploymentConfigSpec)1