Skip to content

Commit

Permalink
Docstring updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
porridge committed Nov 24, 2021
1 parent 36bf96d commit bc7e888
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,18 @@ func WithPostHook(h hook.PostHook) Option {
// WithValueTranslator is an Option that configures a function that translates a
// custom resource to the values passed to Helm.
// Use this if you need to customize the logic that translates your custom resource to Helm values.
// If you wish to, you can convert the Unstructured that is passed to your Translator to your own
// Custom Resource struct with code leveraging the k8s.io/apimachinery/pkg/runtime converter:
//
// foo := your.Foo{}
// if err = runtime.DefaultUnstructuredConverter.FromUnstructured(u.Object, &foo); err != nil {
// return nil, err
// }
// // work with the type-safe foo
//
// Alternatively, your translator can also work similarly to a Mapper, by accessing the spec with:
//
// u.Object["spec"].(map[string]interface{})
func WithValueTranslator(t values.Translator) Option {
return func(r *Reconciler) error {
r.valueTranslator = t
Expand All @@ -390,6 +402,7 @@ func WithValueTranslator(t values.Translator) Option {
// from a custom resource spec to the values passed to Helm.
// Use this if you want to apply a transformation on the values obtained from your custom resource, before
// they are passed to Helm.
// This functionality will be removed in a future release. Use WithValueTranslator instead.
func WithValueMapper(m values.Mapper) Option {
return func(r *Reconciler) error {
r.valueMapper = m
Expand Down

0 comments on commit bc7e888

Please sign in to comment.