func EnsureCRDCreatedWithConfig(config *rest.Config, crd *apiextensionsv1.CustomResourceDefinition) (created bool, err error) {
	client, err := apiextensionsclient.NewForConfig(config)
	if err != nil {
		return false, err
	}
	return ensureCRDCreatedWithClient(client, crd)
}
EnsureCRDCreatedWithConfig tries to create/update crd, returns (true, nil) if succeeding, otherwise returns (false, nil).
'err' should always be nil, because it is used by wait.PollUntil(), and it will exit if it is not nil.
package helmrequest
import (
	"context"
	"reflect"
	"strings"
	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
	apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/yaml"
	"k8s.io/client-go/rest"
	"k8s.io/klog"
)
func CreateCRDObject(s string) (*apiextensionsv1.CustomResourceDefinition, error) {
	sr := strings.NewReader(s)
	d := yaml.NewYAMLOrJSONDecoder(sr, len(s))
	crdVar := &apiextensionsv1.CustomResourceDefinition{}
	if err := d.Decode(crdVar); err != nil {
		return nil, err
	}
	return crdVar, nil
}
func EnsureCRDCreated(cfg *rest.Config) (created bool, err error) {
	crdVar, err := CreateCRDObject(helmRequestCRDYaml)
	if err != nil {
		return false, err
	}
	return EnsureCRDCreatedWithConfig(cfg, crdVar)
}