Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/integration-tests/envs/dev/env-data.ytt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ environment:
- proto: ytt-render-test
name: ytt-installation
- proto: static-test
- proto: helm-myks-context
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#@ load("@ytt:data", "data")
---
outputYaml:
myksContext: #@ data.values.myks.context
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#@ load("@ytt:data", "data")

#@ app = data.values.application
---
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: charts/test-chart-name
contents:
- path: .
directory:
path: ../_lib/charts/render-test-chart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
finalizers:
- resources-finalizer.argocd.argoproj.io
name: app-mykso-dev-helm-myks-context
namespace: system-argocd
spec:
destination:
name: mykso-dev
namespace: helm-myks-context
project: env-mykso-dev
source:
path: examples/integration-tests/rendered/envs/mykso-dev/helm-myks-context
plugin:
name: argocd-vault-plugin-v1.0.0
repoURL: [email protected]:mykso/myks.git
targetRevision: main
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- ServerSideApply=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: rendering
metadata:
name: helm-test-chart-name
outputYaml:
fromChartDefaultValues: true
myksContext:
app: helm-myks-context
helm:
chart: test-chart-name
prototype: prototypes/helm-myks-context
step: render
4 changes: 4 additions & 0 deletions internal/myks/assets/data-schema.ytt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,7 @@ myks:
prototype: ''
#! rendering step: init, argocd, global_ytt, helm, ytt-pkg, ytt
step: ''
#! information related to the helm step
helm:
#! name of the helm chart currently being processed
chart: ''
6 changes: 5 additions & 1 deletion internal/myks/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func genRenderedResourceFileName(resource map[string]any, includeNamespace bool)
// from the `helm` or `ytt` directories of the prototype and the application.
func (a *Application) prepareValuesFile(dirName string, resourceName string) (string, error) {
valuesFileName := filepath.Join(dirName, resourceName+".yaml")
yttArgs := []string{"-v", "myks.context.helm.chart=" + resourceName}

var valuesFiles []string

Expand All @@ -185,7 +186,8 @@ func (a *Application) prepareValuesFile(dirName string, resourceName string) (st
return "", nil
}

resourceValuesYaml, err := a.ytt(renderStepName, "collect data values file", concatenate(a.yttDataFiles, valuesFiles))
// render zero or more yaml documents - values files
resourceValuesYaml, err := a.ytt(renderStepName, "collect data values file", concatenate(a.yttDataFiles, valuesFiles), yttArgs...)
if err != nil {
return "", err
}
Expand All @@ -201,6 +203,8 @@ func (a *Application) prepareValuesFile(dirName string, resourceName string) (st
return "", err
}

// merge previously rendered yaml documents into one,
// in the way Helm would do that with all values files
resourceValues, err := a.mergeValuesYaml(renderStepName, a.expandServicePath(valuesFileName))
if err != nil {
return "", err
Expand Down
Loading