From bf2fc5d86e209ee6984e8324f047ec9648e96091 Mon Sep 17 00:00:00 2001 From: prateekpandey14 Date: Wed, 1 Apr 2020 14:27:47 +0530 Subject: [PATCH 1/3] feat(crd-gen): automate the CRDs generation with validations - To generate the CRD spec `make manifest` generate then under deploy/crds directory - added a update-crd script to automate the steps to generate CRDs and its validation of each types Signed-off-by: prateekpandey14 --- Makefile | 4 + buildscripts/update-crd.sh | 45 +++++ deploy/crds/zfs.openebs.io_zfssnapshots.yaml | 153 +++++++++++++++ deploy/crds/zfs.openebs.io_zfsvolumes.yaml | 180 ++++++++++++++++++ pkg/apis/openebs.io/zfs/v1alpha1/doc.go | 2 +- .../openebs.io/zfs/v1alpha1/zfssnapshot.go | 2 + pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go | 64 +++++-- 7 files changed, 438 insertions(+), 12 deletions(-) create mode 100755 buildscripts/update-crd.sh create mode 100644 deploy/crds/zfs.openebs.io_zfssnapshots.yaml create mode 100644 deploy/crds/zfs.openebs.io_zfsvolumes.yaml diff --git a/Makefile b/Makefile index e44c59378..e324245b3 100644 --- a/Makefile +++ b/Makefile @@ -134,6 +134,10 @@ informer: --output-package $(SRC_PKG)/generated/informer \ --go-header-file ./buildscripts/custom-boilerplate.go.txt +manifests: + @echo "+ Generating zfs localPV crds" + $(PWD)/buildscripts/update-crd.sh + .PHONY: zfs-driver zfs-driver: format @echo "--------------------------------" diff --git a/buildscripts/update-crd.sh b/buildscripts/update-crd.sh new file mode 100755 index 000000000..18e15bac8 --- /dev/null +++ b/buildscripts/update-crd.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Copyright 2019 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#set -o errexit +set -o nounset +set -o pipefail + +## find or download controller-gen +CONTROLLER_GEN=$(which controller-gen) + +if [ "$CONTROLLER_GEN" = "" ] +then + TMP_DIR=$(mktemp -d); + cd $TMP_DIR; + go mod init tmp; + go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.8; + rm -rf $TMP_DIR; + CONTROLLER_GEN=$(which controller-gen) +fi + +if [ "$CONTROLLER_GEN" = "" ] +then + echo "ERROR: failed to get controller-gen"; + exit 1; +fi + +SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd) + +$CONTROLLER_GEN crd:trivialVersions=true,preserveUnknownFields=false paths=${SCRIPT_ROOT}/pkg/apis/openebs.io/zfs/v1alpha1 output:crd:artifacts:config=deploy/crds + +# To use your own boilerplate text use: +# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt diff --git a/deploy/crds/zfs.openebs.io_zfssnapshots.yaml b/deploy/crds/zfs.openebs.io_zfssnapshots.yaml new file mode 100644 index 000000000..9db8e2ee8 --- /dev/null +++ b/deploy/crds/zfs.openebs.io_zfssnapshots.yaml @@ -0,0 +1,153 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.2.8 + creationTimestamp: null + name: zfssnapshots.zfs.openebs.io +spec: + group: zfs.openebs.io + names: + kind: ZFSSnapshot + listKind: ZFSSnapshotList + plural: zfssnapshots + shortNames: + - zfssnap + singular: zfssnapshot + preserveUnknownFields: false + scope: Namespaced + validation: + openAPIV3Schema: + description: ZFSSnapshot represents a ZFS Snapshot of the zfsvolume + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: VolumeInfo contains the volume related info for all types of + volumes in ZFSVolume + properties: + capacity: + description: Capacity of the volume + minLength: 1 + type: string + compression: + description: Controls the compression algorithm used for this dataset. + Compression specifies if the it should enabled on the zvol. Setting + compression to on indicates that the current default compression algorithm + should be used. The current default compression algorithm is either + lzjb or, if the lz4_compress feature is enabled, lz4. Changing this + property affects only newly-written data. + pattern: ^(on|off|lzjb|gzip|gzip-[1-9]|zle|lz4)$ + type: string + dedup: + description: Deduplication is the process for removing redundant data + at the block level, reducing the total amount of data stored. If a + file system has the dedup property enabled, duplicate data blocks + are removed synchronously. The result is that only unique data is + stored and common components are shared among files. Deduplication + can consume significant processing power (CPU) and memory as well + as generate additional disk IO. Before creating a pool with deduplication + enabled, ensure that you have planned your hardware requirements appropriately + and implemented appropriate recovery practices, such as regular backups. + As an alternative to deduplication consider using compression=lz4, + as a less resource-intensive alternative. should be enabled on the + zvol + enum: + - "on" + - "off" + type: string + encryption: + description: Enabling the encryption feature allows for the creation + of encrypted filesystems and volumes. ZFS will encrypt file and zvol + data, file attributes, ACLs, permission bits, directory listings, + FUID mappings, and userused / groupused data. ZFS will not encrypt + metadata related to the pool structure, including dataset and snapshot + names, dataset hierarchy, properties, file size, file holes, and deduplication + tables (though the deduplicated data itself is encrypted). + pattern: ^(on|off|aes-128-[c,g]cm|aes-192-[c,g]cm|aes-256-[c,g]cm)$ + type: string + fsType: + description: FsType specifies filesystem type for the zfs volume/dataset + type: string + keyformat: + description: KeyFormat specifies format of the encryption key + type: string + keylocation: + description: KeyLocation is the location of key for the encryption + type: string + ownerNodeID: + minLength: 1 + type: string + poolName: + description: poolName specifies the name of the pool where this volume + should be created + minLength: 1 + type: string + recordsize: + description: RecordSize specifies the record size for the zfs dataset + minLength: 1 + type: string + snapname: + description: SnapName specifies the name of the snapshot where this + volume should be cloned + type: string + thinProvision: + description: Thinprovision specifies if we should thin provisioned the + volume or not + enum: + - "Yes" + - "no" + type: string + volblocksize: + description: VolBlockSize specifies the block size for the zvol + minLength: 1 + type: string + volumeType: + description: volumeType determines whether the volume is of type "DATASET" + or "ZVOL". if fsttype provided in the storageclass as "zfs", then + it will create a volume of type "DATASET". If "ext4", "ext3", "ext2" + or "xfs" in mentioned as fstype in the storageclass, it will create + a volume of type "ZVOL" so that it can be further formatted with the + fstype provided in the storageclass. + enum: + - ZVOL + - DATASET + type: string + required: + - capacity + - ownerNodeID + - poolName + - volumeType + type: object + status: + properties: + state: + type: string + type: object + required: + - spec + - status + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/deploy/crds/zfs.openebs.io_zfsvolumes.yaml b/deploy/crds/zfs.openebs.io_zfsvolumes.yaml new file mode 100644 index 000000000..a84a70879 --- /dev/null +++ b/deploy/crds/zfs.openebs.io_zfsvolumes.yaml @@ -0,0 +1,180 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.2.8 + creationTimestamp: null + name: zfsvolumes.zfs.openebs.io +spec: + additionalPrinterColumns: + - JSONPath: .spec.poolName + description: ZFS Pool where the volume is created + name: ZPool + type: string + - JSONPath: .spec.ownerNodeID + description: Node where the volume is created + name: Node + type: string + - JSONPath: .spec.capacity + description: Size of the volume + name: Size + type: string + - JSONPath: .spec.volblocksize + description: volblocksize of volume + name: volblocksize + type: string + - JSONPath: .spec.recordsize + description: recordsize of created zfs dataset + name: recordsize + type: string + - JSONPath: .spec.fsType + description: filesystem created on the volume + name: Filesystem + type: string + - JSONPath: .status.creationTime + description: Timestamp when the volume has been created. + name: CreationTime + type: date + - JSONPath: .metadata.creationTimestamp + name: Age + type: date + group: zfs.openebs.io + names: + kind: ZFSVolume + listKind: ZFSVolumeList + plural: zfsvolumes + shortNames: + - zfsvol + singular: zfsvolume + preserveUnknownFields: false + scope: Namespaced + subresources: {} + validation: + openAPIV3Schema: + description: ZFSVolume represents a ZFS based volume + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: VolumeInfo contains the volume related info for all types of + volumes in ZFSVolume + properties: + capacity: + description: Capacity of the volume + minLength: 1 + type: string + compression: + description: Controls the compression algorithm used for this dataset. + Compression specifies if the it should enabled on the zvol. Setting + compression to on indicates that the current default compression algorithm + should be used. The current default compression algorithm is either + lzjb or, if the lz4_compress feature is enabled, lz4. Changing this + property affects only newly-written data. + pattern: ^(on|off|lzjb|gzip|gzip-[1-9]|zle|lz4)$ + type: string + dedup: + description: Deduplication is the process for removing redundant data + at the block level, reducing the total amount of data stored. If a + file system has the dedup property enabled, duplicate data blocks + are removed synchronously. The result is that only unique data is + stored and common components are shared among files. Deduplication + can consume significant processing power (CPU) and memory as well + as generate additional disk IO. Before creating a pool with deduplication + enabled, ensure that you have planned your hardware requirements appropriately + and implemented appropriate recovery practices, such as regular backups. + As an alternative to deduplication consider using compression=lz4, + as a less resource-intensive alternative. should be enabled on the + zvol + enum: + - "on" + - "off" + type: string + encryption: + description: Enabling the encryption feature allows for the creation + of encrypted filesystems and volumes. ZFS will encrypt file and zvol + data, file attributes, ACLs, permission bits, directory listings, + FUID mappings, and userused / groupused data. ZFS will not encrypt + metadata related to the pool structure, including dataset and snapshot + names, dataset hierarchy, properties, file size, file holes, and deduplication + tables (though the deduplicated data itself is encrypted). + pattern: ^(on|off|aes-128-[c,g]cm|aes-192-[c,g]cm|aes-256-[c,g]cm)$ + type: string + fsType: + description: FsType specifies filesystem type for the zfs volume/dataset + type: string + keyformat: + description: KeyFormat specifies format of the encryption key + type: string + keylocation: + description: KeyLocation is the location of key for the encryption + type: string + ownerNodeID: + minLength: 1 + type: string + poolName: + description: poolName specifies the name of the pool where this volume + should be created + minLength: 1 + type: string + recordsize: + description: RecordSize specifies the record size for the zfs dataset + minLength: 1 + type: string + snapname: + description: SnapName specifies the name of the snapshot where this + volume should be cloned + type: string + thinProvision: + description: Thinprovision specifies if we should thin provisioned the + volume or not + enum: + - "Yes" + - "no" + type: string + volblocksize: + description: VolBlockSize specifies the block size for the zvol + minLength: 1 + type: string + volumeType: + description: volumeType determines whether the volume is of type "DATASET" + or "ZVOL". if fsttype provided in the storageclass as "zfs", then + it will create a volume of type "DATASET". If "ext4", "ext3", "ext2" + or "xfs" in mentioned as fstype in the storageclass, it will create + a volume of type "ZVOL" so that it can be further formatted with the + fstype provided in the storageclass. + enum: + - ZVOL + - DATASET + type: string + required: + - capacity + - ownerNodeID + - poolName + - volumeType + type: object + required: + - spec + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/pkg/apis/openebs.io/zfs/v1alpha1/doc.go b/pkg/apis/openebs.io/zfs/v1alpha1/doc.go index c182efa32..20e8c9054 100644 --- a/pkg/apis/openebs.io/zfs/v1alpha1/doc.go +++ b/pkg/apis/openebs.io/zfs/v1alpha1/doc.go @@ -17,5 +17,5 @@ limitations under the License. // +k8s:deepcopy-gen=package,register // Package v1alpha1 is the API version -// +groupName=openebs.io +// +groupName=zfs.openebs.io package v1alpha1 diff --git a/pkg/apis/openebs.io/zfs/v1alpha1/zfssnapshot.go b/pkg/apis/openebs.io/zfs/v1alpha1/zfssnapshot.go index 6393e737c..5e69738f9 100644 --- a/pkg/apis/openebs.io/zfs/v1alpha1/zfssnapshot.go +++ b/pkg/apis/openebs.io/zfs/v1alpha1/zfssnapshot.go @@ -25,6 +25,8 @@ import ( // +resource:path=zfssnapshot // ZFSSnapshot represents a ZFS Snapshot of the zfsvolume +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Namespaced,shortName=zfssnap type ZFSSnapshot struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go b/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go index 4c66c44cd..f6c250983 100644 --- a/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go +++ b/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go @@ -25,6 +25,16 @@ import ( // +resource:path=zfsvolume // ZFSVolume represents a ZFS based volume +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Namespaced,shortName=zfsvol +// +kubebuilder:printcolumn:name="ZPool",type=string,JSONPath=`.spec.poolName`,description="ZFS Pool where the volume is created" +// +kubebuilder:printcolumn:name="Node",type=string,JSONPath=`.spec.ownerNodeID`,description="Node where the volume is created" +// +kubebuilder:printcolumn:name="Size",type=string,JSONPath=`.spec.capacity`,description="Size of the volume" +// +kubebuilder:printcolumn:name="volblocksize",type=string,JSONPath=`.spec.volblocksize`,description="volblocksize of volume" +// +kubebuilder:printcolumn:name="recordsize",type=string,JSONPath=`.spec.recordsize`,description="recordsize of created zfs dataset" +// +kubebuilder:printcolumn:name="Filesystem",type=string,JSONPath=`.spec.fsType`,description="filesystem created on the volume" +// +kubebuilder:printcolumn:name="CreationTime",type=date,JSONPath=`.status.creationTime`,description="Timestamp when the volume has been created." +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` type ZFSVolume struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -71,12 +81,18 @@ type ZFSVolumeList struct { // VolumeInfo contains the volume related info // for all types of volumes in ZFSVolume type VolumeInfo struct { + // OwnerNodeID is the Node ID which // is the owner of this Volume + + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:Required OwnerNodeID string `json:"ownerNodeID"` // poolName specifies the name of the // pool where this volume should be created + // +kubebuilder:validation:Required + // +kubebuilder:validation:MinLength=1 PoolName string `json:"poolName"` // SnapName specifies the name of the @@ -84,41 +100,67 @@ type VolumeInfo struct { SnapName string `json:"snapname,omitempty"` // Capacity of the volume + // +kubebuilder:validation:MinLength=1 Capacity string `json:"capacity"` // RecordSize specifies the record size // for the zfs dataset + // +kubebuilder:validation:MinLength=1 RecordSize string `json:"recordsize,omitempty"` // VolBlockSize specifies the block size for the zvol + // +kubebuilder:validation:MinLength=1 VolBlockSize string `json:"volblocksize,omitempty"` - // Compression specifies if the it should - // enabled on the zvol + // Controls the compression algorithm used for this dataset. Compression + // specifies if the it should enabled on the zvol. Setting compression to on + // indicates that the current default compression algorithm should be used. + // The current default compression algorithm is either lzjb or, if the lz4_compress + // feature is enabled, lz4. + // Changing this property affects only newly-written data. + // +kubebuilder:validation:Pattern="^(on|off|lzjb|gzip|gzip-[1-9]|zle|lz4)$" Compression string `json:"compression,omitempty"` - // Dedup specifies the deduplication + // Deduplication is the process for removing redundant data at the block level, + // reducing the total amount of data stored. If a file system has the dedup property + // enabled, duplicate data blocks are removed synchronously. + // The result is that only unique data is stored and common components are shared among files. + // Deduplication can consume significant processing power (CPU) and memory as well as generate additional disk IO. + // Before creating a pool with deduplication enabled, ensure that you have planned your hardware + // requirements appropriately and implemented appropriate recovery practices, such as regular backups. + // As an alternative to deduplication consider using compression=lz4, as a less resource-intensive alternative. // should be enabled on the zvol + // +kubebuilder:validation:Enum=on;off Dedup string `json:"dedup,omitempty"` - // Encryption specifies the encryption - // should be enabled on the zvol + // Enabling the encryption feature allows for the creation of + // encrypted filesystems and volumes. ZFS will encrypt file and zvol data, + // file attributes, ACLs, permission bits, directory listings, FUID mappings, + // and userused / groupused data. ZFS will not encrypt metadata related to the + // pool structure, including dataset and snapshot names, dataset hierarchy, + // properties, file size, file holes, and deduplication tables + // (though the deduplicated data itself is encrypted). + // +kubebuilder:validation:Pattern="^(on|off|aes-128-[c,g]cm|aes-192-[c,g]cm|aes-256-[c,g]cm)$" Encryption string `json:"encryption,omitempty"` - // KeyLocation is the location of key - // for the encryption + // KeyLocation is the location of key for the encryption KeyLocation string `json:"keylocation,omitempty"` - // KeyFormat specifies format of the - // encryption key + // KeyFormat specifies format of the encryption key KeyFormat string `json:"keyformat,omitempty"` // Thinprovision specifies if we should // thin provisioned the volume or not + // +kubebuilder:validation:Enum=Yes;no ThinProvision string `json:"thinProvision,omitempty"` - // VolumeType specifies whether the volume is - // zvol or a dataset + // volumeType determines whether the volume is of type "DATASET" or "ZVOL". + // if fsttype provided in the storageclass as "zfs", then it will create a + // volume of type "DATASET". If "ext4", "ext3", "ext2" or "xfs" in mentioned as fstype + // in the storageclass, it will create a volume of type "ZVOL" so that it can be + // further formatted with the fstype provided in the storageclass. + // +kubebuilder:validation:Required + // +kubebuilder:validation:Enum=ZVOL;DATASET VolumeType string `json:"volumeType"` // FsType specifies filesystem type for the From 5334b8c5bb73cf87f178ecfe87b368febacdcfcc Mon Sep 17 00:00:00 2001 From: prateekpandey14 Date: Wed, 1 Apr 2020 15:50:08 +0530 Subject: [PATCH 2/3] fix client gen path and refactor the required changes Signed-off-by: prateekpandey14 --- deploy/crds/zfs.openebs.io_zfssnapshots.yaml | 4 +-- deploy/crds/zfs.openebs.io_zfsvolumes.yaml | 4 +-- pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go | 4 +-- pkg/builder/snapbuilder/kubernetes.go | 10 +++---- pkg/builder/volbuilder/kubernetes.go | 10 +++---- .../clientset/internalclientset/clientset.go | 18 ++++++------ .../fake/clientset_generated.go | 10 +++---- .../internalclientset/fake/register.go | 4 +-- .../internalclientset/scheme/register.go | 4 +-- .../zfs/v1alpha1/fake/fake_zfs_client.go | 8 +++--- .../zfs/v1alpha1/fake/fake_zfssnapshot.go | 6 ++-- .../typed/zfs/v1alpha1/fake/fake_zfsvolume.go | 6 ++-- .../typed/zfs/v1alpha1/zfs_client.go | 28 +++++++++---------- .../typed/zfs/v1alpha1/zfssnapshot.go | 2 +- .../typed/zfs/v1alpha1/zfsvolume.go | 2 +- .../informer/externalversions/factory.go | 4 +-- .../informer/externalversions/generic.go | 6 ++-- .../externalversions/zfs/interface.go | 2 +- .../zfs/v1alpha1/zfssnapshot.go | 4 +-- .../zfs/v1alpha1/zfsvolume.go | 4 +-- pkg/mgmt/snapshot/builder.go | 6 ++-- pkg/mgmt/volume/builder.go | 6 ++-- 22 files changed, 76 insertions(+), 76 deletions(-) diff --git a/deploy/crds/zfs.openebs.io_zfssnapshots.yaml b/deploy/crds/zfs.openebs.io_zfssnapshots.yaml index 9db8e2ee8..5b8f456d2 100644 --- a/deploy/crds/zfs.openebs.io_zfssnapshots.yaml +++ b/deploy/crds/zfs.openebs.io_zfssnapshots.yaml @@ -116,9 +116,9 @@ spec: type: string volumeType: description: volumeType determines whether the volume is of type "DATASET" - or "ZVOL". if fsttype provided in the storageclass as "zfs", then + or "ZVOL". if fsttype provided in the storageclass is "zfs", then it will create a volume of type "DATASET". If "ext4", "ext3", "ext2" - or "xfs" in mentioned as fstype in the storageclass, it will create + or "xfs" is mentioned as fstype in the storageclass, it will create a volume of type "ZVOL" so that it can be further formatted with the fstype provided in the storageclass. enum: diff --git a/deploy/crds/zfs.openebs.io_zfsvolumes.yaml b/deploy/crds/zfs.openebs.io_zfsvolumes.yaml index a84a70879..8719709f2 100644 --- a/deploy/crds/zfs.openebs.io_zfsvolumes.yaml +++ b/deploy/crds/zfs.openebs.io_zfsvolumes.yaml @@ -149,9 +149,9 @@ spec: type: string volumeType: description: volumeType determines whether the volume is of type "DATASET" - or "ZVOL". if fsttype provided in the storageclass as "zfs", then + or "ZVOL". if fsttype provided in the storageclass is "zfs", then it will create a volume of type "DATASET". If "ext4", "ext3", "ext2" - or "xfs" in mentioned as fstype in the storageclass, it will create + or "xfs" is mentioned as fstype in the storageclass, it will create a volume of type "ZVOL" so that it can be further formatted with the fstype provided in the storageclass. enum: diff --git a/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go b/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go index f6c250983..77762d538 100644 --- a/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go +++ b/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go @@ -155,8 +155,8 @@ type VolumeInfo struct { ThinProvision string `json:"thinProvision,omitempty"` // volumeType determines whether the volume is of type "DATASET" or "ZVOL". - // if fsttype provided in the storageclass as "zfs", then it will create a - // volume of type "DATASET". If "ext4", "ext3", "ext2" or "xfs" in mentioned as fstype + // if fsttype provided in the storageclass is "zfs", then it will create a + // volume of type "DATASET". If "ext4", "ext3", "ext2" or "xfs" is mentioned as fstype // in the storageclass, it will create a volume of type "ZVOL" so that it can be // further formatted with the fstype provided in the storageclass. // +kubebuilder:validation:Required diff --git a/pkg/builder/snapbuilder/kubernetes.go b/pkg/builder/snapbuilder/kubernetes.go index 72bea9d67..697d10e76 100644 --- a/pkg/builder/snapbuilder/kubernetes.go +++ b/pkg/builder/snapbuilder/kubernetes.go @@ -140,7 +140,7 @@ func defaultGet( name, namespace string, opts metav1.GetOptions, ) (*apis.ZFSSnapshot, error) { - return cli.OpenebsV1alpha1(). + return cli.ZfsV1alpha1(). ZFSSnapshots(namespace). Get(name, opts) } @@ -152,7 +152,7 @@ func defaultList( namespace string, opts metav1.ListOptions, ) (*apis.ZFSSnapshotList, error) { - return cli.OpenebsV1alpha1(). + return cli.ZfsV1alpha1(). ZFSSnapshots(namespace). List(opts) } @@ -166,7 +166,7 @@ func defaultDel( ) error { deletePropagation := metav1.DeletePropagationForeground opts.PropagationPolicy = &deletePropagation - err := cli.OpenebsV1alpha1(). + err := cli.ZfsV1alpha1(). ZFSSnapshots(namespace). Delete(name, opts) return err @@ -179,7 +179,7 @@ func defaultCreate( vol *apis.ZFSSnapshot, namespace string, ) (*apis.ZFSSnapshot, error) { - return cli.OpenebsV1alpha1(). + return cli.ZfsV1alpha1(). ZFSSnapshots(namespace). Create(vol) } @@ -191,7 +191,7 @@ func defaultUpdate( vol *apis.ZFSSnapshot, namespace string, ) (*apis.ZFSSnapshot, error) { - return cli.OpenebsV1alpha1(). + return cli.ZfsV1alpha1(). ZFSSnapshots(namespace). Update(vol) } diff --git a/pkg/builder/volbuilder/kubernetes.go b/pkg/builder/volbuilder/kubernetes.go index 84780aff6..419ae16aa 100644 --- a/pkg/builder/volbuilder/kubernetes.go +++ b/pkg/builder/volbuilder/kubernetes.go @@ -140,7 +140,7 @@ func defaultGet( name, namespace string, opts metav1.GetOptions, ) (*apis.ZFSVolume, error) { - return cli.OpenebsV1alpha1(). + return cli.ZfsV1alpha1(). ZFSVolumes(namespace). Get(name, opts) } @@ -152,7 +152,7 @@ func defaultList( namespace string, opts metav1.ListOptions, ) (*apis.ZFSVolumeList, error) { - return cli.OpenebsV1alpha1(). + return cli.ZfsV1alpha1(). ZFSVolumes(namespace). List(opts) } @@ -166,7 +166,7 @@ func defaultDel( ) error { deletePropagation := metav1.DeletePropagationForeground opts.PropagationPolicy = &deletePropagation - err := cli.OpenebsV1alpha1(). + err := cli.ZfsV1alpha1(). ZFSVolumes(namespace). Delete(name, opts) return err @@ -179,7 +179,7 @@ func defaultCreate( vol *apis.ZFSVolume, namespace string, ) (*apis.ZFSVolume, error) { - return cli.OpenebsV1alpha1(). + return cli.ZfsV1alpha1(). ZFSVolumes(namespace). Create(vol) } @@ -191,7 +191,7 @@ func defaultUpdate( vol *apis.ZFSVolume, namespace string, ) (*apis.ZFSVolume, error) { - return cli.OpenebsV1alpha1(). + return cli.ZfsV1alpha1(). ZFSVolumes(namespace). Update(vol) } diff --git a/pkg/generated/clientset/internalclientset/clientset.go b/pkg/generated/clientset/internalclientset/clientset.go index f23098675..b6e5b62f8 100644 --- a/pkg/generated/clientset/internalclientset/clientset.go +++ b/pkg/generated/clientset/internalclientset/clientset.go @@ -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 diff --git a/pkg/generated/clientset/internalclientset/fake/clientset_generated.go b/pkg/generated/clientset/internalclientset/fake/clientset_generated.go index 4659e4ab9..19ad83028 100644 --- a/pkg/generated/clientset/internalclientset/fake/clientset_generated.go +++ b/pkg/generated/clientset/internalclientset/fake/clientset_generated.go @@ -20,8 +20,8 @@ package fake import ( clientset "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset" - openebsv1alpha1 "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1" - fakeopenebsv1alpha1 "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake" + zfsv1alpha1 "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1" + fakezfsv1alpha1 "github.com/openebs/zfs-localpv/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -71,7 +71,7 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { var _ clientset.Interface = &Clientset{} -// OpenebsV1alpha1 retrieves the OpenebsV1alpha1Client -func (c *Clientset) OpenebsV1alpha1() openebsv1alpha1.OpenebsV1alpha1Interface { - return &fakeopenebsv1alpha1.FakeOpenebsV1alpha1{Fake: &c.Fake} +// ZfsV1alpha1 retrieves the ZfsV1alpha1Client +func (c *Clientset) ZfsV1alpha1() zfsv1alpha1.ZfsV1alpha1Interface { + return &fakezfsv1alpha1.FakeZfsV1alpha1{Fake: &c.Fake} } diff --git a/pkg/generated/clientset/internalclientset/fake/register.go b/pkg/generated/clientset/internalclientset/fake/register.go index 636e6eddc..dd5a26448 100644 --- a/pkg/generated/clientset/internalclientset/fake/register.go +++ b/pkg/generated/clientset/internalclientset/fake/register.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - openebsv1alpha1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1alpha1" + zfsv1alpha1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - openebsv1alpha1.AddToScheme, + zfsv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/internalclientset/scheme/register.go b/pkg/generated/clientset/internalclientset/scheme/register.go index 4c46183d9..4105b5f55 100644 --- a/pkg/generated/clientset/internalclientset/scheme/register.go +++ b/pkg/generated/clientset/internalclientset/scheme/register.go @@ -19,7 +19,7 @@ limitations under the License. package scheme import ( - openebsv1alpha1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1alpha1" + zfsv1alpha1 "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,7 +31,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - openebsv1alpha1.AddToScheme, + zfsv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfs_client.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfs_client.go index 084b03614..ea6cd16a6 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfs_client.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfs_client.go @@ -24,21 +24,21 @@ import ( testing "k8s.io/client-go/testing" ) -type FakeOpenebsV1alpha1 struct { +type FakeZfsV1alpha1 struct { *testing.Fake } -func (c *FakeOpenebsV1alpha1) ZFSSnapshots(namespace string) v1alpha1.ZFSSnapshotInterface { +func (c *FakeZfsV1alpha1) ZFSSnapshots(namespace string) v1alpha1.ZFSSnapshotInterface { return &FakeZFSSnapshots{c, namespace} } -func (c *FakeOpenebsV1alpha1) ZFSVolumes(namespace string) v1alpha1.ZFSVolumeInterface { +func (c *FakeZfsV1alpha1) ZFSVolumes(namespace string) v1alpha1.ZFSVolumeInterface { return &FakeZFSVolumes{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeOpenebsV1alpha1) RESTClient() rest.Interface { +func (c *FakeZfsV1alpha1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfssnapshot.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfssnapshot.go index fa439a113..ea5928435 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfssnapshot.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfssnapshot.go @@ -30,13 +30,13 @@ import ( // FakeZFSSnapshots implements ZFSSnapshotInterface type FakeZFSSnapshots struct { - Fake *FakeOpenebsV1alpha1 + Fake *FakeZfsV1alpha1 ns string } -var zfssnapshotsResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "zfssnapshots"} +var zfssnapshotsResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1alpha1", Resource: "zfssnapshots"} -var zfssnapshotsKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "ZFSSnapshot"} +var zfssnapshotsKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1alpha1", Kind: "ZFSSnapshot"} // Get takes name of the zFSSnapshot, and returns the corresponding zFSSnapshot object, and an error if there is any. func (c *FakeZFSSnapshots) Get(name string, options v1.GetOptions) (result *v1alpha1.ZFSSnapshot, err error) { diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfsvolume.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfsvolume.go index f36da9c12..b74a0a13f 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfsvolume.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/fake/fake_zfsvolume.go @@ -30,13 +30,13 @@ import ( // FakeZFSVolumes implements ZFSVolumeInterface type FakeZFSVolumes struct { - Fake *FakeOpenebsV1alpha1 + Fake *FakeZfsV1alpha1 ns string } -var zfsvolumesResource = schema.GroupVersionResource{Group: "openebs.io", Version: "v1alpha1", Resource: "zfsvolumes"} +var zfsvolumesResource = schema.GroupVersionResource{Group: "zfs.openebs.io", Version: "v1alpha1", Resource: "zfsvolumes"} -var zfsvolumesKind = schema.GroupVersionKind{Group: "openebs.io", Version: "v1alpha1", Kind: "ZFSVolume"} +var zfsvolumesKind = schema.GroupVersionKind{Group: "zfs.openebs.io", Version: "v1alpha1", Kind: "ZFSVolume"} // Get takes name of the zFSVolume, and returns the corresponding zFSVolume object, and an error if there is any. func (c *FakeZFSVolumes) Get(name string, options v1.GetOptions) (result *v1alpha1.ZFSVolume, err error) { diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfs_client.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfs_client.go index bb9143a6c..85ecf4772 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfs_client.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfs_client.go @@ -25,27 +25,27 @@ import ( rest "k8s.io/client-go/rest" ) -type OpenebsV1alpha1Interface interface { +type ZfsV1alpha1Interface interface { RESTClient() rest.Interface ZFSSnapshotsGetter ZFSVolumesGetter } -// OpenebsV1alpha1Client is used to interact with features provided by the openebs.io group. -type OpenebsV1alpha1Client struct { +// ZfsV1alpha1Client is used to interact with features provided by the zfs.openebs.io group. +type ZfsV1alpha1Client struct { restClient rest.Interface } -func (c *OpenebsV1alpha1Client) ZFSSnapshots(namespace string) ZFSSnapshotInterface { +func (c *ZfsV1alpha1Client) ZFSSnapshots(namespace string) ZFSSnapshotInterface { return newZFSSnapshots(c, namespace) } -func (c *OpenebsV1alpha1Client) ZFSVolumes(namespace string) ZFSVolumeInterface { +func (c *ZfsV1alpha1Client) ZFSVolumes(namespace string) ZFSVolumeInterface { return newZFSVolumes(c, namespace) } -// NewForConfig creates a new OpenebsV1alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*OpenebsV1alpha1Client, error) { +// NewForConfig creates a new ZfsV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*ZfsV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -54,12 +54,12 @@ func NewForConfig(c *rest.Config) (*OpenebsV1alpha1Client, error) { if err != nil { return nil, err } - return &OpenebsV1alpha1Client{client}, nil + return &ZfsV1alpha1Client{client}, nil } -// NewForConfigOrDie creates a new OpenebsV1alpha1Client for the given config and +// NewForConfigOrDie creates a new ZfsV1alpha1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *OpenebsV1alpha1Client { +func NewForConfigOrDie(c *rest.Config) *ZfsV1alpha1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -67,9 +67,9 @@ func NewForConfigOrDie(c *rest.Config) *OpenebsV1alpha1Client { return client } -// New creates a new OpenebsV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *OpenebsV1alpha1Client { - return &OpenebsV1alpha1Client{c} +// New creates a new ZfsV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *ZfsV1alpha1Client { + return &ZfsV1alpha1Client{c} } func setConfigDefaults(config *rest.Config) error { @@ -87,7 +87,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *OpenebsV1alpha1Client) RESTClient() rest.Interface { +func (c *ZfsV1alpha1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfssnapshot.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfssnapshot.go index 6fddff8f9..30f4f31ba 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfssnapshot.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfssnapshot.go @@ -56,7 +56,7 @@ type zFSSnapshots struct { } // newZFSSnapshots returns a ZFSSnapshots -func newZFSSnapshots(c *OpenebsV1alpha1Client, namespace string) *zFSSnapshots { +func newZFSSnapshots(c *ZfsV1alpha1Client, namespace string) *zFSSnapshots { return &zFSSnapshots{ client: c.RESTClient(), ns: namespace, diff --git a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfsvolume.go b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfsvolume.go index 570b10753..b2b377f17 100644 --- a/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfsvolume.go +++ b/pkg/generated/clientset/internalclientset/typed/zfs/v1alpha1/zfsvolume.go @@ -55,7 +55,7 @@ type zFSVolumes struct { } // newZFSVolumes returns a ZFSVolumes -func newZFSVolumes(c *OpenebsV1alpha1Client, namespace string) *zFSVolumes { +func newZFSVolumes(c *ZfsV1alpha1Client, namespace string) *zFSVolumes { return &zFSVolumes{ client: c.RESTClient(), ns: namespace, diff --git a/pkg/generated/informer/externalversions/factory.go b/pkg/generated/informer/externalversions/factory.go index e59f0b48f..909c1423d 100644 --- a/pkg/generated/informer/externalversions/factory.go +++ b/pkg/generated/informer/externalversions/factory.go @@ -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) } diff --git a/pkg/generated/informer/externalversions/generic.go b/pkg/generated/informer/externalversions/generic.go index 521a11daf..e1da4b45a 100644 --- a/pkg/generated/informer/externalversions/generic.go +++ b/pkg/generated/informer/externalversions/generic.go @@ -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 } diff --git a/pkg/generated/informer/externalversions/zfs/interface.go b/pkg/generated/informer/externalversions/zfs/interface.go index 788da6d85..4d484b6ab 100644 --- a/pkg/generated/informer/externalversions/zfs/interface.go +++ b/pkg/generated/informer/externalversions/zfs/interface.go @@ -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" diff --git a/pkg/generated/informer/externalversions/zfs/v1alpha1/zfssnapshot.go b/pkg/generated/informer/externalversions/zfs/v1alpha1/zfssnapshot.go index 4f310cbb8..7b0850ea1 100644 --- a/pkg/generated/informer/externalversions/zfs/v1alpha1/zfssnapshot.go +++ b/pkg/generated/informer/externalversions/zfs/v1alpha1/zfssnapshot.go @@ -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{}, diff --git a/pkg/generated/informer/externalversions/zfs/v1alpha1/zfsvolume.go b/pkg/generated/informer/externalversions/zfs/v1alpha1/zfsvolume.go index 5d64bee20..656c7ce1c 100644 --- a/pkg/generated/informer/externalversions/zfs/v1alpha1/zfsvolume.go +++ b/pkg/generated/informer/externalversions/zfs/v1alpha1/zfsvolume.go @@ -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{}, diff --git a/pkg/mgmt/snapshot/builder.go b/pkg/mgmt/snapshot/builder.go index 65047de85..2cf58a624 100644 --- a/pkg/mgmt/snapshot/builder.go +++ b/pkg/mgmt/snapshot/builder.go @@ -85,14 +85,14 @@ func (cb *SnapControllerBuilder) withOpenEBSClient(cs clientset.Interface) *Snap // withSnapLister fills snap lister to controller object. func (cb *SnapControllerBuilder) withSnapLister(sl informers.SharedInformerFactory) *SnapControllerBuilder { - snapInformer := sl.Openebs().V1alpha1().ZFSSnapshots() + snapInformer := sl.Zfs().V1alpha1().ZFSSnapshots() cb.SnapController.snapLister = snapInformer.Lister() return cb } // withSnapSynced adds object sync information in cache to controller object. func (cb *SnapControllerBuilder) withSnapSynced(sl informers.SharedInformerFactory) *SnapControllerBuilder { - snapInformer := sl.Openebs().V1alpha1().ZFSSnapshots() + snapInformer := sl.Zfs().V1alpha1().ZFSSnapshots() cb.SnapController.snapSynced = snapInformer.Informer().HasSynced return cb } @@ -116,7 +116,7 @@ func (cb *SnapControllerBuilder) withRecorder(ks kubernetes.Interface) *SnapCont // withEventHandler adds event handlers controller object. func (cb *SnapControllerBuilder) withEventHandler(cvcInformerFactory informers.SharedInformerFactory) *SnapControllerBuilder { - cvcInformer := cvcInformerFactory.Openebs().V1alpha1().ZFSSnapshots() + cvcInformer := cvcInformerFactory.Zfs().V1alpha1().ZFSSnapshots() // Set up an event handler for when Snap resources change cvcInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: cb.SnapController.addSnap, diff --git a/pkg/mgmt/volume/builder.go b/pkg/mgmt/volume/builder.go index 22a13a6f4..d5cfcff4d 100644 --- a/pkg/mgmt/volume/builder.go +++ b/pkg/mgmt/volume/builder.go @@ -85,14 +85,14 @@ func (cb *ZVControllerBuilder) withOpenEBSClient(cs clientset.Interface) *ZVCont // withZVLister fills zv lister to controller object. func (cb *ZVControllerBuilder) withZVLister(sl informers.SharedInformerFactory) *ZVControllerBuilder { - zvInformer := sl.Openebs().V1alpha1().ZFSVolumes() + zvInformer := sl.Zfs().V1alpha1().ZFSVolumes() cb.ZVController.zvLister = zvInformer.Lister() return cb } // withZVSynced adds object sync information in cache to controller object. func (cb *ZVControllerBuilder) withZVSynced(sl informers.SharedInformerFactory) *ZVControllerBuilder { - zvInformer := sl.Openebs().V1alpha1().ZFSVolumes() + zvInformer := sl.Zfs().V1alpha1().ZFSVolumes() cb.ZVController.zvSynced = zvInformer.Informer().HasSynced return cb } @@ -116,7 +116,7 @@ func (cb *ZVControllerBuilder) withRecorder(ks kubernetes.Interface) *ZVControll // withEventHandler adds event handlers controller object. func (cb *ZVControllerBuilder) withEventHandler(cvcInformerFactory informers.SharedInformerFactory) *ZVControllerBuilder { - cvcInformer := cvcInformerFactory.Openebs().V1alpha1().ZFSVolumes() + cvcInformer := cvcInformerFactory.Zfs().V1alpha1().ZFSVolumes() // Set up an event handler for when ZV resources change cvcInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: cb.ZVController.addZV, From 788d0b26270f18586b896fb06888597599ace336 Mon Sep 17 00:00:00 2001 From: prateekpandey14 Date: Wed, 1 Apr 2020 17:41:00 +0530 Subject: [PATCH 3/3] change the dir to deploy/yamls and add the shortname marker Signed-off-by: prateekpandey14 --- buildscripts/update-crd.sh | 2 +- deploy/{crds => yamls}/zfs.openebs.io_zfssnapshots.yaml | 0 deploy/{crds => yamls}/zfs.openebs.io_zfsvolumes.yaml | 1 + pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go | 2 +- 4 files changed, 3 insertions(+), 2 deletions(-) rename deploy/{crds => yamls}/zfs.openebs.io_zfssnapshots.yaml (100%) rename deploy/{crds => yamls}/zfs.openebs.io_zfsvolumes.yaml (99%) diff --git a/buildscripts/update-crd.sh b/buildscripts/update-crd.sh index 18e15bac8..d3530a62c 100755 --- a/buildscripts/update-crd.sh +++ b/buildscripts/update-crd.sh @@ -39,7 +39,7 @@ fi SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd) -$CONTROLLER_GEN crd:trivialVersions=true,preserveUnknownFields=false paths=${SCRIPT_ROOT}/pkg/apis/openebs.io/zfs/v1alpha1 output:crd:artifacts:config=deploy/crds +$CONTROLLER_GEN crd:trivialVersions=true,preserveUnknownFields=false paths=${SCRIPT_ROOT}/pkg/apis/openebs.io/zfs/v1alpha1 output:crd:artifacts:config=deploy/yamls # To use your own boilerplate text use: # --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt diff --git a/deploy/crds/zfs.openebs.io_zfssnapshots.yaml b/deploy/yamls/zfs.openebs.io_zfssnapshots.yaml similarity index 100% rename from deploy/crds/zfs.openebs.io_zfssnapshots.yaml rename to deploy/yamls/zfs.openebs.io_zfssnapshots.yaml diff --git a/deploy/crds/zfs.openebs.io_zfsvolumes.yaml b/deploy/yamls/zfs.openebs.io_zfsvolumes.yaml similarity index 99% rename from deploy/crds/zfs.openebs.io_zfsvolumes.yaml rename to deploy/yamls/zfs.openebs.io_zfsvolumes.yaml index 8719709f2..b55a45278 100644 --- a/deploy/crds/zfs.openebs.io_zfsvolumes.yaml +++ b/deploy/yamls/zfs.openebs.io_zfsvolumes.yaml @@ -47,6 +47,7 @@ spec: plural: zfsvolumes shortNames: - zfsvol + - zv singular: zfsvolume preserveUnknownFields: false scope: Namespaced diff --git a/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go b/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go index 77762d538..01750c02a 100644 --- a/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go +++ b/pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go @@ -26,7 +26,7 @@ import ( // ZFSVolume represents a ZFS based volume // +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Namespaced,shortName=zfsvol +// +kubebuilder:resource:scope=Namespaced,shortName=zfsvol;zv // +kubebuilder:printcolumn:name="ZPool",type=string,JSONPath=`.spec.poolName`,description="ZFS Pool where the volume is created" // +kubebuilder:printcolumn:name="Node",type=string,JSONPath=`.spec.ownerNodeID`,description="Node where the volume is created" // +kubebuilder:printcolumn:name="Size",type=string,JSONPath=`.spec.capacity`,description="Size of the volume"