Skip to content

Commit 9e25e9c

Browse files
committed
feat: configure Helm chart name with quarkus.operator-sdk.helm.name
Fixes #1075 (cherry picked from commit 449af47)
1 parent c3a8d2d commit 9e25e9c

File tree

4 files changed

+59
-5
lines changed

4 files changed

+59
-5
lines changed

core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/helm/HelmChartProcessor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import io.quarkiverse.operatorsdk.deployment.GeneratedCRDInfoBuildItem;
2929
import io.quarkiverse.operatorsdk.deployment.RoleBindings;
3030
import io.quarkiverse.operatorsdk.deployment.helm.model.Chart;
31+
import io.quarkiverse.operatorsdk.runtime.BuildTimeOperatorConfiguration;
3132
import io.quarkus.deployment.annotations.BuildStep;
3233
import io.quarkus.deployment.annotations.BuildSteps;
3334
import io.quarkus.deployment.annotations.Produce;
@@ -64,8 +65,12 @@ public class HelmChartProcessor {
6465
public static final String ADDITIONAL_CRD_ROLE_BINDING_YAML = "additional-crd-role-binding.yaml";
6566

6667
@BuildStep
67-
HelmTargetDirectoryBuildItem createRelatedDirectories(OutputTargetBuildItem outputTarget) {
68-
final var helmDir = outputTarget.getOutputDirectory().resolve("helm").toFile();
68+
HelmTargetDirectoryBuildItem createRelatedDirectories(BuildTimeOperatorConfiguration config,
69+
OutputTargetBuildItem outputTarget) {
70+
final var helmDir = outputTarget.getOutputDirectory()
71+
.resolve("helm")
72+
.resolve(config.helm().name().orElse(""))
73+
.toFile();
6974
log.infov("Generating helm chart to {0}", helmDir);
7075
FileUtils.ensureDirectoryExists(helmDir);
7176
FileUtils.ensureDirectoryExists(new File(helmDir, TEMPLATES_DIR));
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
package io.quarkiverse.operatorsdk.runtime;
22

3+
import java.util.Optional;
4+
35
import io.quarkus.runtime.annotations.ConfigGroup;
46
import io.smallrye.config.WithDefault;
57

68
@ConfigGroup
79
public interface HelmConfiguration {
810

911
/**
10-
* Can be used to disable helm chart generation.
12+
* Can be used to disable Helm chart generation.
1113
*/
1214
@WithDefault("false")
1315
Boolean enabled();
1416

17+
/**
18+
* Specifies the name of the generated Helm chart. This will generate the Helm chart in {@code target/helm/<name>} instead
19+
* of {@code target/helm} directly, if specified.
20+
*/
21+
Optional<String> name();
1522
}

docs/modules/ROOT/pages/includes/quarkus-operator-sdk.adoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ endif::add-copy-button-to-config-props[]
424424

425425
[.description]
426426
--
427-
Can be used to disable helm chart generation.
427+
Can be used to disable Helm chart generation.
428428

429429

430430
ifdef::add-copy-button-to-env-var[]
@@ -437,6 +437,27 @@ endif::add-copy-button-to-env-var[]
437437
|boolean
438438
|`false`
439439

440+
a|icon:lock[title=Fixed at build time] [[quarkus-operator-sdk_quarkus-operator-sdk-helm-name]] [.property-path]##link:#quarkus-operator-sdk_quarkus-operator-sdk-helm-name[`quarkus.operator-sdk.helm.name`]##
441+
ifdef::add-copy-button-to-config-props[]
442+
config_property_copy_button:+++quarkus.operator-sdk.helm.name+++[]
443+
endif::add-copy-button-to-config-props[]
444+
445+
446+
[.description]
447+
--
448+
Specifies the name of the generated Helm chart. This will generate the Helm chart in `target/helm/<name>` instead of `target/helm` directly, if specified.
449+
450+
451+
ifdef::add-copy-button-to-env-var[]
452+
Environment variable: env_var_with_copy_button:+++QUARKUS_OPERATOR_SDK_HELM_NAME+++[]
453+
endif::add-copy-button-to-env-var[]
454+
ifndef::add-copy-button-to-env-var[]
455+
Environment variable: `+++QUARKUS_OPERATOR_SDK_HELM_NAME+++`
456+
endif::add-copy-button-to-env-var[]
457+
--
458+
|string
459+
|
460+
440461
a| [[quarkus-operator-sdk_quarkus-operator-sdk-concurrent-reconciliation-threads]] [.property-path]##link:#quarkus-operator-sdk_quarkus-operator-sdk-concurrent-reconciliation-threads[`quarkus.operator-sdk.concurrent-reconciliation-threads`]##
441462
ifdef::add-copy-button-to-config-props[]
442463
config_property_copy_button:+++quarkus.operator-sdk.concurrent-reconciliation-threads+++[]

docs/modules/ROOT/pages/includes/quarkus-operator-sdk_quarkus.operator-sdk.adoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ endif::add-copy-button-to-config-props[]
424424

425425
[.description]
426426
--
427-
Can be used to disable helm chart generation.
427+
Can be used to disable Helm chart generation.
428428

429429

430430
ifdef::add-copy-button-to-env-var[]
@@ -437,6 +437,27 @@ endif::add-copy-button-to-env-var[]
437437
|boolean
438438
|`false`
439439

440+
a|icon:lock[title=Fixed at build time] [[quarkus-operator-sdk_quarkus-operator-sdk-helm-name]] [.property-path]##link:#quarkus-operator-sdk_quarkus-operator-sdk-helm-name[`quarkus.operator-sdk.helm.name`]##
441+
ifdef::add-copy-button-to-config-props[]
442+
config_property_copy_button:+++quarkus.operator-sdk.helm.name+++[]
443+
endif::add-copy-button-to-config-props[]
444+
445+
446+
[.description]
447+
--
448+
Specifies the name of the generated Helm chart. This will generate the Helm chart in `target/helm/<name>` instead of `target/helm` directly, if specified.
449+
450+
451+
ifdef::add-copy-button-to-env-var[]
452+
Environment variable: env_var_with_copy_button:+++QUARKUS_OPERATOR_SDK_HELM_NAME+++[]
453+
endif::add-copy-button-to-env-var[]
454+
ifndef::add-copy-button-to-env-var[]
455+
Environment variable: `+++QUARKUS_OPERATOR_SDK_HELM_NAME+++`
456+
endif::add-copy-button-to-env-var[]
457+
--
458+
|string
459+
|
460+
440461
a| [[quarkus-operator-sdk_quarkus-operator-sdk-concurrent-reconciliation-threads]] [.property-path]##link:#quarkus-operator-sdk_quarkus-operator-sdk-concurrent-reconciliation-threads[`quarkus.operator-sdk.concurrent-reconciliation-threads`]##
441462
ifdef::add-copy-button-to-config-props[]
442463
config_property_copy_button:+++quarkus.operator-sdk.concurrent-reconciliation-threads+++[]

0 commit comments

Comments
 (0)