use of io.dekorate.openshift.decorator.AddRouteDecorator in project dekorate by dekorateio.
the class OpenshiftManifestGenerator method addDecorators.
protected void addDecorators(String group, OpenshiftConfig config, ImageConfiguration imageConfig) {
super.addDecorators(group, config);
if (config.getReplicas() != 1) {
resourceRegistry.decorate(group, new ApplyReplicasDecorator(config.getName(), config.getReplicas()));
}
resourceRegistry.decorate(group, new ApplyDeploymentTriggerDecorator(config.getName(), imageConfig.getName() + ":" + imageConfig.getVersion()));
resourceRegistry.decorate(group, new AddRouteDecorator(config));
if (config.hasAttribute(RUNTIME_TYPE)) {
resourceRegistry.decorate(group, new AddLabelDecorator(config.getName(), new Label(OpenshiftLabels.RUNTIME, config.getAttribute(RUNTIME_TYPE), new String[0])));
}
resourceRegistry.decorate(group, new RemoveAnnotationDecorator(config.getName(), Annotations.VCS_URL));
Project project = getProject();
Optional<VcsConfig> vcsConfig = configurationRegistry.get(VcsConfig.class);
String remote = vcsConfig.map(VcsConfig::getRemote).orElse(Git.ORIGIN);
boolean httpsPrefered = vcsConfig.map(VcsConfig::isHttpsPreferred).orElse(false);
String vcsUrl = project.getScmInfo() != null && Strings.isNotNullOrEmpty(project.getScmInfo().getRemote().get(Git.ORIGIN)) ? Git.getRemoteUrl(project.getRoot(), remote, httpsPrefered).orElse(Labels.UNKNOWN) : Labels.UNKNOWN;
resourceRegistry.decorate(group, new AddVcsUrlAnnotationDecorator(config.getName(), OpenshiftAnnotations.VCS_URL, vcsUrl));
resourceRegistry.decorate(group, new AddCommitIdAnnotationDecorator());
}
Aggregations