Skip to content

Commit a9a32c4

Browse files
authored
feat: parallelize Helm chart generation (#782)
* feat: parallelize Helm chart generation Signed-off-by: Chris Laprun <[email protected]> * feat: use own Helm model (from dekorate) to avoid depending on dekorate Signed-off-by: Chris Laprun <[email protected]> --------- Signed-off-by: Chris Laprun <[email protected]>
1 parent 4fd5772 commit a9a32c4

File tree

10 files changed

+747
-165
lines changed

10 files changed

+747
-165
lines changed

core/deployment/pom.xml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,6 @@
5151
<artifactId>semver4j</artifactId>
5252
<version>5.2.2</version>
5353
</dependency>
54-
<dependency>
55-
<groupId>io.dekorate</groupId>
56-
<artifactId>helm-annotations</artifactId>
57-
<classifier>noapt</classifier>
58-
<exclusions>
59-
<exclusion>
60-
<groupId>io.sundr</groupId>
61-
<artifactId>*</artifactId>
62-
</exclusion>
63-
<exclusion>
64-
<groupId>com.sun</groupId>
65-
<artifactId>tools</artifactId>
66-
</exclusion>
67-
</exclusions>
68-
</dependency>
6954
<dependency>
7055
<groupId>io.dekorate</groupId>
7156
<artifactId>kubernetes-annotations</artifactId>

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

Lines changed: 0 additions & 25 deletions
This file was deleted.

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

Lines changed: 115 additions & 125 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.quarkiverse.operatorsdk.deployment.helm;
2+
3+
import java.util.function.BooleanSupplier;
4+
5+
import io.quarkiverse.operatorsdk.runtime.BuildTimeOperatorConfiguration;
6+
7+
class HelmGenerationEnabled implements BooleanSupplier {
8+
private BuildTimeOperatorConfiguration config;
9+
10+
@Override
11+
public boolean getAsBoolean() {
12+
return config.helm.enabled;
13+
}
14+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package io.quarkiverse.operatorsdk.deployment.helm;
2+
3+
import static io.quarkiverse.operatorsdk.deployment.helm.HelmChartProcessor.TEMPLATES_DIR;
4+
5+
import java.io.File;
6+
import java.nio.file.Path;
7+
8+
import io.quarkus.builder.item.SimpleBuildItem;
9+
10+
final class HelmTargetDirectoryBuildItem extends SimpleBuildItem {
11+
private final Path helmDir;
12+
private final Path templatesDir;
13+
14+
HelmTargetDirectoryBuildItem(File helmDir) {
15+
this.helmDir = helmDir.toPath();
16+
this.templatesDir = Path.of(helmDir.getPath(), TEMPLATES_DIR);
17+
}
18+
19+
public File getHelmDir() {
20+
return helmDir.toFile();
21+
}
22+
23+
public Path getPathToHelmDir() {
24+
return helmDir;
25+
}
26+
27+
public Path getPathToTemplatesDir() {
28+
return templatesDir;
29+
}
30+
}
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
/**
2+
* Copyright 2018 The original authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
**/
17+
package io.quarkiverse.operatorsdk.deployment.helm.model;
18+
19+
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY;
20+
21+
import java.util.List;
22+
import java.util.Map;
23+
24+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
25+
import com.fasterxml.jackson.annotation.JsonInclude;
26+
import com.fasterxml.jackson.annotation.JsonProperty;
27+
28+
/**
29+
* Represents the <a href="https://github.com/helm/helm">Helm</a>
30+
* <a href="https://github.com/helm/helm/blob/v3.10.1/pkg/chart/metadata.go">Chart.yaml file</a>
31+
*/
32+
@JsonInclude(NON_EMPTY)
33+
@JsonIgnoreProperties(ignoreUnknown = true)
34+
public class Chart {
35+
@JsonProperty
36+
private String name;
37+
@JsonProperty
38+
private String home;
39+
@JsonProperty
40+
private List<String> sources;
41+
@JsonProperty
42+
private String version;
43+
@JsonProperty
44+
private String description;
45+
@JsonProperty
46+
private List<String> keywords;
47+
@JsonProperty
48+
private List<Maintainer> maintainers;
49+
@JsonProperty
50+
private String icon;
51+
@JsonProperty
52+
private String apiVersion;
53+
@JsonProperty
54+
private String condition;
55+
@JsonProperty
56+
private String tags;
57+
@JsonProperty
58+
private String appVersion;
59+
@JsonProperty
60+
private Boolean deprecated;
61+
@JsonProperty
62+
private Map<String, String> annotations;
63+
@JsonProperty
64+
private String kubeVersion;
65+
@JsonProperty
66+
private List<HelmDependency> dependencies;
67+
@JsonProperty
68+
private String type;
69+
70+
public String getVersion() {
71+
return version;
72+
}
73+
74+
public void setVersion(String version) {
75+
this.version = version;
76+
}
77+
78+
public String getName() {
79+
return name;
80+
}
81+
82+
public void setName(String name) {
83+
this.name = name;
84+
}
85+
86+
public String getDescription() {
87+
return description;
88+
}
89+
90+
public void setDescription(String description) {
91+
this.description = description;
92+
}
93+
94+
public List<HelmDependency> getDependencies() {
95+
return dependencies;
96+
}
97+
98+
public void setDependencies(List<HelmDependency> dependencies) {
99+
this.dependencies = dependencies;
100+
}
101+
102+
public List<Maintainer> getMaintainers() {
103+
return maintainers;
104+
}
105+
106+
public void setMaintainers(List<Maintainer> maintainers) {
107+
this.maintainers = maintainers;
108+
}
109+
110+
public String getApiVersion() {
111+
return apiVersion;
112+
}
113+
114+
public void setApiVersion(String apiVersion) {
115+
this.apiVersion = apiVersion;
116+
}
117+
118+
public List<String> getKeywords() {
119+
return keywords;
120+
}
121+
122+
public String getCondition() {
123+
return condition;
124+
}
125+
126+
public void setCondition(String condition) {
127+
this.condition = condition;
128+
}
129+
130+
public String getTags() {
131+
return tags;
132+
}
133+
134+
public void setTags(String tags) {
135+
this.tags = tags;
136+
}
137+
138+
public void setKeywords(List<String> keywords) {
139+
this.keywords = keywords;
140+
}
141+
142+
public List<String> getSources() {
143+
return sources;
144+
}
145+
146+
public void setSources(List<String> sources) {
147+
this.sources = sources;
148+
}
149+
150+
public String getHome() {
151+
return home;
152+
}
153+
154+
public void setHome(String home) {
155+
this.home = home;
156+
}
157+
158+
public String getIcon() {
159+
return icon;
160+
}
161+
162+
public void setIcon(String icon) {
163+
this.icon = icon;
164+
}
165+
166+
public String getAppVersion() {
167+
return appVersion;
168+
}
169+
170+
public void setAppVersion(String appVersion) {
171+
this.appVersion = appVersion;
172+
}
173+
174+
public Boolean getDeprecated() {
175+
return deprecated;
176+
}
177+
178+
public void setDeprecated(Boolean deprecated) {
179+
this.deprecated = deprecated;
180+
}
181+
182+
public Map<String, String> getAnnotations() {
183+
return annotations;
184+
}
185+
186+
public void setAnnotations(Map<String, String> annotations) {
187+
this.annotations = annotations;
188+
}
189+
190+
public String getKubeVersion() {
191+
return kubeVersion;
192+
}
193+
194+
public void setKubeVersion(String kubeVersion) {
195+
this.kubeVersion = kubeVersion;
196+
}
197+
198+
public String getType() {
199+
return type;
200+
}
201+
202+
public void setType(String type) {
203+
this.type = type;
204+
}
205+
206+
@Override
207+
public String toString() {
208+
return "Chart{" +
209+
"name='" + name + '\'' +
210+
", home='" + home + '\'' +
211+
", version='" + version + '\'' +
212+
'}';
213+
}
214+
215+
}

0 commit comments

Comments
 (0)