mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
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:
parent
8a9ac43ab5
commit
6033789c17
26 changed files with 509 additions and 82 deletions
|
|
@ -172,9 +172,9 @@ type SharedInformerFactory interface {
|
|||
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
|
||||
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
||||
|
||||
Openebs() zfs.Interface
|
||||
Zfs() zfs.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Openebs() zfs.Interface {
|
||||
func (f *sharedInformerFactory) Zfs() zfs.Interface {
|
||||
return zfs.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
|||
// TODO extend this to unknown resources with a client pool
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=openebs.io, Version=v1alpha1
|
||||
// Group=zfs.openebs.io, Version=v1alpha1
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("zfssnapshots"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().ZFSSnapshots().Informer()}, nil
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Zfs().V1alpha1().ZFSSnapshots().Informer()}, nil
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("zfsvolumes"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Openebs().V1alpha1().ZFSVolumes().Informer()}, nil
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Zfs().V1alpha1().ZFSVolumes().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package openebs
|
||||
package zfs
|
||||
|
||||
import (
|
||||
internalinterfaces "github.com/openebs/zfs-localpv/pkg/generated/informer/externalversions/internalinterfaces"
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@ func NewFilteredZFSSnapshotInformer(client internalclientset.Interface, namespac
|
|||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OpenebsV1alpha1().ZFSSnapshots(namespace).List(options)
|
||||
return client.ZfsV1alpha1().ZFSSnapshots(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OpenebsV1alpha1().ZFSSnapshots(namespace).Watch(options)
|
||||
return client.ZfsV1alpha1().ZFSSnapshots(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&zfsv1alpha1.ZFSSnapshot{},
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@ func NewFilteredZFSVolumeInformer(client internalclientset.Interface, namespace
|
|||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OpenebsV1alpha1().ZFSVolumes(namespace).List(options)
|
||||
return client.ZfsV1alpha1().ZFSVolumes(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OpenebsV1alpha1().ZFSVolumes(namespace).Watch(options)
|
||||
return client.ZfsV1alpha1().ZFSVolumes(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&zfsv1alpha1.ZFSVolume{},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue