Search in sources :

Example 1 with ClusterAccess

use of org.eclipse.jkube.kit.config.access.ClusterAccess in project jkube by eclipse.

the class KubernetesClientUtilTest method applicableNamespace_whenNamespaceProvidedViaClusterAccess_shouldReturnProvidedNamespace.

@Test
public void applicableNamespace_whenNamespaceProvidedViaClusterAccess_shouldReturnProvidedNamespace() {
    // Given
    ClusterAccess mockedClusterAccess = mock(ClusterAccess.class, RETURNS_DEEP_STUBS);
    when(mockedClusterAccess.getNamespace()).thenReturn("ns1");
    // When
    String resolvedNamespace = KubernetesClientUtil.applicableNamespace(null, null, null, mockedClusterAccess);
    // Then
    assertThat(resolvedNamespace).isEqualTo("ns1");
}
Also used : ClusterAccess(org.eclipse.jkube.kit.config.access.ClusterAccess) Test(org.junit.Test)

Example 2 with ClusterAccess

use of org.eclipse.jkube.kit.config.access.ClusterAccess in project jkube by eclipse.

the class KubernetesClientUtilTest method resolveFallbackNamespace_whenNamespaceProvidedViaClusterAccess_shouldReturnProvidedNamespace.

@Test
public void resolveFallbackNamespace_whenNamespaceProvidedViaClusterAccess_shouldReturnProvidedNamespace() {
    // Given
    ClusterAccess mockedClusterAccess = mock(ClusterAccess.class, RETURNS_DEEP_STUBS);
    when(mockedClusterAccess.getNamespace()).thenReturn("ns1");
    // When
    String resolvedNamespace = KubernetesClientUtil.resolveFallbackNamespace(null, mockedClusterAccess);
    // Then
    assertThat(resolvedNamespace).isEqualTo("ns1");
}
Also used : ClusterAccess(org.eclipse.jkube.kit.config.access.ClusterAccess) Test(org.junit.Test)

Example 3 with ClusterAccess

use of org.eclipse.jkube.kit.config.access.ClusterAccess in project jkube by eclipse.

the class JKubeServiceHubTest method setUp.

@Before
public void setUp() throws Exception {
    final ClusterAccess clusterAccess = mock(ClusterAccess.class, RETURNS_DEEP_STUBS);
    when(clusterAccess.createDefaultClient()).thenReturn(mock(OpenShiftClient.class, RETURNS_DEEP_STUBS));
    jKubeServiceHubBuilder = JKubeServiceHub.builder().platformMode(RuntimeMode.KUBERNETES).configuration(mock(JKubeConfiguration.class, RETURNS_DEEP_STUBS)).clusterAccess(clusterAccess).log(mock(KitLogger.class)).dockerServiceHub(mock(DockerServiceHub.class, RETURNS_DEEP_STUBS)).offline(false).buildServiceConfig(mock(BuildServiceConfig.class, RETURNS_DEEP_STUBS));
}
Also used : KitLogger(org.eclipse.jkube.kit.common.KitLogger) JKubeConfiguration(org.eclipse.jkube.kit.common.JKubeConfiguration) ClusterAccess(org.eclipse.jkube.kit.config.access.ClusterAccess) OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) Before(org.junit.Before)

Example 4 with ClusterAccess

use of org.eclipse.jkube.kit.config.access.ClusterAccess in project jkube by eclipse.

the class AbstractDockerMojo method init.

protected void init() {
    log = new AnsiLogger(getLog(), useColorForLogging(), verbose, !settings.getInteractiveMode(), getLogPrefix());
    logOutputSpecFactory = new LogOutputSpecFactory(useColorForLogging(), logStdout, logDate);
    authConfigFactory = new AuthConfigFactory(log);
    imageConfigResolver.setLog(log);
    clusterAccess = new ClusterAccess(log, initClusterConfiguration());
    runtimeMode = getConfiguredRuntimeMode();
}
Also used : LogOutputSpecFactory(org.eclipse.jkube.kit.build.service.docker.access.log.LogOutputSpecFactory) ClusterAccess(org.eclipse.jkube.kit.config.access.ClusterAccess) AuthConfigFactory(org.eclipse.jkube.kit.build.service.docker.auth.AuthConfigFactory) AnsiLogger(org.eclipse.jkube.kit.common.util.AnsiLogger)

