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");
}
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");
}
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));
}
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();
}
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());
}
}
Aggregations