Search in sources :

Example 1 with RuntimeMode

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);
}
Also used : Properties(java.util.Properties) RuntimeMode(org.eclipse.jkube.kit.config.resource.RuntimeMode)

Example 2 with RuntimeMode

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);
}
Also used : RuntimeMode(org.eclipse.jkube.kit.config.resource.RuntimeMode) Test(org.junit.Test)

Example 3 with RuntimeMode

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);
}
Also used : RuntimeMode(org.eclipse.jkube.kit.config.resource.RuntimeMode) Test(org.junit.Test)

Example 4 with RuntimeMode

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());
        }
    }
}
Also used : Properties(java.util.Properties) RuntimeMode(org.eclipse.jkube.kit.config.resource.RuntimeMode)

Example 5 with RuntimeMode

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();
    }
}
Also used : JKubeBuildStrategy(org.eclipse.jkube.kit.config.image.build.JKubeBuildStrategy) RuntimeMode(org.eclipse.jkube.kit.config.resource.RuntimeMode)

Aggregations

RuntimeMode (org.eclipse.jkube.kit.config.resource.RuntimeMode)5 Properties (java.util.Properties)2 Test (org.junit.Test)2 JKubeBuildStrategy (org.eclipse.jkube.kit.config.image.build.JKubeBuildStrategy)1