|
|
|
@ -79,6 +79,8 @@ func New(config *rest.Config) Engine {
|
|
|
|
// bar chart during render time.
|
|
|
|
// bar chart during render time.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Deprecated: Use RenderWithContext instead.
|
|
|
|
// Deprecated: Use RenderWithContext instead.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//go:fix inline
|
|
|
|
func (e Engine) Render(chrt ci.Charter, values common.Values) (map[string]string, error) {
|
|
|
|
func (e Engine) Render(chrt ci.Charter, values common.Values) (map[string]string, error) {
|
|
|
|
return e.RenderWithContext(context.Background(), chrt, values)
|
|
|
|
return e.RenderWithContext(context.Background(), chrt, values)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -102,6 +104,8 @@ func (e Engine) Render(chrt ci.Charter, values common.Values) (map[string]string
|
|
|
|
// that section of the values will be passed into the "foo" chart. And if that
|
|
|
|
// that section of the values will be passed into the "foo" chart. And if that
|
|
|
|
// section contains a value named "bar", that value will be passed on to the
|
|
|
|
// section contains a value named "bar", that value will be passed on to the
|
|
|
|
// bar chart during render time.
|
|
|
|
// bar chart during render time.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// TODO Helm v5: Rename this to Render (remove the current deprecated Render method) and 'go:fix inline' RenderWithContext method to call Render.
|
|
|
|
func (e Engine) RenderWithContext(ctx context.Context, chrt ci.Charter, values common.Values) (map[string]string, error) {
|
|
|
|
func (e Engine) RenderWithContext(ctx context.Context, chrt ci.Charter, values common.Values) (map[string]string, error) {
|
|
|
|
tmap := allTemplates(chrt, values)
|
|
|
|
tmap := allTemplates(chrt, values)
|
|
|
|
return e.render(ctx, tmap)
|
|
|
|
return e.render(ctx, tmap)
|
|
|
|
@ -109,28 +113,38 @@ func (e Engine) RenderWithContext(ctx context.Context, chrt ci.Charter, values c
|
|
|
|
|
|
|
|
|
|
|
|
// Render takes a chart, optional values, and value overrides, and attempts to
|
|
|
|
// Render takes a chart, optional values, and value overrides, and attempts to
|
|
|
|
// render the Go templates using the default options.
|
|
|
|
// render the Go templates using the default options.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// Deprecated: Instantiate an Engine and call RenderWithContext instead.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// TODO Helm v5: Replace with a NewEngine function.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//go:fix inline
|
|
|
|
func Render(chrt ci.Charter, values common.Values) (map[string]string, error) {
|
|
|
|
func Render(chrt ci.Charter, values common.Values) (map[string]string, error) {
|
|
|
|
return new(Engine).Render(chrt, values)
|
|
|
|
return new(Engine).RenderWithContext(context.Background(), chrt, values)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RenderWithClient takes a chart, optional values, and value overrides, and attempts to
|
|
|
|
// RenderWithClient takes a chart, optional values, and value overrides, and attempts to
|
|
|
|
// render the Go templates using the default options. This engine is client aware and so can have template
|
|
|
|
// render the Go templates using the default options. This engine is client aware and so can have template
|
|
|
|
// functions that interact with the client.
|
|
|
|
// functions that interact with the client.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// TODO Helm v5: Replace with a NewEngine function that accepts a rest.Config option
|
|
|
|
func RenderWithClient(chrt ci.Charter, values common.Values, config *rest.Config) (map[string]string, error) {
|
|
|
|
func RenderWithClient(chrt ci.Charter, values common.Values, config *rest.Config) (map[string]string, error) {
|
|
|
|
var clientProvider ClientProvider = clientProviderFromConfig{config}
|
|
|
|
var clientProvider ClientProvider = clientProviderFromConfig{config}
|
|
|
|
return Engine{
|
|
|
|
return Engine{
|
|
|
|
clientProvider: &clientProvider,
|
|
|
|
clientProvider: &clientProvider,
|
|
|
|
}.Render(chrt, values)
|
|
|
|
}.RenderWithContext(context.Background(), chrt, values)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RenderWithClientProvider takes a chart, optional values, and value overrides, and attempts to
|
|
|
|
// RenderWithClientProvider takes a chart, optional values, and value overrides, and attempts to
|
|
|
|
// render the Go templates using the default options. This engine is client aware and so can have template
|
|
|
|
// render the Go templates using the default options. This engine is client aware and so can have template
|
|
|
|
// functions that interact with the client.
|
|
|
|
// functions that interact with the client.
|
|
|
|
// This function differs from RenderWithClient in that it lets you customize the way a dynamic client is constructed.
|
|
|
|
// This function differs from RenderWithClient in that it lets you customize the way a dynamic client is constructed.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// TODO Helm v5: Replace with a NewEngine function that accepts a ClientProvider option
|
|
|
|
func RenderWithClientProvider(chrt ci.Charter, values common.Values, clientProvider ClientProvider) (map[string]string, error) {
|
|
|
|
func RenderWithClientProvider(chrt ci.Charter, values common.Values, clientProvider ClientProvider) (map[string]string, error) {
|
|
|
|
return Engine{
|
|
|
|
return Engine{
|
|
|
|
clientProvider: &clientProvider,
|
|
|
|
clientProvider: &clientProvider,
|
|
|
|
}.Render(chrt, values)
|
|
|
|
}.RenderWithContext(context.Background(), chrt, values)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// renderable is an object that can be rendered.
|
|
|
|
// renderable is an object that can be rendered.
|
|
|
|
|