generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for additional kubernetes resource in helm charts (#769)
* fix: add rest of resources to helm resources Signed-off-by: Attila Mészáros <csviri@gmail.com> * impl Signed-off-by: Attila Mészáros <csviri@gmail.com> * filtering fixes Signed-off-by: Attila Mészáros <csviri@gmail.com> * revert test changes Signed-off-by: Attila Mészáros <csviri@gmail.com> * refactor: make build step conditional Signed-off-by: Chris Laprun <claprun@redhat.com> * refactor: make deserialization of kube resources a separate step This allows for this to happen only once as needed and could be done in parallel to other build steps. Signed-off-by: Chris Laprun <claprun@redhat.com> --------- Signed-off-by: Attila Mészáros <csviri@gmail.com> Signed-off-by: Chris Laprun <claprun@redhat.com> Co-authored-by: Chris Laprun <claprun@redhat.com>
- Loading branch information
Showing
4 changed files
with
186 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...main/java/io/quarkiverse/operatorsdk/common/DeserializedKubernetesResourcesBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.quarkiverse.operatorsdk.common; | ||
|
||
import java.util.List; | ||
|
||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.quarkus.builder.item.SimpleBuildItem; | ||
|
||
public final class DeserializedKubernetesResourcesBuildItem extends SimpleBuildItem { | ||
private final List<HasMetadata> resources; | ||
|
||
public DeserializedKubernetesResourcesBuildItem(List<HasMetadata> resources) { | ||
this.resources = resources; | ||
} | ||
|
||
public List<HasMetadata> getResources() { | ||
return resources; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ain/java/io/quarkiverse/operatorsdk/deployment/GeneratedKubernetesManifestsProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.quarkiverse.operatorsdk.deployment; | ||
|
||
import java.util.List; | ||
import java.util.function.BooleanSupplier; | ||
|
||
import org.eclipse.microprofile.config.ConfigProvider; | ||
|
||
import io.quarkiverse.operatorsdk.common.DeserializedKubernetesResourcesBuildItem; | ||
import io.quarkiverse.operatorsdk.common.GeneratedResourcesUtils; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.kubernetes.spi.GeneratedKubernetesResourceBuildItem; | ||
|
||
public class GeneratedKubernetesManifestsProcessor { | ||
private static class NeedResourcesDeserialization implements BooleanSupplier { | ||
@Override | ||
public boolean getAsBoolean() { | ||
final var helmEnabled = ConfigProvider.getConfig() | ||
.getOptionalValue("quarkus.operator-sdk.helm.enabled", Boolean.class).orElse(false); | ||
final var bundleEnabled = ConfigProvider.getConfig() | ||
.getOptionalValue("quarkus.operator-sdk.bundle.enabled", Boolean.class).orElse(false); | ||
return helmEnabled || bundleEnabled; | ||
} | ||
} | ||
|
||
@BuildStep(onlyIf = NeedResourcesDeserialization.class) | ||
DeserializedKubernetesResourcesBuildItem deserializeGeneratedKubernetesResources( | ||
List<GeneratedKubernetesResourceBuildItem> generatedResources) { | ||
return new DeserializedKubernetesResourcesBuildItem(GeneratedResourcesUtils.loadFrom(generatedResources)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters