mirror of
https://github.com/helm/helm.git
synced 2026-08-04 15:10:47 +00:00
Implement 'exports' convetion for simple list items
This commit is contained in:
@@ -351,7 +351,7 @@ func processImportValues(c *chart.Chart, v *chart.Config) error {
|
||||
}
|
||||
case string:
|
||||
nm := make(map[string]string)
|
||||
nm["child"] = riv.(string)
|
||||
nm["child"] = "exports." + riv.(string)
|
||||
nm["parent"] = "."
|
||||
outiv = append(outiv, nm)
|
||||
s := r.Name + "." + nm["child"]
|
||||
|
||||
@@ -226,6 +226,12 @@ func TestProcessRequirementsImportValues(t *testing.T) {
|
||||
e["imported-from-chartA-via-chart1.limits.memory"] = "300Mi"
|
||||
e["imported-from-chartA-via-chart1.limits.volume"] = "11"
|
||||
e["imported-from-chartA-via-chart1.requests.truthiness"] = "0.01"
|
||||
// single list items (looks for exports. parent key)
|
||||
e["imported-from-chartB-via-chart1.databint"] = "1"
|
||||
e["imported-from-chartB-via-chart1.databstr"] = "x.y.z"
|
||||
e["parent1c3"] = "true"
|
||||
// checks that a chartb value was merged in with charta values
|
||||
e["imported-from-chartA-via-chart1.resources.limits.shares"] = "100"
|
||||
|
||||
verifyRequirementsImportValues(t, c, v, e)
|
||||
}
|
||||
@@ -254,6 +260,12 @@ func verifyRequirementsImportValues(t *testing.T, c *chart.Chart, v *chart.Confi
|
||||
t.Errorf("Failed to match imported float value %v with expected %v", s, vv)
|
||||
return
|
||||
}
|
||||
case bool:
|
||||
b := strconv.FormatBool(pv.(bool))
|
||||
if b != vv {
|
||||
t.Errorf("Failed to match imported bool value %v with expected %v", b, vv)
|
||||
return
|
||||
}
|
||||
default:
|
||||
if pv.(string) != vv {
|
||||
t.Errorf("Failed to match imported string value %v with expected %v", pv, vv)
|
||||
|
||||
@@ -18,4 +18,12 @@ resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
|
||||
exports:
|
||||
convention1:
|
||||
data:
|
||||
databint: 1
|
||||
databstr: x.y.z
|
||||
convention2:
|
||||
resources:
|
||||
limits:
|
||||
shares: 100
|
||||
|
||||
@@ -16,6 +16,9 @@ dependencies:
|
||||
repository: http://localhost:10191
|
||||
version: 0.1.0
|
||||
condition: subchartb.enabled
|
||||
import-values:
|
||||
- convention1
|
||||
- convention2
|
||||
tags:
|
||||
- front-end
|
||||
- subchartb
|
||||
|
||||
@@ -21,4 +21,7 @@ resources:
|
||||
cpu: 250m
|
||||
memory: 250Mi
|
||||
truthiness: 200
|
||||
exports:
|
||||
convention3:
|
||||
parent1c3: true
|
||||
|
||||
|
||||
@@ -11,6 +11,12 @@ dependencies:
|
||||
parent: imported-from-chart1
|
||||
- child: imported-from-chartA
|
||||
parent: imported-from-chartA-via-chart1
|
||||
- convention3
|
||||
# this merges chartb "shares" into charta "limits"
|
||||
- child: resources.limits
|
||||
parent: imported-from-chartA-via-chart1.resources.limits
|
||||
- child: data
|
||||
parent: imported-from-chartB-via-chart1
|
||||
- name: subchart2
|
||||
repository: http://localhost:10191
|
||||
version: 0.1.0
|
||||
|
||||
Reference in New Issue
Block a user