Example 5 with ClusterAccess

use of org.eclipse.jkube.kit.config.access.ClusterAccess in project jkube by eclipse.

the class AbstractJKubeTask method init.

private void init() {
    kubernetesExtension.javaProject = GradleUtil.convertGradleProject(getProject());
    kitLogger = createLogger(null);
    logOutputSpecFactory = new LogOutputSpecFactory(isAnsiEnabled(), kubernetesExtension.getLogStdoutOrDefault(), kubernetesExtension.getLogDateOrNull());
    clusterAccess = new ClusterAccess(kitLogger, initClusterConfiguration());
    jKubeServiceHub = initJKubeServiceHubBuilder().build();
    kubernetesExtension.resources = updateResourceConfigNamespace(kubernetesExtension.getNamespaceOrNull(), kubernetesExtension.resources);
    ImageConfigResolver imageConfigResolver = new ImageConfigResolver();
    try {
        resolvedImages = resolveImages(imageConfigResolver);
        enricherManager = new DefaultEnricherManager(JKubeEnricherContext.builder().project(kubernetesExtension.javaProject).processorConfig(ProfileUtil.blendProfileWithConfiguration(ProfileUtil.ENRICHER_CONFIG, kubernetesExtension.getProfileOrNull(), resolveResourceSourceDirectory(), kubernetesExtension.enricher)).images(resolvedImages).resources(kubernetesExtension.resources).log(kitLogger).build());
    } catch (IOException exception) {
        kitLogger.error("Error in fetching Build timestamps: " + exception.getMessage());
    }
}
Also used : DefaultEnricherManager(org.eclipse.jkube.kit.enricher.api.DefaultEnricherManager) LogOutputSpecFactory(org.eclipse.jkube.kit.build.service.docker.access.log.LogOutputSpecFactory) ClusterAccess(org.eclipse.jkube.kit.config.access.ClusterAccess) ImageConfigResolver(org.eclipse.jkube.kit.build.service.docker.config.handler.ImageConfigResolver) IOException(java.io.IOException)

Aggregations

ClusterAccess (org.eclipse.jkube.kit.config.access.ClusterAccess)11 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)2 IOException (java.io.IOException)2 LogOutputSpecFactory (org.eclipse.jkube.kit.build.service.docker.access.log.LogOutputSpecFactory)2 Test (org.junit.Test)2 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)1 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)1 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)1 PipedInputStream (java.io.PipedInputStream)1 PipedOutputStream (java.io.PipedOutputStream)1 AuthConfigFactory (org.eclipse.jkube.kit.build.service.docker.auth.AuthConfigFactory)1 ImageConfigResolver (org.eclipse.jkube.kit.build.service.docker.config.handler.ImageConfigResolver)1 WatchException (org.eclipse.jkube.kit.build.service.docker.watch.WatchException)1 JKubeConfiguration (org.eclipse.jkube.kit.common.JKubeConfiguration)1 KitLogger (org.eclipse.jkube.kit.common.KitLogger)1 MigrateService (org.eclipse.jkube.kit.common.service.MigrateService)1 AnsiLogger (org.eclipse.jkube.kit.common.util.AnsiLogger)1 ImageConfiguration (org.eclipse.jkube.kit.config.image.ImageConfiguration)1 KubernetesUndeployService (org.eclipse.jkube.kit.config.service.kubernetes.KubernetesUndeployService)1 OpenshiftUndeployService (org.eclipse.jkube.kit.config.service.openshift.OpenshiftUndeployService)1