Created
May 8, 2022 22:03
-
-
Save jwillker/53fb69ae8709233bb2d78ee0b6a86929 to your computer and use it in GitHub Desktop.
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
// Render receive helm parameters and render a k8s object | |
func Render(t *testing.T, helmChartPath, templateFile, release string, values map[string]string, k8sObject interface{}) error { | |
// Passing values to helm chart. | |
options := &helm.Options{ | |
SetValues: values, | |
} | |
templateFile = fmt.Sprintf("templates/%s", templateFile) | |
output, err := helm.RenderTemplateE(t, options, helmChartPath, release, []string{templateFile}) | |
if err != nil { | |
return err | |
} | |
// ensure the k8s object is rendered correctly. | |
err = helm.UnmarshalK8SYamlE(t, output, &k8sObject) | |
if err != nil { | |
return err | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment