boskos/crds/client.go
func registerResource(config *rest.Config, t Type) error {
	c, err := apiextensionsclient.NewForConfig(config)
	if err != nil {
		return err
	}

	crd := &apiextensionsv1beta1.CustomResourceDefinition{
		ObjectMeta: v1.ObjectMeta{
			Name: fmt.Sprintf("%s.%s", t.Plural, group),
		},
		Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
			Group:   group,
			Version: version,
			Scope:   apiextensionsv1beta1.NamespaceScoped,
			Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
				Singular: t.Singular,
				Plural:   t.Plural,
				Kind:     t.Kind,
				ListKind: t.ListKind,
			},
		},
	}
	if _, err := c.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd); err != nil && !apierrors.IsAlreadyExists(err) {
		return err
	}
	return nil
}
func registerResource(config *rest.Config, t Type) error {
	c, err := apiextensionsclient.NewForConfig(config)
	if err != nil {
		return err
	}

	crd := &apiextensionsv1beta1.CustomResourceDefinition{
		ObjectMeta: v1.ObjectMeta{
			Name: fmt.Sprintf("%s.%s", t.Plural, group),
		},
		Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
			Group:   group,
			Version: version,
			Scope:   apiextensionsv1beta1.NamespaceScoped,
			Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
				Singular: t.Singular,
				Plural:   t.Plural,
				Kind:     t.Kind,
				ListKind: t.ListKind,
			},
		},
	}
	if _, err := c.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd); err != nil && !apierrors.IsAlreadyExists(err) {
		return err
	}
	return nil
}
func registerResource ( config * rest . Config , t Type ) error { c , err := apiextensionsclient . NewForConfig ( config ) if err != nil { return err } crd := & apiextensionsv1beta1 . CustomResourceDefinition { ObjectMeta : v1 . ObjectMeta { Name : fmt . Sprintf ( " " , t . Plural , group ) , } , Spec : apiextensionsv1beta1 . CustomResourceDefinitionSpec { Group : group , Version : version , Scope : apiextensionsv1beta1 . NamespaceScoped , Names : apiextensionsv1beta1 . CustomResourceDefinitionNames { Singular : t . Singular , Plural : t . Plural , Kind : t . Kind , ListKind : t . ListKind , } , } , } if _ , err := c . ApiextensionsV1beta1 ( ) . CustomResourceDefinitions ( ) . Create ( crd ) ; err != nil && ! apierrors . IsAlreadyExists ( err ) { return err } return nil }
// registerResource sends a request to create CRDs and waits for them to initialize
registerResource sends a request to create CRDs and waits for them to initialize