use of org.eclipse.jkube.kit.enricher.api.JKubeEnricherContext in project jkube by eclipse.
the class WildflyJARHealthCheckEnricher method isAvailable.
private boolean isAvailable() {
if (isProbeEnforced()) {
return true;
}
JavaProject project = ((JKubeEnricherContext) getContext()).getProject();
Plugin plugin = JKubeProjectUtil.getPlugin(project, BOOTABLE_JAR_GROUP_ID, BOOTABLE_JAR_ARTIFACT_ID);
if (plugin == null) {
return false;
}
Map<String, Object> config = plugin.getConfiguration();
return config.containsKey("cloud");
}
use of org.eclipse.jkube.kit.enricher.api.JKubeEnricherContext in project jkube by eclipse.
the class MavenIssueManagementEnricher method getAnnotations.
private Map<String, String> getAnnotations() {
Map<String, String> annotations = new HashMap<>();
if (getContext() instanceof JKubeEnricherContext) {
JKubeEnricherContext jkubeEnricherContext = (JKubeEnricherContext) getContext();
JavaProject rootProject = jkubeEnricherContext.getProject();
if (hasIssueManagement(rootProject)) {
String system = rootProject.getIssueManagementSystem();
String url = rootProject.getIssueManagementUrl();
if (StringUtils.isNotEmpty(system) && StringUtils.isNotEmpty(url)) {
annotations.put(JKubeAnnotations.ISSUE_SYSTEM.value(), system);
annotations.put(JKubeAnnotations.ISSUE_TRACKER_URL.value(), url);
}
}
}
return annotations;
}
use of org.eclipse.jkube.kit.enricher.api.JKubeEnricherContext in project jkube by eclipse.
the class MavenScmEnricher method getAnnotations.
private Map<String, String> getAnnotations() {
Map<String, String> annotations = new HashMap<>();
if (getContext() instanceof JKubeEnricherContext) {
JKubeEnricherContext jkubeEnricherContext = (JKubeEnricherContext) getContext();
JavaProject rootProject = jkubeEnricherContext.getProject();
if (hasScm(rootProject)) {
String url = rootProject.getScmUrl();
String tag = rootProject.getScmTag();
if (StringUtils.isNotEmpty(tag)) {
annotations.put(JKubeAnnotations.SCM_TAG.value(), tag);
}
if (StringUtils.isNotEmpty(url)) {
annotations.put(JKubeAnnotations.SCM_URL.value(), url);
}
}
}
return annotations;
}
use of org.eclipse.jkube.kit.enricher.api.JKubeEnricherContext in project jkube by eclipse.
the class SecretEnricher method addSecretsFromXmlConfiguration.
private void addSecretsFromXmlConfiguration(KubernetesListBuilder builder) {
log.verbose("Adding secrets resources from plugin configuration");
List<SecretConfig> secrets = getSecretsFromXmlConfig();
Map<String, Integer> secretToIndexMap = new HashMap<>();
if (secrets == null || secrets.isEmpty()) {
return;
}
for (Integer index = 0; index < builder.buildItems().size(); index++) {
if (builder.buildItems().get(index) instanceof Secret) {
secretToIndexMap.put(builder.buildItems().get(index).getMetadata().getName(), index);
}
}
for (int i = 0; i < secrets.size(); i++) {
SecretConfig secretConfig = secrets.get(i);
if (StringUtils.isBlank(secretConfig.getName())) {
log.warn("Secret name is empty. You should provide a proper name for the secret");
continue;
}
Map<String, String> data = new HashMap<>();
String type = "";
ObjectMeta metadata = new ObjectMetaBuilder().withNamespace(secretConfig.getNamespace()).withName(secretConfig.getName()).build();
// docker-registry
if (secretConfig.getDockerServerId() != null) {
JKubeEnricherContext mavenContext = ((JKubeEnricherContext) getContext());
String dockerSecret = (mavenContext).getDockerJsonConfigString(mavenContext.getSettings(), secretConfig.getDockerServerId());
if (StringUtils.isBlank(dockerSecret)) {
log.warn("Docker secret with id " + secretConfig.getDockerServerId() + " cannot be found in maven settings");
continue;
}
data.put(SecretConstants.DOCKER_DATA_KEY, Base64Util.encodeToString(dockerSecret));
type = SecretConstants.DOCKER_CONFIG_TYPE;
}
if (StringUtils.isBlank(type) || data.isEmpty()) {
log.warn("No data can be found for docker secret with id " + secretConfig.getDockerServerId());
continue;
}
Secret secret = new SecretBuilder().withData(data).withMetadata(metadata).withType(type).build();
if (!secretToIndexMap.containsKey(secretConfig.getName())) {
builder.addToSecretItems(i, secret);
}
}
}
Aggregations