Skip to content

Commit

Permalink
Add values.yaml to help discover default values. (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcomte authored Jul 17, 2024
1 parent 66ed9c1 commit 7f43176
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ public void extractDataFromTgz(InputStream in, Chart chart) throws IOException {
}
chart.setConfig(mapper.readTree(baos.toString("UTF-8")));
}
if (entry.getName().endsWith(chart.getName() + "/values.yaml")
&& !entry.getName()
.endsWith("charts/" + chart.getName() + "/values.yaml")) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
while ((len = tarIn.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
byte[] fileContent = baos.toByteArray();
chart.setDefaultValues(new String(fileContent));
}
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions onyxia-model/src/main/java/fr/insee/onyxia/model/helm/Chart.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ public class Chart extends Pkg {

@JsonIgnore private Map<String, Object> additionalProperties = new HashMap<String, Object>();

@Schema(description = "")
@JsonProperty("defaultValues")
private String defaultValues;

@JsonProperty("apiVersion")
public String getApiVersion() {
return apiVersion;
Expand Down Expand Up @@ -239,6 +243,16 @@ public void setVersion(String version) {
this.version = version;
}

@JsonProperty("defaultValues")
public String getDefaultValues() {
return defaultValues;
}

@JsonProperty("defaultValues")
public void setDefaultValues(String defaultValues) {
this.defaultValues = defaultValues;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
Expand Down

0 comments on commit 7f43176

Please sign in to comment.