Skip to content

Commit

Permalink
Added Helm chart release adapter for EAP XP 5 (#181)
Browse files Browse the repository at this point in the history
* Added Helm chart release adapter for EAP XP 5
  • Loading branch information
honza-kasik authored Jul 19, 2024
1 parent d37b065 commit 6aa21fc
Show file tree
Hide file tree
Showing 8 changed files with 2,257 additions and 546 deletions.
13 changes: 13 additions & 0 deletions provisioners/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,19 @@
<targetPackage>org.jboss.intersmash.model.helm.charts.values.eap8</targetPackage>
</configuration>
</execution>
<execution>
<id>charts.values.generate-schema-model.xp5</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- JBoss EAP XP 5 Helm Chart model is generated from JSON schema at https://github.com/jbossas/eap-charts/eap-xp5-dev/charts/eap-xp5/values.schema.json -->
<sourceDirectory>${basedir}/src/main/resources/org/jboss/intersmash/provision/helm/values/schema/xp5</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources/</outputDirectory>
<targetPackage>org.jboss.intersmash.model.helm.charts.values.xp5</targetPackage>
</configuration>
</execution>

</executions>
</plugin>
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,40 @@ public WildflyHelmChartRelease withS2iChannel(String s2iChannel) {

@Override
public BuildMode getBuildMode() {
return adaptee.getBuild() == null ? null
: adaptee.getBuild().getS2i() != null ? BuildMode.S2I
: adaptee.getBuild().getBootableJar() != null ? BuildMode.BOOTABLE_JAR : null;
if (adaptee.getBuild() == null || adaptee.getBuild().getMode() == null) {
return null;
}
switch (adaptee.getBuild().getMode()) {
case S_2_I:
return BuildMode.S2I;
case BOOTABLE_JAR:
return BuildMode.BOOTABLE_JAR;
default:
return null;
}
}

@Override
public void setBuildMode(BuildMode buildMode) {
if (adaptee.getBuild() == null) {
adaptee.setBuild(new Build());
}
switch (buildMode) {
case S2I:
adaptee.getBuild().setMode(Build.Mode.S_2_I);
break;
case BOOTABLE_JAR:
adaptee.getBuild().setMode(Build.Mode.BOOTABLE_JAR);
break;
default:
log.warn("Unrecognized build mode option, not doing anything.");
}
}

@Override
public WildflyHelmChartRelease withBuildMode(BuildMode buildMode) {
this.setBuildMode(buildMode);
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public interface WildflyHelmChartRelease extends HelmChartRelease {

BuildMode getBuildMode();

void setBuildMode(BuildMode buildMode);

WildflyHelmChartRelease withBuildMode(BuildMode buildMode);

String getBootableJarBuilderImage();

void setBootableJarBuilderImage(String bootableJarBuilderImage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* This adapter is compliant with the contract which is required by the
* {@link org.jboss.intersmash.provision.helm.HelmChartOpenShiftProvisioner} logic, i.e. to
* implement {@link HelmChartRelease}, and allows for us to leverage a generated
* {@link Eap8HelmChartReleaseAdapter#adaptee}, i.e. in terms of UX, provide native release YAML definitions.
* {@link org.jboss.intersmash.provision.helm.wildfly.eap8.Eap8HelmChartReleaseAdapter#adaptee}, i.e. in terms of UX, provide native release YAML definitions.
*/
@Slf4j
public class Eap8HelmChartReleaseAdapter extends HelmChartReleaseAdapter<HelmEap8Release>
Expand Down Expand Up @@ -526,6 +526,27 @@ public BuildMode getBuildMode() {
return BuildMode.S2I;
}

@Override
public void setBuildMode(BuildMode buildMode) {
if (adaptee.getBuild() == null) {
adaptee.setBuild(new Build());
}
switch (buildMode) {
case S2I:
adaptee.getBuild().setMode(Build.Mode.S_2_I);
case BOOTABLE_JAR:
log.warn("EAP 8 does not support bootable JAR build mode!");
default:
adaptee.getBuild().setMode(null);
}
}

@Override
public WildflyHelmChartRelease withBuildMode(BuildMode buildMode) {
this.setBuildMode(buildMode);
return this;
}

@Override
public String getBootableJarBuilderImage() {
// no Bootable JAR image is supported by EAP 8 Helm Charts
Expand Down
Loading

0 comments on commit 6aa21fc

Please sign in to comment.