feat(crd-gen): automate the CRDs generation with validations for APIs (#75)

- To generate the CRD spec `make manifest` generate then under
  deploy/yamls directory
- added a update-crd script to automate the steps to generate
  CRDs and its validation of each types

Signed-off-by: prateekpandey14 <prateek.pandey@mayadata.io>
This commit is contained in:
Prateek Pandey 2020-04-01 17:54:20 +05:30 committed by GitHub
parent 8a9ac43ab5
commit 6033789c17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 509 additions and 82 deletions

View file

@ -19,7 +19,7 @@ limitations under the License.
package internalclientset
import (
openebsv1alpha1 "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1"
zfsv1alpha1 "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
@ -27,19 +27,19 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface
ZfsV1alpha1() zfsv1alpha1.ZfsV1alpha1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
openebsV1alpha1 *openebsv1alpha1.OpenebsV1alpha1Client
zfsV1alpha1 *zfsv1alpha1.ZfsV1alpha1Client
}
// OpenebsV1alpha1 retrieves the OpenebsV1alpha1Client
func (c *Clientset) OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface {
return c.openebsV1alpha1
// ZfsV1alpha1 retrieves the ZfsV1alpha1Client
func (c *Clientset) ZfsV1alpha1() zfsv1alpha1.ZfsV1alpha1Interface {
return c.zfsV1alpha1
}
// Discovery retrieves the DiscoveryClient
@ -58,7 +58,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
}
var cs Clientset
var err error
cs.openebsV1alpha1, err = openebsv1alpha1.NewForConfig(&configShallowCopy)
cs.zfsV1alpha1, err = zfsv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
@ -74,7 +74,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.openebsV1alpha1 = openebsv1alpha1.NewForConfigOrDie(c)
cs.zfsV1alpha1 = zfsv1alpha1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
@ -83,7 +83,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.openebsV1alpha1 = openebsv1alpha1.New(c)
cs.zfsV1alpha1 = zfsv1alpha1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs