use of io.fabric8.kubernetes.api.model.HasMetadata in project fabric8-maven-plugin by fabric8io.
the class DebugEnricher method enableDebug.
private boolean enableDebug(HasMetadata entity) {
if (entity instanceof Deployment) {
Deployment resource = (Deployment) entity;
DeploymentSpec spec = resource.getSpec();
if (spec != null) {
return enableDebugging(entity, spec.getTemplate());
}
} else if (entity instanceof ReplicaSet) {
ReplicaSet resource = (ReplicaSet) entity;
ReplicaSetSpec spec = resource.getSpec();
if (spec != null) {
return enableDebugging(entity, spec.getTemplate());
}
} else if (entity instanceof ReplicationController) {
ReplicationController resource = (ReplicationController) entity;
ReplicationControllerSpec spec = resource.getSpec();
if (spec != null) {
return enableDebugging(entity, spec.getTemplate());
}
} else if (entity instanceof DeploymentConfig) {
DeploymentConfig resource = (DeploymentConfig) entity;
DeploymentConfigSpec spec = resource.getSpec();
if (spec != null) {
return enableDebugging(entity, spec.getTemplate());
}
}
return false;
}
use of io.fabric8.kubernetes.api.model.HasMetadata in project fabric8-maven-plugin by fabric8io.
the class KubernetesResourceUtilTest method job.
@Test
public void job() throws Exception {
HasMetadata ret = getResource(DEFAULT_RESOURCE_VERSIONING, new File(fabric8Dir, "job.yml"), "app");
assertEquals("Job", ret.getKind());
assertEquals(JOB_VERSION, ret.getApiVersion());
}
use of io.fabric8.kubernetes.api.model.HasMetadata in project fabric8-maven-plugin by fabric8io.
the class KubernetesResourceUtilTest method withValue.
@Test
public void withValue() throws IOException {
HasMetadata ret = getResource(DEFAULT_RESOURCE_VERSIONING, new File(fabric8Dir, "named-svc.yaml"), "app");
assertEquals(API_VERSION, ret.getApiVersion());
assertEquals("Service", ret.getKind());
assertEquals("pong", ret.getMetadata().getName());
}
use of io.fabric8.kubernetes.api.model.HasMetadata in project fabric8-maven-plugin by fabric8io.
the class KubernetesResourceUtilTest method noNameInFileAndNotInMetadata.
@Test
public void noNameInFileAndNotInMetadata() throws IOException {
HasMetadata ret = getResource(DEFAULT_RESOURCE_VERSIONING, new File(fabric8Dir, "svc.yml"), "app");
assertEquals("Service", ret.getKind());
assertEquals("app", ret.getMetadata().getName());
}
use of io.fabric8.kubernetes.api.model.HasMetadata in project fabric8-maven-plugin by fabric8io.
the class KubernetesResourceUtilTest method containsKind.
@Test
public void containsKind() throws Exception {
HasMetadata ret = getResource(DEFAULT_RESOURCE_VERSIONING, new File(fabric8Dir, "contains_kind.yml"), "app");
assertEquals("ReplicationController", ret.getKind());
}
Aggregations