Add facility for rendering Helm charts
This facility renders a Helm chart with the provided values and parses it into a list of Kuberenets runtime.Objects.
Example usage:
package main
import (
"fmt"
"log"
"os"
"gitlab.com/gitlab-org/gl-openshift/gitlab-operator/pkg/helm"
"k8s.io/apimachinery/pkg/runtime"
core "k8s.io/api/core/v1"
_ "k8s.io/client-go/plugin/pkg/client/auth"
)
func main() {
v := helm.EmptyValues()
v.AddValue("certmanager-issuer.email", "me@example.com")
t := helm.NewTemplate("path/to/chart")
t.DisableHooks()
warnings, err := t.Load(v)
if warnings != nil {
for _, warn := range warnings {
log.Printf("WARNING: %+v", warn)
}
}
if err != nil {
log.Printf("%+v", err)
os.Exit(1)
}
t.EditObjects(helm.ServiceSelector, helm.NewServiceEditor(
func(s *core.Service) error {
// doStuff
return nil
})
)
for _, obj := range t.Objects() {
// doStuff
}
}
Closes #2 (closed)
Edited by Hossein Pursultani