forked from jenkins-x/jx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow
values.yaml
to include go template functions
* also support referencing logical Parameters in a `parameters.yaml` file which can include a logical structure + schema (for nice install tooling) which then contains inline values for simple values or URLs to vault/local secret files for better secret management fixes jenkins-x#4328 Signed-off-by: James Strachan <james.strachan@gmail.com>
- Loading branch information
Showing
18 changed files
with
240 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...est_data/tree_of_values_yaml_templates/local_vault_files/my-cheese-cluster/adminUser.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
password-passthrough: myDockerRegistryPassword |
1 change: 1 addition & 0 deletions
1
...ata/tree_of_values_yaml_templates/local_vault_files/my-cheese-cluster/dockerRegistry.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
password-passthrough: myAdminPassword |
1 change: 1 addition & 0 deletions
1
..._data/tree_of_values_yaml_templates/local_vault_files/my-cheese-cluster/pipelineUser.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
token-passthrough: myPipelineUserToken |
17 changes: 17 additions & 0 deletions
17
pkg/helm/test_data/tree_of_values_yaml_templates/parameters.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
adminUser: | ||
password: local:/my-cheese-cluster/adminUser:password-passthrough | ||
username: admin | ||
docker: | ||
password: local:/my-cheese-cluster/dockerRegistry:password-passthrough | ||
url: https://index.docker.io/v1/ | ||
username: james | ||
enableDocker: true | ||
enableGpg: false | ||
gitProvider: github | ||
pipelineUser: | ||
github: | ||
host: github.com | ||
password: local:/my-cheese-cluster/pipelineUser:token-passthrough | ||
username: james | ||
prow: | ||
hmacToken: abc |
1 change: 1 addition & 0 deletions
1
pkg/helm/test_data/tree_of_values_yaml_templates/prow/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hmacToken: {{ .Parameters.prow.hmacToken }} |
4 changes: 4 additions & 0 deletions
4
pkg/helm/test_data/tree_of_values_yaml_templates/tekton/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
auth: | ||
git: | ||
username: {{ .Parameters.pipelineUser.github.username }} | ||
password: {{ .Parameters.pipelineUser.github.password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dummy: cheese |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package helm_test | ||
|
||
import ( | ||
"path" | ||
"testing" | ||
|
||
"github.com/jenkins-x/jx/pkg/helm" | ||
"github.com/jenkins-x/jx/pkg/secreturl/localvault" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
var expectedTemplatedValuesTree = `dummy: cheese | ||
prow: | ||
hmacToken: abc | ||
tekton: | ||
auth: | ||
git: | ||
password: myPipelineUserToken | ||
username: james | ||
` | ||
|
||
func TestValuesTreeTemplates(t *testing.T) { | ||
t.Parallel() | ||
|
||
testData := path.Join("test_data", "tree_of_values_yaml_templates") | ||
|
||
localVaultDir := path.Join(testData, "local_vault_files") | ||
secretUrlClient := localvault.NewFileSystemClient(localVaultDir) | ||
|
||
result, err := helm.GenerateValues(testData, nil, true, secretUrlClient) | ||
assert.NoError(t, err) | ||
assert.Equal(t, expectedTemplatedValuesTree, string(result)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.