func GetNestedFieldInto(out interface{}, obj map[string]interface{}, fields ...string) error {
	objMap, found, err := unstructured.NestedFieldNoCopy(obj, fields...)
	if err != nil {
		return fmt.Errorf("can't get nested field %v: %v", strings.Join(fields, "."), err)
	}
	if !found {
		return nil
	}
	data, err := json.Marshal(objMap)
	if err != nil {
		return fmt.Errorf("can't encode nested field %v: %v", strings.Join(fields, "."), err)
	}
	if err := json.Unmarshal(data, out); err != nil {
		return fmt.Errorf("can't decode nested field %v into type %T: %v", strings.Join(fields, "."), out, err)
	}
	return nil
}
These are based on functions from k8s.io/apimachinery/pkg/apis/meta/v1/unstructured.
They are copied here to make them exported.
package kubernetes
import (
	"fmt"
	"strings"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/util/json"
)