use of org.eclipse.jkube.kit.enricher.api.model.Configuration in project jkube by eclipse.
the class WildflyJARHealthCheckEnricherTest method setupExpectations.
private void setupExpectations(JavaProject project, Map<String, Object> bootableJarconfig, Map<String, Map<String, Object>> jkubeConfig) {
Plugin plugin = Plugin.builder().artifactId(WildflyJARHealthCheckEnricher.BOOTABLE_JAR_ARTIFACT_ID).groupId(WildflyJARHealthCheckEnricher.BOOTABLE_JAR_GROUP_ID).configuration(bootableJarconfig).build();
List<Plugin> lst = new ArrayList<>();
lst.add(plugin);
ProcessorConfig c = new ProcessorConfig(null, null, jkubeConfig);
new Expectations() {
{
project.getPlugins();
result = lst;
context.getProject();
result = project;
Configuration.ConfigurationBuilder configBuilder = Configuration.builder();
configBuilder.processorConfig(c);
context.getConfiguration();
result = configBuilder.build();
}
};
}
use of org.eclipse.jkube.kit.enricher.api.model.Configuration in project jkube by eclipse.
the class RevisionHistoryEnricherTest method testCustomRevisionHistoryLimit.
@Test
public void testCustomRevisionHistoryLimit() throws JsonProcessingException {
// Setup mock behaviour
final String revisionNumber = "10";
new Expectations() {
{
Configuration config = Configuration.builder().processorConfig(prepareEnricherConfig(revisionNumber)).build();
context.getConfiguration();
result = config;
}
};
// Given
KubernetesListBuilder builder = new KubernetesListBuilder().addToItems(new DeploymentBuilder().build());
RevisionHistoryEnricher enricher = new RevisionHistoryEnricher(context);
// When
enricher.create(PlatformMode.kubernetes, builder);
// Then
assertRevisionHistory(builder.build(), Integer.parseInt(revisionNumber));
}
use of org.eclipse.jkube.kit.enricher.api.model.Configuration in project jkube by eclipse.
the class DefaultServiceEnricherTest method serviceImageLabelEnrichment.
@Test
public void serviceImageLabelEnrichment() throws Exception {
ImageConfiguration imageConfigurationWithLabels = ImageConfiguration.builder().name("test-label").alias("test").build();
final TreeMap<String, Object> config = new TreeMap<>();
config.put("type", "LoadBalancer");
new Expectations() {
{
Configuration configuration = Configuration.builder().image(imageConfigurationWithLabels).processorConfig(new ProcessorConfig(null, null, Collections.singletonMap("jkube-service", config))).build();
groupArtifactVersion.getSanitizedArtifactId();
result = "jkube-service";
context.getConfiguration();
result = configuration;
imageConfigurationWithLabels.getBuildConfiguration();
result = BuildConfiguration.builder().labels(Collections.singletonMap("jkube.generator.service.ports", "9090")).ports(Arrays.asList("80", "53/UDP")).build();
}
};
String json = enrich();
assertPort(json, 0, 9090, 9090, "http", "TCP");
}
use of org.eclipse.jkube.kit.enricher.api.model.Configuration in project jkube by eclipse.
the class DockerRegistrySecretEnricher method generateData.
@Override
protected Map<String, String> generateData(String dockerId) {
final Configuration config = getContext().getConfiguration();
final Optional<Map<String, Object>> secretConfig = config.getSecretConfiguration(dockerId);
if (!secretConfig.isPresent()) {
return null;
}
JsonObject params = new JsonObject();
for (String key : new String[] { "username", "password", "email" }) {
if (secretConfig.get().containsKey(key)) {
params.add(key, new JsonPrimitive(secretConfig.get().get(key).toString()));
}
}
JsonObject ret = new JsonObject();
ret.add(dockerId, params);
return Collections.singletonMap(SecretConstants.DOCKER_DATA_KEY, encode(ret.toString()));
}
Aggregations