use of org.eclipse.jkube.kit.config.resource.RuntimeMode in project jkube by eclipse.
the class OpenShiftResourceTask method resolveImages.
@Override
public List<ImageConfiguration> resolveImages(ImageConfigResolver imageConfigResolver) throws IOException {
RuntimeMode runtimeMode = kubernetesExtension.getRuntimeMode();
final Properties properties = kubernetesExtension.javaProject.getProperties();
if (!properties.contains(DOCKER_IMAGE_USER)) {
String namespaceToBeUsed = Optional.ofNullable(kubernetesExtension.getNamespaceOrNull()).orElse(clusterAccess.getNamespace());
kitLogger.info("Using container image name of namespace: " + namespaceToBeUsed);
properties.setProperty(DOCKER_IMAGE_USER, namespaceToBeUsed);
}
if (!properties.contains(RuntimeMode.JKUBE_EFFECTIVE_PLATFORM_MODE)) {
properties.setProperty(RuntimeMode.JKUBE_EFFECTIVE_PLATFORM_MODE, runtimeMode.toString());
}
return super.resolveImages(imageConfigResolver);
}
use of org.eclipse.jkube.kit.config.resource.RuntimeMode in project jkube by eclipse.
the class OpenShiftExtensionTest method getRuntimeMode_withDefaults_shouldReturnKubernetes.
@Test
public void getRuntimeMode_withDefaults_shouldReturnKubernetes() {
// Given
final OpenShiftExtension partial = mock(OpenShiftExtension.class);
when(partial.getRuntimeMode()).thenCallRealMethod();
// When
final RuntimeMode result = partial.getRuntimeMode();
// Then
assertThat(result).isEqualTo(RuntimeMode.OPENSHIFT);
}
use of org.eclipse.jkube.kit.config.resource.RuntimeMode in project jkube by eclipse.
the class KubernetesExtensionTest method getRuntimeMode_withDefaults_shouldReturnKubernetes.
@Test
public void getRuntimeMode_withDefaults_shouldReturnKubernetes() {
// Given
final KubernetesExtension partial = mock(KubernetesExtension.class);
when(partial.getRuntimeMode()).thenCallRealMethod();
// When
final RuntimeMode result = partial.getRuntimeMode();
// Then
assertThat(result).isEqualTo(RuntimeMode.KUBERNETES);
}
use of org.eclipse.jkube.kit.config.resource.RuntimeMode in project jkube by eclipse.
the class ResourceMojo method lateInit.
private void lateInit() {
RuntimeMode runtimeMode = getRuntimeMode();
jkubeServiceHub.setPlatformMode(runtimeMode);
if (runtimeMode.equals(RuntimeMode.OPENSHIFT)) {
Properties properties = javaProject.getProperties();
if (!properties.contains(DOCKER_IMAGE_USER)) {
String namespaceToBeUsed = this.namespace != null && !this.namespace.isEmpty() ? this.namespace : clusterAccess.getNamespace();
log.info("Using docker image name of namespace: " + namespaceToBeUsed);
properties.setProperty(DOCKER_IMAGE_USER, namespaceToBeUsed);
}
if (!properties.contains(RuntimeMode.JKUBE_EFFECTIVE_PLATFORM_MODE)) {
properties.setProperty(RuntimeMode.JKUBE_EFFECTIVE_PLATFORM_MODE, runtimeMode.toString());
}
}
}
use of org.eclipse.jkube.kit.config.resource.RuntimeMode in project jkube by eclipse.
the class FromSelector method getFrom.
public String getFrom() {
RuntimeMode mode = context.getRuntimeMode();
JKubeBuildStrategy strategy = context.getStrategy();
if (mode == RuntimeMode.OPENSHIFT && strategy == JKubeBuildStrategy.s2i) {
return getS2iBuildFrom();
} else {
return getDockerBuildFrom();
}
}
Aggregations