mirror of
https://github.com/kubevirt/containerized-data-importer.git
synced 2025-06-03 06:30:22 +00:00
smart-clone
Changes and flow: * datavolume-controller: - When clone pvc is requested and smart-clone is applicable -> Create a new VolumeSnapshot. * Introduced smart-clone-controller: - Listens to VolumeSnapshot changes and create a new PVC based on the snapshot. - Upon PVC successful creation, deletes the snapshot for cleaning up. Change-Id: I369fc92e72edb8a2cf584c8cb916795415f9d6e0 Signed-off-by: Daniel Erez <derez@redhat.com> Co-authored-by: Fred Rolland <frolland@redhat.com>
This commit is contained in:
parent
83c12eaae2
commit
5b3109a324
@ -7,19 +7,26 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
crdv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
route1client "github.com/openshift/client-go/route/clientset/versioned"
|
||||
routeinformers "github.com/openshift/client-go/route/informers/externalversions"
|
||||
"github.com/pkg/errors"
|
||||
v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
|
||||
extclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
crdinformers "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
k8sinformers "k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/klog"
|
||||
clientset "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned"
|
||||
informers "kubevirt.io/containerized-data-importer/pkg/client/informers/externalversions"
|
||||
"kubevirt.io/containerized-data-importer/pkg/common"
|
||||
"kubevirt.io/containerized-data-importer/pkg/controller"
|
||||
csiclientset "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
csiinformers "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -105,7 +112,20 @@ func start(cfg *rest.Config, stopCh <-chan struct{}) {
|
||||
klog.Fatalf("Error building example clientset: %s", err.Error())
|
||||
}
|
||||
|
||||
csiClient, err := csiclientset.NewForConfig(cfg)
|
||||
if err != nil {
|
||||
klog.Fatalf("Error building csi clientset: %s", err.Error())
|
||||
}
|
||||
|
||||
extClient, err := extclientset.NewForConfig(cfg)
|
||||
if err != nil {
|
||||
klog.Fatalf("Error building extClient: %s", err.Error())
|
||||
}
|
||||
|
||||
cdiInformerFactory := informers.NewSharedInformerFactory(cdiClient, common.DefaultResyncPeriod)
|
||||
csiInformerFactory := csiinformers.NewFilteredSharedInformerFactory(csiClient, common.DefaultResyncPeriod, "", func(options *v1.ListOptions) {
|
||||
options.LabelSelector = common.CDILabelSelector
|
||||
})
|
||||
pvcInformerFactory := k8sinformers.NewSharedInformerFactory(client, common.DefaultResyncPeriod)
|
||||
podInformerFactory := k8sinformers.NewFilteredSharedInformerFactory(client, common.DefaultResyncPeriod, "", func(options *v1.ListOptions) {
|
||||
options.LabelSelector = common.CDILabelSelector
|
||||
@ -115,6 +135,7 @@ func start(cfg *rest.Config, stopCh <-chan struct{}) {
|
||||
})
|
||||
ingressInformerFactory := k8sinformers.NewSharedInformerFactory(client, common.DefaultResyncPeriod)
|
||||
routeInformerFactory := routeinformers.NewSharedInformerFactory(openshiftClient, common.DefaultResyncPeriod)
|
||||
crdInformerFactory := crdinformers.NewSharedInformerFactory(extClient, common.DefaultResyncPeriod)
|
||||
|
||||
pvcInformer := pvcInformerFactory.Core().V1().PersistentVolumeClaims()
|
||||
podInformer := podInformerFactory.Core().V1().Pods()
|
||||
@ -123,10 +144,14 @@ func start(cfg *rest.Config, stopCh <-chan struct{}) {
|
||||
routeInformer := routeInformerFactory.Route().V1().Routes()
|
||||
dataVolumeInformer := cdiInformerFactory.Cdi().V1alpha1().DataVolumes()
|
||||
configInformer := cdiInformerFactory.Cdi().V1alpha1().CDIConfigs()
|
||||
snapshotInformer := csiInformerFactory.Snapshot().V1alpha1().VolumeSnapshots()
|
||||
crdInformer := crdInformerFactory.Apiextensions().V1beta1().CustomResourceDefinitions().Informer()
|
||||
|
||||
dataVolumeController := controller.NewDataVolumeController(
|
||||
client,
|
||||
cdiClient,
|
||||
csiClient,
|
||||
extClient,
|
||||
pvcInformer,
|
||||
dataVolumeInformer)
|
||||
|
||||
@ -146,6 +171,13 @@ func start(cfg *rest.Config, stopCh <-chan struct{}) {
|
||||
pullPolicy,
|
||||
verbose)
|
||||
|
||||
smartCloneController := controller.NewSmartCloneController(client,
|
||||
cdiClient,
|
||||
csiClient,
|
||||
pvcInformer,
|
||||
snapshotInformer,
|
||||
dataVolumeInformer)
|
||||
|
||||
uploadController := controller.NewUploadController(
|
||||
client,
|
||||
cdiClient,
|
||||
@ -184,10 +216,13 @@ func start(cfg *rest.Config, stopCh <-chan struct{}) {
|
||||
go podInformerFactory.Start(stopCh)
|
||||
go serviceInformerFactory.Start(stopCh)
|
||||
go ingressInformerFactory.Start(stopCh)
|
||||
go crdInformerFactory.Start(stopCh)
|
||||
if isOpenshift := controller.IsOpenshift(client); isOpenshift {
|
||||
go routeInformerFactory.Start(stopCh)
|
||||
}
|
||||
|
||||
addCrdInformerEventHandlers(crdInformer, extClient, csiInformerFactory, smartCloneController, stopCh)
|
||||
|
||||
klog.V(1).Infoln("started informers")
|
||||
|
||||
go func() {
|
||||
@ -225,6 +260,8 @@ func start(cfg *rest.Config, stopCh <-chan struct{}) {
|
||||
}
|
||||
}()
|
||||
|
||||
startSmartController(extClient, csiInformerFactory, smartCloneController, stopCh)
|
||||
|
||||
if err = createReadyFile(); err != nil {
|
||||
klog.Fatalf("Error creating ready file: %+v", err)
|
||||
}
|
||||
@ -280,3 +317,40 @@ func handleSignals() <-chan struct{} {
|
||||
}()
|
||||
return stopCh
|
||||
}
|
||||
|
||||
func addCrdInformerEventHandlers(crdInformer cache.SharedIndexInformer, extClient extclientset.Interface,
|
||||
csiInformerFactory csiinformers.SharedInformerFactory, smartCloneController *controller.SmartCloneController,
|
||||
stopCh <-chan struct{}) {
|
||||
crdInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: func(obj interface{}) {
|
||||
crd := obj.(*v1beta1.CustomResourceDefinition)
|
||||
crdName := crd.Name
|
||||
|
||||
vsClass := crdv1alpha1.VolumeSnapshotClassResourcePlural + "." + crdv1alpha1.GroupName
|
||||
vsContent := crdv1alpha1.VolumeSnapshotContentResourcePlural + "." + crdv1alpha1.GroupName
|
||||
vs := crdv1alpha1.VolumeSnapshotResourcePlural + "." + crdv1alpha1.GroupName
|
||||
|
||||
switch crdName {
|
||||
case vsClass:
|
||||
fallthrough
|
||||
case vsContent:
|
||||
fallthrough
|
||||
case vs:
|
||||
startSmartController(extClient, csiInformerFactory, smartCloneController, stopCh)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func startSmartController(extclient extclientset.Interface, csiInformerFactory csiinformers.SharedInformerFactory,
|
||||
smartCloneController *controller.SmartCloneController, stopCh <-chan struct{}) {
|
||||
if controller.IsCsiCrdsDeployed(extclient) {
|
||||
go csiInformerFactory.Start(stopCh)
|
||||
go func() {
|
||||
err := smartCloneController.Run(1, stopCh)
|
||||
if err != nil {
|
||||
klog.Fatalf("Error running smart clone controller: %+v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ The following statuses are possible.
|
||||
* PVCBound: The PVC associated with the operation has been bound.
|
||||
* Import/Clone/UploadScheduled: The operation (import/clone/upload) has been scheduled.
|
||||
* Import/Clone/UploadInProgress: The operation (import/clone/upload) is in progress.
|
||||
* SnapshotForSmartClone/SmartClonePVCInProgress: The Smart-Cloning operation is in progress.
|
||||
* Succeeded: The operation has succeeded.
|
||||
* Failed: The operation has failed.
|
||||
* Unknown: Unknown status.
|
||||
|
35
doc/smart-clone.md
Normal file
35
doc/smart-clone.md
Normal file
@ -0,0 +1,35 @@
|
||||
# Data Volume cloning with Smart-Cloning
|
||||
|
||||
## Introduction
|
||||
Data Volumes (DV) can be created also by specifying a PVC as an input source. It will trigger a clone of the original PVC. See more details [here](datavolumes.md#pvc-source).
|
||||
|
||||
CDI implementation of cloning a PVC is done with host assisted cloning by streaming the data from the source PVC and write to the new PVC.
|
||||
|
||||
In order to improve the performance of the cloning process, a Smart-Cloning flow using snapshots is introduced.
|
||||
|
||||
## Smart-Cloning
|
||||
CDI use the feature of creating a PVC from snapshot in order to clone PVCs more efficiently when a CSI plugin with snapshot capabilities is available.
|
||||
|
||||
The yaml structure and annotations of the DV are not changed.
|
||||
|
||||
### Create PVC from snapshot
|
||||
Since Kubernetes v1.12, a feature enabling to create a PVC from a volume snapshot has been introduced. See more details [here](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#volume-snapshot-and-restore-volume-from-snapshot-support)
|
||||
|
||||
Note: To enable support for restoring a volume from a volume snapshot data source, enable the `VolumeSnapshotDataSource` feature gate on the apiserver and controller-manager.
|
||||
|
||||
|
||||
### Flow description
|
||||
Here is a description of the flow of the Smart-Cloning:
|
||||
|
||||
- DataVolume is created with a PVC source
|
||||
- Check if Smart-Cloning is possible:
|
||||
* The source and target PVCs must be in the same namespace
|
||||
* The source and target PVCs must be in the same Storage Class
|
||||
* There must be a Snapshot Class associated with the Storage Class
|
||||
- If Smart-Cloning is possible:
|
||||
* Create a snapshot of the source PVC
|
||||
* Create a PVC from the created snapshot
|
||||
* Delete the snapshot
|
||||
- If Smart-Cloning is not possible:
|
||||
* Trigger a host-assisted clone
|
||||
|
20
glide.lock
generated
20
glide.lock
generated
@ -1,5 +1,5 @@
|
||||
hash: 017a56fcd0a1df5f134329ef8570a2728b823748621c728c13d287f70e91285e
|
||||
updated: 2019-05-15T08:28:52.7344063Z
|
||||
hash: 1aa17cf68605325907751b9dee5bb31dc90ef5135ed97547c05a0b248bf21a51
|
||||
updated: 2019-05-19T09:08:43.794386139Z
|
||||
imports:
|
||||
- name: github.com/appscode/jsonpatch
|
||||
version: 7c0e3b262f30165a8ec3d0b4c6059fd92703bfb2
|
||||
@ -67,7 +67,7 @@ imports:
|
||||
- compiler
|
||||
- extensions
|
||||
- name: github.com/gorilla/mux
|
||||
version: c5c6c98bc25355028a63748a498942a6398ccd22
|
||||
version: ed099d42384823742bba0bf9a72b53b55c9e2e38
|
||||
- name: github.com/gregjones/httpcache
|
||||
version: 787624de3eb7bd915c329cba748687a3b22666a6
|
||||
subpackages:
|
||||
@ -89,6 +89,11 @@ imports:
|
||||
version: ab8a2e0c74be9d3be70b3184d9acc634935ded82
|
||||
- name: github.com/kelseyhightower/envconfig
|
||||
version: f611eb38b3875cc3bd991ca91c51d06446afa14c
|
||||
- name: github.com/kubernetes-csi/external-snapshotter
|
||||
version: e49856eb417cbafa51e5a3fb3bd0ac9e31ab1873
|
||||
subpackages:
|
||||
- pkg/apis
|
||||
- pkg/apis/volumesnapshot/v1alpha1
|
||||
- name: github.com/mailru/easyjson
|
||||
version: 2f5df55504ebc322e4d52d34df6a1f5b503bf26d
|
||||
subpackages:
|
||||
@ -136,7 +141,7 @@ imports:
|
||||
- reporters/stenographer/support/go-isatty
|
||||
- types
|
||||
- name: github.com/onsi/gomega
|
||||
version: f0e010e04c08c48a875f83d17df37b04eb3a985b
|
||||
version: 6a48b4839f850fe696893f09085e3fc485d74a4a
|
||||
subpackages:
|
||||
- format
|
||||
- gbytes
|
||||
@ -350,8 +355,15 @@ imports:
|
||||
- pkg/apis/apiextensions
|
||||
- pkg/apis/apiextensions/v1beta1
|
||||
- pkg/client/clientset/clientset
|
||||
- pkg/client/clientset/clientset/fake
|
||||
- pkg/client/clientset/clientset/scheme
|
||||
- pkg/client/clientset/clientset/typed/apiextensions/v1beta1
|
||||
- pkg/client/clientset/clientset/typed/apiextensions/v1beta1/fake
|
||||
- pkg/client/informers/externalversions
|
||||
- pkg/client/informers/externalversions/apiextensions
|
||||
- pkg/client/informers/externalversions/apiextensions/v1beta1
|
||||
- pkg/client/informers/externalversions/internalinterfaces
|
||||
- pkg/client/listers/apiextensions/v1beta1
|
||||
- name: k8s.io/apimachinery
|
||||
version: 86fb29eff6288413d76bd8506874fddd9fccdff0
|
||||
subpackages:
|
||||
|
@ -40,3 +40,5 @@ import:
|
||||
version: rebase-1.13.4
|
||||
- package: github.com/openshift/client-go
|
||||
version: rebase-1.13.4
|
||||
- package: github.com/kubernetes-csi/external-snapshotter/pkg/apis
|
||||
version: e49856eb417cbafa51e5a3fb3bd0ac9e31ab1873
|
||||
|
@ -39,8 +39,9 @@ arg_kubeconfig="${KUBECONFIG:+-kubeconfig=$KUBECONFIG}"
|
||||
arg_kubectl="${KUBECTL:+-kubectl-path=$KUBECTL}"
|
||||
arg_oc="${KUBECTL:+-oc-path=$KUBECTL}"
|
||||
arg_gocli="${GOCLI:+-gocli-path=$GOCLI}"
|
||||
arg_sc_snap="-snapshot-sc=csi-rbd"
|
||||
|
||||
test_args="${test_args} -ginkgo.v ${arg_master} ${arg_namespace} ${arg_kubeconfig} ${arg_kubectl} ${arg_oc} ${arg_gocli}"
|
||||
test_args="${test_args} -ginkgo.v ${arg_master} ${arg_namespace} ${arg_kubeconfig} ${arg_kubectl} ${arg_oc} ${arg_gocli} ${arg_sc_snap}"
|
||||
|
||||
echo 'Wait until all CDI Pods are ready'
|
||||
retry_counter=0
|
||||
|
@ -26,6 +26,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(
|
||||
|
||||
find "${SCRIPT_ROOT}/pkg/" -name "*generated*.go" -exec rm {} -f \;
|
||||
rm -rf "${SCRIPT_ROOT}/pkg/client"
|
||||
rm -rf "${SCRIPT_ROOT}/pkg/snapshot-client"
|
||||
|
||||
${SCRIPT_ROOT}/hack/build/build-go.sh generate
|
||||
|
||||
@ -38,6 +39,11 @@ ${CODEGEN_PKG}/generate-groups.sh "client,informer,lister" \
|
||||
"core:v1alpha1 upload:v1alpha1" \
|
||||
--go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
|
||||
|
||||
${CODEGEN_PKG}/generate-groups.sh "client,informer,lister" \
|
||||
kubevirt.io/containerized-data-importer/pkg/snapshot-client github.com/kubernetes-csi/external-snapshotter/pkg/apis \
|
||||
volumesnapshot:v1alpha1 \
|
||||
--go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
|
||||
|
||||
(cd ${SCRIPT_ROOT}/tools/openapi-spec-generator/ && go build -o ../../bin/openapi-spec-generator)
|
||||
|
||||
${SCRIPT_ROOT}/bin/openapi-spec-generator > ${SCRIPT_ROOT}/api/openapi-spec/swagger.json
|
||||
|
@ -152,6 +152,12 @@ const (
|
||||
// CloneInProgress represents a data volume with a current phase of CloneInProgress
|
||||
CloneInProgress DataVolumePhase = "CloneInProgress"
|
||||
|
||||
// SnapshotForSmartCloneInProgress represents a data volume with a current phase of SnapshotForSmartCloneInProgress
|
||||
SnapshotForSmartCloneInProgress DataVolumePhase = "SnapshotForSmartCloneInProgress"
|
||||
|
||||
// SmartClonePVCInProgress represents a data volume with a current phase of SmartClonePVCInProgress
|
||||
SmartClonePVCInProgress DataVolumePhase = "SmartClonePVCInProgress"
|
||||
|
||||
// UploadScheduled represents a data volume with a current phase of UploadScheduled
|
||||
UploadScheduled DataVolumePhase = "UploadScheduled"
|
||||
|
||||
|
@ -78,6 +78,9 @@ const (
|
||||
// ClonerSocketPath (controller pkg only)
|
||||
ClonerSocketPath = "/tmp/clone/socket"
|
||||
|
||||
// SmartClonerCDILabel is the label applied to resources created by the smart-clone controller
|
||||
SmartClonerCDILabel = "cdi-smart-clone"
|
||||
|
||||
// UploadServerCDILabel is the label applied to upload server resources
|
||||
UploadServerCDILabel = "cdi-upload-server"
|
||||
// UploadServerPodname is name of the upload server pod container
|
||||
|
@ -185,6 +185,7 @@ func (c *Controller) run(threadiness int, stopCh <-chan struct{}, controller int
|
||||
if !cache.WaitForCacheSync(stopCh, c.podInformer.HasSynced) {
|
||||
return errors.New("Timeout waiting for pod cache sync")
|
||||
}
|
||||
|
||||
klog.V(3).Infoln("Controller cache has synced")
|
||||
for i := 0; i < threadiness; i++ {
|
||||
//Go is not pure object oriented language. The command repetition below is a result of that.
|
||||
|
@ -26,8 +26,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
csisnapshotv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
"github.com/pkg/errors"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
extclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
@ -51,6 +53,7 @@ import (
|
||||
listers "kubevirt.io/containerized-data-importer/pkg/client/listers/core/v1alpha1"
|
||||
"kubevirt.io/containerized-data-importer/pkg/common"
|
||||
expectations "kubevirt.io/containerized-data-importer/pkg/expectations"
|
||||
csiclientset "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
)
|
||||
|
||||
const controllerAgentName = "datavolume-controller"
|
||||
@ -78,6 +81,12 @@ const (
|
||||
CloneScheduled = "CloneScheduled"
|
||||
// CloneInProgress provides a const to indicate clone is in progress
|
||||
CloneInProgress = "CloneInProgress"
|
||||
// SnapshotForSmartCloneInProgress provides a const to indicate snapshot creation for smart-clone is in progress
|
||||
SnapshotForSmartCloneInProgress = "SnapshotForSmartCloneInProgress"
|
||||
// SnapshotForSmartCloneCreated provides a const to indicate snapshot creation for smart-clone has been completed
|
||||
SnapshotForSmartCloneCreated = "SnapshotForSmartCloneCreated"
|
||||
// SmartClonePVCInProgress provides a const to indicate snapshot creation for smart-clone is in progress
|
||||
SmartClonePVCInProgress = "SmartClonePVCInProgress"
|
||||
// CloneFailed provides a const to indicate clone has failed
|
||||
CloneFailed = "CloneFailed"
|
||||
// CloneSucceeded provides a const to indicate clone has succeeded
|
||||
@ -114,6 +123,10 @@ const (
|
||||
MessageCloneFailed = "Cloning from %s/%s into %s/%s failed"
|
||||
// MessageCloneSucceeded provides a const to form clone has succeeded message
|
||||
MessageCloneSucceeded = "Successfully cloned from %s/%s into %s/%s"
|
||||
// MessageSmartCloneInProgress provides a const to form snapshot for smart-clone is in progress message
|
||||
MessageSmartCloneInProgress = "Creating snapshot for smart-clone is in progress (for pvc %s/%s)"
|
||||
// MessageSmartClonePVCInProgress provides a const to form snapshot for smart-clone is in progress message
|
||||
MessageSmartClonePVCInProgress = "Creating PVC for smart-clone is in progress (for pvc %s/%s)"
|
||||
// MessageUploadScheduled provides a const to form upload is scheduled message
|
||||
MessageUploadScheduled = "Upload into %s scheduled"
|
||||
// MessageUploadReady provides a const to form upload is ready message
|
||||
@ -132,6 +145,8 @@ type DataVolumeController struct {
|
||||
kubeclientset kubernetes.Interface
|
||||
// clientset is a clientset for our own API group
|
||||
cdiClientSet clientset.Interface
|
||||
csiClientSet csiclientset.Interface
|
||||
extClientSet extclientset.Interface
|
||||
|
||||
pvcLister corelisters.PersistentVolumeClaimLister
|
||||
pvcsSynced cache.InformerSynced
|
||||
@ -157,6 +172,8 @@ type DataVolumeEvent struct {
|
||||
func NewDataVolumeController(
|
||||
kubeclientset kubernetes.Interface,
|
||||
cdiClientSet clientset.Interface,
|
||||
csiClientSet csiclientset.Interface,
|
||||
extClientSet extclientset.Interface,
|
||||
pvcInformer coreinformers.PersistentVolumeClaimInformer,
|
||||
dataVolumeInformer informers.DataVolumeInformer) *DataVolumeController {
|
||||
|
||||
@ -173,6 +190,8 @@ func NewDataVolumeController(
|
||||
controller := &DataVolumeController{
|
||||
kubeclientset: kubeclientset,
|
||||
cdiClientSet: cdiClientSet,
|
||||
csiClientSet: csiClientSet,
|
||||
extClientSet: extClientSet,
|
||||
pvcLister: pvcInformer.Lister(),
|
||||
pvcsSynced: pvcInformer.Informer().HasSynced,
|
||||
dataVolumesLister: dataVolumeInformer.Lister(),
|
||||
@ -307,7 +326,6 @@ func (c *DataVolumeController) processNextWorkItem() bool {
|
||||
// converge the two. It then updates the Status block of the DataVolume resource
|
||||
// with the current status of the resource.
|
||||
func (c *DataVolumeController) syncHandler(key string) error {
|
||||
|
||||
exists := true
|
||||
|
||||
// Convert the namespace/name string into a distinct namespace and name
|
||||
@ -352,20 +370,37 @@ func (c *DataVolumeController) syncHandler(key string) error {
|
||||
return errors.Errorf(msg)
|
||||
}
|
||||
|
||||
// expectations prevent us from creating multiple pods. An expectation forces
|
||||
// us to observe a pod's creation in the cache.
|
||||
needsSync := c.pvcExpectations.SatisfiedExpectations(key)
|
||||
|
||||
if !exists && needsSync {
|
||||
newPvc, err := newPersistentVolumeClaim(dataVolume)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.pvcExpectations.ExpectCreations(key, 1)
|
||||
pvc, err = c.kubeclientset.CoreV1().PersistentVolumeClaims(dataVolume.Namespace).Create(newPvc)
|
||||
if err != nil {
|
||||
c.pvcExpectations.CreationObserved(key)
|
||||
return err
|
||||
}
|
||||
if canUpdateProgress(newPvc.Annotations) {
|
||||
go c.scheduleProgressUpdate(dataVolume.Name, dataVolume.Namespace, pvc.GetUID())
|
||||
snapshotClassName := c.getSnapshotClassForSmartClone(dataVolume)
|
||||
if snapshotClassName != "" {
|
||||
klog.V(3).Infof("Smart-Clone via Snapshot is available with Volume Snapshot Class: %s", snapshotClassName)
|
||||
newSnapshot := newSnapshot(dataVolume, snapshotClassName)
|
||||
_, err := c.csiClientSet.SnapshotV1alpha1().VolumeSnapshots(newSnapshot.Namespace).Create(newSnapshot)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = c.updateSmartCloneStatusPhase(cdiv1.SnapshotForSmartCloneInProgress, dataVolume)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
newPvc, err := newPersistentVolumeClaim(dataVolume)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.pvcExpectations.ExpectCreations(key, 1)
|
||||
pvc, err = c.kubeclientset.CoreV1().PersistentVolumeClaims(dataVolume.Namespace).Create(newPvc)
|
||||
if err != nil {
|
||||
c.pvcExpectations.CreationObserved(key)
|
||||
return err
|
||||
}
|
||||
if canUpdateProgress(newPvc.Annotations) {
|
||||
go c.scheduleProgressUpdate(dataVolume.Name, dataVolume.Namespace, pvc.GetUID())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,6 +441,134 @@ func (c *DataVolumeController) scheduleProgressUpdate(dataVolumeName, dataVolume
|
||||
}
|
||||
}
|
||||
|
||||
func (c *DataVolumeController) getSnapshotClassForSmartClone(dataVolume *cdiv1.DataVolume) string {
|
||||
// Check if clone is requested
|
||||
if dataVolume.Spec.Source.PVC == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Check if relevant CRDs are available
|
||||
if !IsCsiCrdsDeployed(c.extClientSet) {
|
||||
klog.V(3).Infof("Missing CSI snapshotter CRDs")
|
||||
return ""
|
||||
}
|
||||
|
||||
// Find source PVC
|
||||
sourcePvcNs := dataVolume.Spec.Source.PVC.Namespace
|
||||
if sourcePvcNs == "" {
|
||||
sourcePvcNs = dataVolume.Namespace
|
||||
}
|
||||
|
||||
pvc, err := c.pvcLister.PersistentVolumeClaims(sourcePvcNs).Get(dataVolume.Spec.Source.PVC.Name)
|
||||
if err != nil {
|
||||
if k8serrors.IsNotFound(err) {
|
||||
klog.V(3).Infof("Source PVC is missing: %s/%s", dataVolume.Spec.Source.PVC.Namespace, dataVolume.Spec.Source.PVC.Name)
|
||||
}
|
||||
runtime.HandleError(err)
|
||||
return ""
|
||||
}
|
||||
|
||||
targetPvcStorageClassName := dataVolume.Spec.PVC.StorageClassName
|
||||
|
||||
// Handle unspecified storage class name, fallback to default storage class
|
||||
if targetPvcStorageClassName == nil {
|
||||
storageclasses, err := c.kubeclientset.StorageV1().StorageClasses().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
runtime.HandleError(err)
|
||||
return ""
|
||||
}
|
||||
for _, storageClass := range storageclasses.Items {
|
||||
if storageClass.Annotations["storageclass.kubernetes.io/is-default-class"] == "true" {
|
||||
targetPvcStorageClassName = &storageClass.Name
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if targetPvcStorageClassName == nil {
|
||||
klog.V(3).Infof("Target PVC's Storage Class not found")
|
||||
return ""
|
||||
}
|
||||
|
||||
sourcePvcStorageClassName := pvc.Spec.StorageClassName
|
||||
|
||||
// Compare source and target storage classess
|
||||
if *sourcePvcStorageClassName != *targetPvcStorageClassName {
|
||||
klog.V(3).Infof("Source PVC and target PVC belong to different storage classes: %s - %s",
|
||||
*sourcePvcStorageClassName, *targetPvcStorageClassName)
|
||||
return ""
|
||||
}
|
||||
|
||||
// Compare source and target namespaces
|
||||
if pvc.Namespace != dataVolume.Namespace {
|
||||
klog.V(3).Infof("Source PVC and target PVC belong to different namespaces: %s - %s",
|
||||
pvc.Namespace, dataVolume.Namespace)
|
||||
return ""
|
||||
}
|
||||
|
||||
// Fetch the source storage class
|
||||
storageclass, err := c.kubeclientset.StorageV1().StorageClasses().Get(*sourcePvcStorageClassName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
runtime.HandleError(err)
|
||||
return ""
|
||||
}
|
||||
|
||||
// List the snapshot classes
|
||||
scs, err := c.csiClientSet.SnapshotV1alpha1().VolumeSnapshotClasses().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
klog.V(3).Infof("Cannot list snapshot classes")
|
||||
return ""
|
||||
}
|
||||
for _, snapshotClass := range scs.Items {
|
||||
// Validate association between snapshot class and storage class
|
||||
if snapshotClass.Snapshotter == storageclass.Provisioner {
|
||||
klog.V(3).Infof("smart-clone is applicable for datavolume '%s' with snapshot class '%s'",
|
||||
dataVolume.Name, snapshotClass.Name)
|
||||
return snapshotClass.Name
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func newSnapshot(dataVolume *cdiv1.DataVolume, snapshotClassName string) *csisnapshotv1.VolumeSnapshot {
|
||||
annotations := make(map[string]string)
|
||||
annotations[AnnSmartCloneRequest] = "true"
|
||||
className := snapshotClassName
|
||||
labels := map[string]string{
|
||||
common.CDILabelKey: common.CDILabelValue,
|
||||
common.CDIComponentLabel: common.SmartClonerCDILabel,
|
||||
}
|
||||
snapshot := &csisnapshotv1.VolumeSnapshot{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: dataVolume.Name,
|
||||
Namespace: dataVolume.Namespace,
|
||||
Labels: labels,
|
||||
Annotations: annotations,
|
||||
OwnerReferences: []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(dataVolume, schema.GroupVersionKind{
|
||||
Group: cdiv1.SchemeGroupVersion.Group,
|
||||
Version: cdiv1.SchemeGroupVersion.Version,
|
||||
Kind: "DataVolume",
|
||||
}),
|
||||
},
|
||||
},
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: csisnapshotv1.SchemeGroupVersion.String(),
|
||||
Kind: "VolumeSnapshot",
|
||||
},
|
||||
Status: csisnapshotv1.VolumeSnapshotStatus{},
|
||||
Spec: csisnapshotv1.VolumeSnapshotSpec{
|
||||
Source: &corev1.TypedLocalObjectReference{
|
||||
Name: dataVolume.Spec.Source.PVC.Name,
|
||||
Kind: "PersistentVolumeClaim",
|
||||
},
|
||||
VolumeSnapshotClassName: &className,
|
||||
},
|
||||
}
|
||||
return snapshot
|
||||
}
|
||||
|
||||
func (c *DataVolumeController) updateImportStatusPhase(pvc *corev1.PersistentVolumeClaim, dataVolumeCopy *cdiv1.DataVolume, event *DataVolumeEvent) {
|
||||
phase, ok := pvc.Annotations[AnnPodPhase]
|
||||
if ok {
|
||||
@ -437,6 +600,21 @@ func (c *DataVolumeController) updateImportStatusPhase(pvc *corev1.PersistentVol
|
||||
}
|
||||
}
|
||||
|
||||
func (c *DataVolumeController) updateSmartCloneStatusPhase(phase cdiv1.DataVolumePhase, dataVolume *cdiv1.DataVolume) error {
|
||||
var dataVolumeCopy = dataVolume.DeepCopy()
|
||||
var event DataVolumeEvent
|
||||
|
||||
switch phase {
|
||||
case cdiv1.SnapshotForSmartCloneInProgress:
|
||||
dataVolumeCopy.Status.Phase = cdiv1.SnapshotForSmartCloneInProgress
|
||||
event.eventType = corev1.EventTypeNormal
|
||||
event.reason = SnapshotForSmartCloneInProgress
|
||||
event.message = fmt.Sprintf(MessageSmartCloneInProgress, dataVolumeCopy.Spec.Source.PVC.Namespace, dataVolumeCopy.Spec.Source.PVC.Name)
|
||||
}
|
||||
|
||||
return c.emitEvent(dataVolume, dataVolumeCopy, &event)
|
||||
}
|
||||
|
||||
func (c *DataVolumeController) updateCloneStatusPhase(pvc *corev1.PersistentVolumeClaim, dataVolumeCopy *cdiv1.DataVolume, event *DataVolumeEvent) {
|
||||
phase, ok := pvc.Annotations[AnnPodPhase]
|
||||
if ok {
|
||||
@ -502,12 +680,11 @@ func (c *DataVolumeController) updateUploadStatusPhase(pvc *corev1.PersistentVol
|
||||
|
||||
func (c *DataVolumeController) updateDataVolumeStatus(dataVolume *cdiv1.DataVolume, pvc *corev1.PersistentVolumeClaim) error {
|
||||
dataVolumeCopy := dataVolume.DeepCopy()
|
||||
var err error
|
||||
var event DataVolumeEvent
|
||||
|
||||
curPhase := dataVolumeCopy.Status.Phase
|
||||
if pvc == nil {
|
||||
if curPhase != cdiv1.PhaseUnset && curPhase != cdiv1.Pending {
|
||||
if curPhase != cdiv1.PhaseUnset && curPhase != cdiv1.Pending && curPhase != cdiv1.SnapshotForSmartCloneInProgress {
|
||||
|
||||
// if pvc doesn't exist and we're not still initializing, then
|
||||
// something has gone wrong. Perhaps the PVC was deleted out from
|
||||
@ -519,6 +696,7 @@ func (c *DataVolumeController) updateDataVolumeStatus(dataVolume *cdiv1.DataVolu
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
switch pvc.Status.Phase {
|
||||
case corev1.ClaimPending:
|
||||
dataVolumeCopy.Status.Phase = cdiv1.Pending
|
||||
@ -558,15 +736,20 @@ func (c *DataVolumeController) updateDataVolumeStatus(dataVolume *cdiv1.DataVolu
|
||||
}
|
||||
}
|
||||
|
||||
return c.emitEvent(dataVolume, dataVolumeCopy, &event)
|
||||
}
|
||||
|
||||
func (c *DataVolumeController) emitEvent(dataVolume *cdiv1.DataVolume, dataVolumeCopy *cdiv1.DataVolume, event *DataVolumeEvent) error {
|
||||
// Only update the object if something actually changed in the status.
|
||||
if !reflect.DeepEqual(dataVolume.Status, dataVolumeCopy.Status) {
|
||||
_, err = c.cdiClientSet.CdiV1alpha1().DataVolumes(dataVolume.Namespace).Update(dataVolumeCopy)
|
||||
_, err := c.cdiClientSet.CdiV1alpha1().DataVolumes(dataVolume.Namespace).Update(dataVolumeCopy)
|
||||
// Emit the event only when the status change happens, not every time
|
||||
if event.eventType != "" {
|
||||
c.recorder.Event(dataVolume, event.eventType, event.reason, event.message)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
// canUpdateProgress determines what kind annotations will be able generate progress update information.
|
||||
|
@ -32,9 +32,11 @@ import (
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
|
||||
extfake "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake"
|
||||
cdiv1 "kubevirt.io/containerized-data-importer/pkg/apis/core/v1alpha1"
|
||||
"kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/fake"
|
||||
informers "kubevirt.io/containerized-data-importer/pkg/client/informers/externalversions"
|
||||
csifake "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/fake"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -46,7 +48,9 @@ type fixture struct {
|
||||
t *testing.T
|
||||
|
||||
client *fake.Clientset
|
||||
csiclient *csifake.Clientset
|
||||
kubeclient *k8sfake.Clientset
|
||||
extclient *extfake.Clientset
|
||||
|
||||
// Objects to put in the store.
|
||||
dataVolumeLister []*cdiv1.DataVolume
|
||||
@ -59,6 +63,8 @@ type fixture struct {
|
||||
// Objects from here preloaded into NewSimpleFake.
|
||||
kubeobjects []runtime.Object
|
||||
objects []runtime.Object
|
||||
csiobjects []runtime.Object
|
||||
extobjects []runtime.Object
|
||||
}
|
||||
|
||||
func newFixture(t *testing.T) *fixture {
|
||||
@ -66,6 +72,14 @@ func newFixture(t *testing.T) *fixture {
|
||||
f.t = t
|
||||
f.objects = []runtime.Object{}
|
||||
f.kubeobjects = []runtime.Object{}
|
||||
f.csiobjects = []runtime.Object{}
|
||||
f.extobjects = []runtime.Object{}
|
||||
return f
|
||||
}
|
||||
|
||||
func newFixtureCsiCrds(t *testing.T) *fixture {
|
||||
f := newFixture(t)
|
||||
f.extobjects = append(f.extobjects, createVolumeSnapshotContentCrd(), createVolumeSnapshotClassCrd(), createVolumeSnapshotCrd())
|
||||
return f
|
||||
}
|
||||
|
||||
@ -88,6 +102,10 @@ func newImportDataVolume(name string) *cdiv1.DataVolume {
|
||||
}
|
||||
|
||||
func newCloneDataVolume(name string) *cdiv1.DataVolume {
|
||||
return newCloneDataVolumeWithPVCNS(name, "default")
|
||||
}
|
||||
|
||||
func newCloneDataVolumeWithPVCNS(name string, pvcNamespace string) *cdiv1.DataVolume {
|
||||
return &cdiv1.DataVolume{
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: cdiv1.SchemeGroupVersion.String()},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -98,7 +116,7 @@ func newCloneDataVolume(name string) *cdiv1.DataVolume {
|
||||
Source: cdiv1.DataVolumeSource{
|
||||
PVC: &cdiv1.DataVolumeSourcePVC{
|
||||
Name: "test",
|
||||
Namespace: "default",
|
||||
Namespace: pvcNamespace,
|
||||
},
|
||||
},
|
||||
PVC: &corev1.PersistentVolumeClaimSpec{},
|
||||
@ -140,7 +158,9 @@ func newBlankImageDataVolume(name string) *cdiv1.DataVolume {
|
||||
|
||||
func (f *fixture) newController() (*DataVolumeController, informers.SharedInformerFactory, kubeinformers.SharedInformerFactory) {
|
||||
f.client = fake.NewSimpleClientset(f.objects...)
|
||||
f.csiclient = csifake.NewSimpleClientset(f.csiobjects...)
|
||||
f.kubeclient = k8sfake.NewSimpleClientset(f.kubeobjects...)
|
||||
f.extclient = extfake.NewSimpleClientset(f.extobjects...)
|
||||
|
||||
i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc())
|
||||
k8sI := kubeinformers.NewSharedInformerFactory(f.kubeclient, noResyncPeriodFunc())
|
||||
@ -155,6 +175,8 @@ func (f *fixture) newController() (*DataVolumeController, informers.SharedInform
|
||||
|
||||
c := NewDataVolumeController(f.kubeclient,
|
||||
f.client,
|
||||
f.csiclient,
|
||||
f.extclient,
|
||||
k8sI.Core().V1().PersistentVolumeClaims(),
|
||||
i.Cdi().V1alpha1().DataVolumes())
|
||||
|
||||
@ -782,4 +804,130 @@ func TestBlankImageClaimLost(t *testing.T) {
|
||||
result.Status.Phase = cdiv1.Failed
|
||||
f.expectUpdateDataVolumeStatusAction(result)
|
||||
f.run(getKey(dataVolume, t))
|
||||
|
||||
}
|
||||
|
||||
// Smart-clone test
|
||||
func TestSmartCloneNoPVCSource(t *testing.T) {
|
||||
f := newFixtureCsiCrds(t)
|
||||
dataVolume := newImportDataVolume("test")
|
||||
c, _, _ := f.newController()
|
||||
snapClass := c.getSnapshotClassForSmartClone(dataVolume)
|
||||
if snapClass != "" {
|
||||
t.Errorf("Should not be smart-clone applicable, no source PVC")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSmartCloneNoCsiCrds(t *testing.T) {
|
||||
f := newFixture(t)
|
||||
scName := "test"
|
||||
sc := createStorageClass(scName, map[string]string{
|
||||
AnnDefaultStorageClass: "true",
|
||||
})
|
||||
f.kubeobjects = append(f.kubeobjects, sc)
|
||||
dataVolume := newCloneDataVolume("test")
|
||||
pvc := createPvcInStorageClass("test", "default", &scName, nil, nil)
|
||||
f.pvcLister = append(f.pvcLister, pvc)
|
||||
c, _, _ := f.newController()
|
||||
snapClass := c.getSnapshotClassForSmartClone(dataVolume)
|
||||
if snapClass != "" {
|
||||
t.Errorf("Should not be smart-clone applicable, no CSI CRDs")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSmartClonePVCSourceDifferentSC(t *testing.T) {
|
||||
f := newFixtureCsiCrds(t)
|
||||
sc := createStorageClass("test2", map[string]string{
|
||||
AnnDefaultStorageClass: "true",
|
||||
})
|
||||
f.kubeobjects = append(f.kubeobjects, sc)
|
||||
dataVolume := newCloneDataVolume("test")
|
||||
sourceScName := "test"
|
||||
pvc := createPvcInStorageClass("test", "default", &sourceScName, nil, nil)
|
||||
f.pvcLister = append(f.pvcLister, pvc)
|
||||
c, _, _ := f.newController()
|
||||
|
||||
snapClass := c.getSnapshotClassForSmartClone(dataVolume)
|
||||
if snapClass != "" {
|
||||
t.Errorf("Should not be smart-clone applicable, different Storage classes source/target PVC")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNoSmartClonePVCSourceDifferentNS(t *testing.T) {
|
||||
f := newFixtureCsiCrds(t)
|
||||
sc := createStorageClass("test", map[string]string{
|
||||
AnnDefaultStorageClass: "true",
|
||||
})
|
||||
f.kubeobjects = append(f.kubeobjects, sc)
|
||||
dataVolume := newCloneDataVolumeWithPVCNS("test", "namespace2")
|
||||
sourceScName := "test"
|
||||
pvc := createPvcInStorageClass("test", "namespace2", &sourceScName, nil, nil)
|
||||
f.pvcLister = append(f.pvcLister, pvc)
|
||||
c, _, _ := f.newController()
|
||||
|
||||
snapClass := c.getSnapshotClassForSmartClone(dataVolume)
|
||||
if snapClass != "" {
|
||||
t.Errorf("Should not be smart-clone applicable, different NameSpaces source/target PVC")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNoSmartCloneNoSnapshotClass(t *testing.T) {
|
||||
f := newFixtureCsiCrds(t)
|
||||
scName := "test"
|
||||
sc := createStorageClass(scName, map[string]string{
|
||||
AnnDefaultStorageClass: "true",
|
||||
})
|
||||
f.kubeobjects = append(f.kubeobjects, sc)
|
||||
dataVolume := newCloneDataVolume("test")
|
||||
pvc := createPvcInStorageClass("test", "default", &scName, nil, nil)
|
||||
f.pvcLister = append(f.pvcLister, pvc)
|
||||
c, _, _ := f.newController()
|
||||
|
||||
snapClass := c.getSnapshotClassForSmartClone(dataVolume)
|
||||
if snapClass != "" {
|
||||
t.Errorf("Should not be smart-clone applicable, different NameSpaces soure/target PVC")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSmartCloneNotMatchingStorageClass(t *testing.T) {
|
||||
f := newFixtureCsiCrds(t)
|
||||
scName := "test"
|
||||
sc := createStorageClass(scName, map[string]string{
|
||||
AnnDefaultStorageClass: "true",
|
||||
})
|
||||
f.kubeobjects = append(f.kubeobjects, sc)
|
||||
snapClass := createSnapshotClass("snap-class", nil, "csi-snap")
|
||||
f.csiobjects = append(f.csiobjects, snapClass)
|
||||
dataVolume := newCloneDataVolume("test")
|
||||
pvc := createPvcInStorageClass("test", "default", &scName, nil, nil)
|
||||
f.pvcLister = append(f.pvcLister, pvc)
|
||||
|
||||
c, _, _ := f.newController()
|
||||
|
||||
resultSnapClass := c.getSnapshotClassForSmartClone(dataVolume)
|
||||
if resultSnapClass != "" {
|
||||
t.Errorf("Should not be smart-clone applicable, No matching Snapshot Class")
|
||||
}
|
||||
}
|
||||
func TestSmartCloneMatchingStorageClass(t *testing.T) {
|
||||
f := newFixtureCsiCrds(t)
|
||||
scName := "test"
|
||||
sc := createStorageClassWithProvisioner(scName, map[string]string{
|
||||
AnnDefaultStorageClass: "true",
|
||||
}, "csi-plugin")
|
||||
f.kubeobjects = append(f.kubeobjects, sc)
|
||||
expectedSnapshotClass := "snap-class"
|
||||
snapClass := createSnapshotClass(expectedSnapshotClass, nil, "csi-plugin")
|
||||
f.csiobjects = append(f.csiobjects, snapClass)
|
||||
dataVolume := newCloneDataVolume("test")
|
||||
pvc := createPvcInStorageClass("test", "default", &scName, nil, nil)
|
||||
f.pvcLister = append(f.pvcLister, pvc)
|
||||
|
||||
c, _, _ := f.newController()
|
||||
|
||||
snapClassName := c.getSnapshotClassForSmartClone(dataVolume)
|
||||
|
||||
if snapClassName != expectedSnapshotClass {
|
||||
t.Errorf("Should be expected SnapshotClass")
|
||||
}
|
||||
}
|
||||
|
388
pkg/controller/smart-clone-controller.go
Normal file
388
pkg/controller/smart-clone-controller.go
Normal file
@ -0,0 +1,388 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"reflect"
|
||||
|
||||
csisnapshotv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
"github.com/pkg/errors"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
corelisters "k8s.io/client-go/listers/core/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
"k8s.io/klog"
|
||||
cdiv1 "kubevirt.io/containerized-data-importer/pkg/apis/core/v1alpha1"
|
||||
clientset "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned"
|
||||
cdischeme "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme"
|
||||
informers "kubevirt.io/containerized-data-importer/pkg/client/informers/externalversions/core/v1alpha1"
|
||||
listers "kubevirt.io/containerized-data-importer/pkg/client/listers/core/v1alpha1"
|
||||
"kubevirt.io/containerized-data-importer/pkg/common"
|
||||
csiclientset "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
snapshotsinformers "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/volumesnapshot/v1alpha1"
|
||||
snapshotslisters "kubevirt.io/containerized-data-importer/pkg/snapshot-client/listers/volumesnapshot/v1alpha1"
|
||||
)
|
||||
|
||||
const (
|
||||
//AnnSmartCloneRequest sets our expected annotation for a CloneRequest
|
||||
AnnSmartCloneRequest = "k8s.io/SmartCloneRequest"
|
||||
)
|
||||
|
||||
// SmartCloneController represents the CDI SmartClone Controller
|
||||
type SmartCloneController struct {
|
||||
clientset kubernetes.Interface
|
||||
cdiClientSet clientset.Interface
|
||||
csiClientSet csiclientset.Interface
|
||||
|
||||
snapshotInformer cache.SharedIndexInformer
|
||||
snapshotsLister snapshotslisters.VolumeSnapshotLister
|
||||
pvcLister corelisters.PersistentVolumeClaimLister
|
||||
dataVolumeLister listers.DataVolumeLister
|
||||
dataVolumesSynced cache.InformerSynced
|
||||
snapshotsSynced cache.InformerSynced
|
||||
|
||||
queue workqueue.RateLimitingInterface
|
||||
recorder record.EventRecorder
|
||||
}
|
||||
|
||||
// NewSmartCloneController sets up a Smart Clone Controller, and returns a pointer to
|
||||
// to the newly created Controller
|
||||
func NewSmartCloneController(client kubernetes.Interface,
|
||||
cdiClientSet clientset.Interface,
|
||||
csiClientSet csiclientset.Interface,
|
||||
pvcInformer coreinformers.PersistentVolumeClaimInformer,
|
||||
snapshotInformer snapshotsinformers.VolumeSnapshotInformer,
|
||||
dataVolumeInformer informers.DataVolumeInformer) *SmartCloneController {
|
||||
|
||||
// Create event broadcaster
|
||||
// Add smart-clone-controller types to the default Kubernetes Scheme so Events can be
|
||||
// logged for smart-clone-controller types.
|
||||
cdischeme.AddToScheme(scheme.Scheme)
|
||||
klog.V(3).Info("Creating event broadcaster")
|
||||
eventBroadcaster := record.NewBroadcaster()
|
||||
eventBroadcaster.StartLogging(klog.V(2).Infof)
|
||||
eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: client.CoreV1().Events("")})
|
||||
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName})
|
||||
|
||||
c := &SmartCloneController{
|
||||
clientset: client,
|
||||
cdiClientSet: cdiClientSet,
|
||||
csiClientSet: csiClientSet,
|
||||
pvcLister: pvcInformer.Lister(),
|
||||
snapshotsLister: snapshotInformer.Lister(),
|
||||
snapshotInformer: snapshotInformer.Informer(),
|
||||
dataVolumeLister: dataVolumeInformer.Lister(),
|
||||
dataVolumesSynced: dataVolumeInformer.Informer().HasSynced,
|
||||
snapshotsSynced: snapshotInformer.Informer().HasSynced,
|
||||
recorder: recorder,
|
||||
queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),
|
||||
}
|
||||
|
||||
// Set up an event handler for when VolumeSnapshot resources change
|
||||
snapshotInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: c.enqueueItem,
|
||||
UpdateFunc: func(old, new interface{}) {
|
||||
c.enqueueItem(new)
|
||||
},
|
||||
DeleteFunc: c.enqueueItem,
|
||||
})
|
||||
|
||||
// Set up an event handler for when PVC resources change
|
||||
// handleObject function ensures we filter PVCs not created by this controller
|
||||
pvcInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: c.enqueueItem,
|
||||
UpdateFunc: func(old, new interface{}) {
|
||||
c.enqueueItem(new)
|
||||
},
|
||||
DeleteFunc: c.enqueueItem,
|
||||
})
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
//ProcessNextItem ...
|
||||
func (c *SmartCloneController) ProcessNextItem() bool {
|
||||
key, shutdown := c.queue.Get()
|
||||
if shutdown {
|
||||
return false
|
||||
}
|
||||
defer c.queue.Done(key)
|
||||
|
||||
ns, name, err := cache.SplitMetaNamespaceKey(key.(string))
|
||||
if err != nil {
|
||||
runtime.HandleError(errors.Errorf("invalid resource key: %s", key))
|
||||
return false
|
||||
}
|
||||
|
||||
pvc, err := c.pvcLister.PersistentVolumeClaims(ns).Get(name)
|
||||
if err != nil {
|
||||
if k8serrors.IsNotFound(err) {
|
||||
pvc = nil
|
||||
} else {
|
||||
// Error getting PVC - return
|
||||
return false
|
||||
}
|
||||
}
|
||||
snapshot, err := c.snapshotsLister.VolumeSnapshots(ns).Get(name)
|
||||
if err != nil {
|
||||
if k8serrors.IsNotFound(err) {
|
||||
snapshot = nil
|
||||
} else {
|
||||
// Error getting Snapshot - return
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if pvc != nil {
|
||||
if pvc.Status.Phase != corev1.ClaimBound {
|
||||
// PVC isn't bound yet - return
|
||||
return false
|
||||
}
|
||||
if pvc.ObjectMeta.Annotations[AnnSmartCloneRequest] == "true" {
|
||||
snapshotName := pvc.Spec.DataSource.Name
|
||||
snapshotToDelete, err := c.snapshotsLister.VolumeSnapshots(ns).Get(snapshotName)
|
||||
if err != nil {
|
||||
// Error getting Snapshot - return
|
||||
return true
|
||||
}
|
||||
if snapshotToDelete != nil {
|
||||
klog.V(3).Infof("ProcessNextItem snapshotName: %s", snapshotName)
|
||||
err = c.csiClientSet.SnapshotV1alpha1().VolumeSnapshots(ns).Delete(snapshotName, &metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
klog.Errorf("error deleting snapshot for smart-clone %q: %v", key, err)
|
||||
return true
|
||||
}
|
||||
klog.V(3).Infof("Snapshot deleted: %s", snapshotName)
|
||||
|
||||
dataVolume, err := c.dataVolumeLister.DataVolumes(snapshot.Namespace).Get(snapshot.Name)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// Update DV phase and emit PVC in progress event
|
||||
c.updateSmartCloneStatusPhase(cdiv1.Succeeded, dataVolume, pvc)
|
||||
}
|
||||
}
|
||||
} else if snapshot != nil {
|
||||
err := c.syncSnapshot(key.(string))
|
||||
if err != nil {
|
||||
klog.Errorf("error processing snapshot %q: %v", key, err)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return c.forgetKey(key, fmt.Sprintf("ProcessNextItem: processing pvc/snapshot %q completed", key))
|
||||
}
|
||||
|
||||
// forget the passed-in key for this event and optionally log a message.
|
||||
func (c *SmartCloneController) forgetKey(key interface{}, msg string) bool {
|
||||
if len(msg) > 0 {
|
||||
klog.V(3).Info(msg)
|
||||
}
|
||||
c.queue.Forget(key)
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *SmartCloneController) syncSnapshot(key string) error {
|
||||
snapshot, exists, err := c.snapshotFromKey(key)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !exists {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, ok := snapshot.Annotations[AnnSmartCloneRequest]
|
||||
if !ok {
|
||||
//ignoring snapshot, not created by DataVolume Controller
|
||||
return nil
|
||||
}
|
||||
|
||||
snapshotReadyToUse := snapshot.Status.ReadyToUse
|
||||
klog.V(3).Infof("Snapshot \"%s/%s\" - ReadyToUse: %t", snapshot.Namespace, snapshot.Name, snapshotReadyToUse)
|
||||
if !snapshotReadyToUse {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.processNextSnapshotItem(snapshot)
|
||||
}
|
||||
|
||||
// The snapshot is ReadyToUse, then we can create the PVC and update DV status
|
||||
func (c *SmartCloneController) processNextSnapshotItem(snapshot *csisnapshotv1.VolumeSnapshot) error {
|
||||
dataVolume, err := c.dataVolumeLister.DataVolumes(snapshot.Namespace).Get(snapshot.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Update DV phase and emit PVC in progress event
|
||||
c.updateSmartCloneStatusPhase(SmartClonePVCInProgress, dataVolume, nil)
|
||||
|
||||
newPvc := newPvcFromSnapshot(snapshot, dataVolume)
|
||||
if newPvc == nil {
|
||||
klog.Errorf("error creating new pvc from snapshot object")
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err = c.clientset.CoreV1().PersistentVolumeClaims(snapshot.Namespace).Create(newPvc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *SmartCloneController) objFromKey(informer cache.SharedIndexInformer, key interface{}) (interface{}, bool, error) {
|
||||
keyString, ok := key.(string)
|
||||
if !ok {
|
||||
return nil, false, errors.New("keys is not of type string")
|
||||
}
|
||||
obj, ok, err := informer.GetIndexer().GetByKey(keyString)
|
||||
if err != nil {
|
||||
return nil, false, errors.Wrap(err, "error getting interface obj from store")
|
||||
}
|
||||
if !ok {
|
||||
return nil, false, nil
|
||||
}
|
||||
return obj, true, nil
|
||||
}
|
||||
|
||||
// return a VolumeSnapshot pointer based on the passed-in work queue key.
|
||||
func (c *SmartCloneController) snapshotFromKey(key interface{}) (*csisnapshotv1.VolumeSnapshot, bool, error) {
|
||||
obj, exists, err := c.objFromKey(c.snapshotInformer, key)
|
||||
if err != nil {
|
||||
return nil, false, errors.Wrap(err, "could not get pvc object from key")
|
||||
} else if !exists {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
snapshot, ok := obj.(*csisnapshotv1.VolumeSnapshot)
|
||||
if !ok {
|
||||
return nil, false, errors.New("Object not of type *v1.PersistentVolumeClaim")
|
||||
}
|
||||
return snapshot, true, nil
|
||||
}
|
||||
|
||||
//Run is being called from cdi-controller (cmd)
|
||||
func (c *SmartCloneController) Run(threadiness int, stopCh <-chan struct{}) error {
|
||||
defer runtime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
// Start the informer factories to begin populating the informer caches
|
||||
klog.V(2).Info("Starting SmartCloneController controller")
|
||||
|
||||
// Wait for the caches to be synced before starting workers
|
||||
klog.V(2).Info("Waiting for informer caches to sync")
|
||||
if !cache.WaitForCacheSync(stopCh, c.snapshotsSynced, c.dataVolumesSynced) {
|
||||
return errors.New("Timeout waiting for caches sync")
|
||||
}
|
||||
klog.V(2).Info("Starting worker")
|
||||
for i := 0; i < threadiness; i++ {
|
||||
go wait.Until(c.runSnapshotWorkers, time.Second, stopCh)
|
||||
}
|
||||
|
||||
klog.V(2).Info("Started workers")
|
||||
<-stopCh
|
||||
klog.V(2).Info("Shutting down workers")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *SmartCloneController) runSnapshotWorkers() {
|
||||
for c.ProcessNextItem() {
|
||||
// empty
|
||||
}
|
||||
}
|
||||
|
||||
// enqueueItem takes a VolumeSnapshot or PVC resource and converts it into a namespace/name
|
||||
// string which is then put onto the work queue.
|
||||
func (c *SmartCloneController) enqueueItem(obj interface{}) {
|
||||
var key string
|
||||
var err error
|
||||
if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil {
|
||||
runtime.HandleError(err)
|
||||
return
|
||||
}
|
||||
c.queue.AddRateLimited(key)
|
||||
}
|
||||
|
||||
func (c *SmartCloneController) updateSmartCloneStatusPhase(phase cdiv1.DataVolumePhase, dataVolume *cdiv1.DataVolume, newPVC *corev1.PersistentVolumeClaim) error {
|
||||
var dataVolumeCopy = dataVolume.DeepCopy()
|
||||
var event DataVolumeEvent
|
||||
|
||||
switch phase {
|
||||
case cdiv1.SnapshotForSmartCloneInProgress:
|
||||
dataVolumeCopy.Status.Phase = cdiv1.SnapshotForSmartCloneInProgress
|
||||
event.eventType = corev1.EventTypeNormal
|
||||
event.reason = SnapshotForSmartCloneInProgress
|
||||
event.message = fmt.Sprintf(MessageSmartCloneInProgress, dataVolumeCopy.Spec.Source.PVC.Namespace, dataVolumeCopy.Spec.Source.PVC.Name)
|
||||
case cdiv1.SmartClonePVCInProgress:
|
||||
dataVolumeCopy.Status.Phase = cdiv1.SmartClonePVCInProgress
|
||||
event.eventType = corev1.EventTypeNormal
|
||||
event.reason = SmartClonePVCInProgress
|
||||
event.message = fmt.Sprintf(MessageSmartClonePVCInProgress, dataVolumeCopy.Spec.Source.PVC.Namespace, dataVolumeCopy.Spec.Source.PVC.Name)
|
||||
case cdiv1.Succeeded:
|
||||
dataVolumeCopy.Status.Phase = cdiv1.Succeeded
|
||||
event.eventType = corev1.EventTypeNormal
|
||||
event.reason = CloneSucceeded
|
||||
event.message = fmt.Sprintf(MessageCloneSucceeded, dataVolumeCopy.Spec.Source.PVC.Namespace, dataVolumeCopy.Spec.Source.PVC.Name, newPVC.Namespace, newPVC.Name)
|
||||
}
|
||||
|
||||
return c.emitEvent(dataVolume, dataVolumeCopy, &event)
|
||||
}
|
||||
|
||||
func (c *SmartCloneController) emitEvent(dataVolume *cdiv1.DataVolume, dataVolumeCopy *cdiv1.DataVolume, event *DataVolumeEvent) error {
|
||||
// Only update the object if something actually changed in the status.
|
||||
if !reflect.DeepEqual(dataVolume.Status, dataVolumeCopy.Status) {
|
||||
_, err := c.cdiClientSet.CdiV1alpha1().DataVolumes(dataVolume.Namespace).Update(dataVolumeCopy)
|
||||
// Emit the event only when the status change happens, not every time
|
||||
if event.eventType != "" {
|
||||
c.recorder.Event(dataVolume, event.eventType, event.reason, event.message)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newPvcFromSnapshot(snapshot *csisnapshotv1.VolumeSnapshot, dataVolume *cdiv1.DataVolume) *corev1.PersistentVolumeClaim {
|
||||
labels := map[string]string{
|
||||
"cdi-controller": snapshot.Name,
|
||||
common.CDILabelKey: common.CDILabelValue,
|
||||
common.CDIComponentLabel: common.SmartClonerCDILabel,
|
||||
}
|
||||
ownerRef := metav1.GetControllerOf(snapshot)
|
||||
if ownerRef == nil {
|
||||
return nil
|
||||
}
|
||||
annotations := make(map[string]string)
|
||||
annotations[AnnSmartCloneRequest] = "true"
|
||||
return &corev1.PersistentVolumeClaim{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: snapshot.Name,
|
||||
Namespace: snapshot.Namespace,
|
||||
Labels: labels,
|
||||
Annotations: annotations,
|
||||
OwnerReferences: []metav1.OwnerReference{*ownerRef},
|
||||
},
|
||||
Spec: corev1.PersistentVolumeClaimSpec{
|
||||
DataSource: &corev1.TypedLocalObjectReference{
|
||||
Name: snapshot.Name,
|
||||
Kind: "VolumeSnapshot",
|
||||
APIGroup: &csisnapshotv1.SchemeGroupVersion.Group,
|
||||
},
|
||||
VolumeMode: dataVolume.Spec.PVC.VolumeMode,
|
||||
AccessModes: dataVolume.Spec.PVC.AccessModes,
|
||||
StorageClassName: dataVolume.Spec.PVC.StorageClassName,
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: dataVolume.Spec.PVC.Resources.Requests,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
@ -9,10 +9,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
crdv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
routev1 "github.com/openshift/api/route/v1"
|
||||
"github.com/pkg/errors"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
extclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@ -1421,3 +1423,25 @@ func isInsecureTLS(client kubernetes.Interface, pvc *v1.PersistentVolumeClaim) (
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsCsiCrdsDeployed checks whether the CSI snapshotter CRD are deployed
|
||||
func IsCsiCrdsDeployed(c extclientset.Interface) bool {
|
||||
vsClass := crdv1alpha1.VolumeSnapshotClassResourcePlural + "." + crdv1alpha1.GroupName
|
||||
vsContent := crdv1alpha1.VolumeSnapshotContentResourcePlural + "." + crdv1alpha1.GroupName
|
||||
vs := crdv1alpha1.VolumeSnapshotResourcePlural + "." + crdv1alpha1.GroupName
|
||||
|
||||
return isCrdDeployed(c, vsClass) &&
|
||||
isCrdDeployed(c, vsContent) &&
|
||||
isCrdDeployed(c, vs)
|
||||
}
|
||||
|
||||
func isCrdDeployed(c extclientset.Interface, name string) bool {
|
||||
obj, err := c.ApiextensionsV1beta1().CustomResourceDefinitions().Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if k8serrors.IsNotFound(err) {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
return obj != nil
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
snapshotv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
@ -21,6 +22,8 @@ import (
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
|
||||
|
||||
crdv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
|
||||
cdiv1 "kubevirt.io/containerized-data-importer/pkg/apis/core/v1alpha1"
|
||||
cdifake "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/fake"
|
||||
"kubevirt.io/containerized-data-importer/pkg/common"
|
||||
@ -2016,3 +2019,89 @@ func createStorageClass(name string, annotations map[string]string) *storagev1.S
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func createStorageClassWithProvisioner(name string, annotations map[string]string, provisioner string) *storagev1.StorageClass {
|
||||
return &storagev1.StorageClass{
|
||||
Provisioner: provisioner,
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Annotations: annotations,
|
||||
},
|
||||
}
|
||||
}
|
||||
func createSnapshotClass(name string, annotations map[string]string, snapshotter string) *snapshotv1.VolumeSnapshotClass {
|
||||
return &snapshotv1.VolumeSnapshotClass{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "VolumeSnapshotClass",
|
||||
APIVersion: snapshotv1.SchemeGroupVersion.String(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Annotations: annotations,
|
||||
},
|
||||
Snapshotter: snapshotter,
|
||||
}
|
||||
}
|
||||
|
||||
func createVolumeSnapshotContentCrd() *apiextensionsv1beta1.CustomResourceDefinition {
|
||||
return &apiextensionsv1beta1.CustomResourceDefinition{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CustomResourceDefinition",
|
||||
APIVersion: apiextensionsv1beta1.SchemeGroupVersion.String(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: crdv1.VolumeSnapshotContentResourcePlural + "." + crdv1.GroupName,
|
||||
},
|
||||
Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
|
||||
Group: crdv1.GroupName,
|
||||
Version: crdv1.SchemeGroupVersion.Version,
|
||||
Scope: apiextensionsv1beta1.ClusterScoped,
|
||||
Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
|
||||
Plural: crdv1.VolumeSnapshotContentResourcePlural,
|
||||
Kind: reflect.TypeOf(crdv1.VolumeSnapshotContent{}).Name(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func createVolumeSnapshotClassCrd() *apiextensionsv1beta1.CustomResourceDefinition {
|
||||
return &apiextensionsv1beta1.CustomResourceDefinition{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CustomResourceDefinition",
|
||||
APIVersion: apiextensionsv1beta1.SchemeGroupVersion.String(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: crdv1.VolumeSnapshotClassResourcePlural + "." + crdv1.GroupName,
|
||||
},
|
||||
Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
|
||||
Group: crdv1.GroupName,
|
||||
Version: crdv1.SchemeGroupVersion.Version,
|
||||
Scope: apiextensionsv1beta1.ClusterScoped,
|
||||
Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
|
||||
Plural: crdv1.VolumeSnapshotClassResourcePlural,
|
||||
Kind: reflect.TypeOf(crdv1.VolumeSnapshotClass{}).Name(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func createVolumeSnapshotCrd() *apiextensionsv1beta1.CustomResourceDefinition {
|
||||
return &apiextensionsv1beta1.CustomResourceDefinition{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CustomResourceDefinition",
|
||||
APIVersion: apiextensionsv1beta1.SchemeGroupVersion.String(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: crdv1.VolumeSnapshotResourcePlural + "." + crdv1.GroupName,
|
||||
},
|
||||
Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
|
||||
Group: crdv1.GroupName,
|
||||
Version: crdv1.SchemeGroupVersion.Version,
|
||||
Scope: apiextensionsv1beta1.NamespaceScoped,
|
||||
Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
|
||||
Plural: crdv1.VolumeSnapshotResourcePlural,
|
||||
Kind: reflect.TypeOf(crdv1.VolumeSnapshot{}).Name(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ func GetControllerPermissions() []rbacv1.PolicyRule {
|
||||
},
|
||||
Resources: []string{
|
||||
"persistentvolumeclaims",
|
||||
"volumesnapshots",
|
||||
},
|
||||
Verbs: []string{
|
||||
"get",
|
||||
@ -77,6 +78,7 @@ func GetControllerPermissions() []rbacv1.PolicyRule {
|
||||
Resources: []string{
|
||||
"persistentvolumeclaims/finalizers",
|
||||
"pods/finalizers",
|
||||
"volumesnapshots/finalizers",
|
||||
},
|
||||
Verbs: []string{
|
||||
"update",
|
||||
@ -188,6 +190,28 @@ func GetControllerPermissions() []rbacv1.PolicyRule {
|
||||
"*",
|
||||
},
|
||||
},
|
||||
{
|
||||
APIGroups: []string{
|
||||
"snapshot.storage.k8s.io",
|
||||
},
|
||||
Resources: []string{
|
||||
"*",
|
||||
},
|
||||
Verbs: []string{
|
||||
"*",
|
||||
},
|
||||
},
|
||||
{
|
||||
APIGroups: []string{
|
||||
"apiextensions.k8s.io",
|
||||
},
|
||||
Resources: []string{
|
||||
"customresourcedefinitions",
|
||||
},
|
||||
Verbs: []string{
|
||||
"*",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,6 +297,7 @@ func getOperatorClusterRules() *[]rbacv1.PolicyRule {
|
||||
Resources: []string{
|
||||
"pods",
|
||||
"persistentvolumeclaims",
|
||||
"volumesnapshots",
|
||||
},
|
||||
Verbs: []string{
|
||||
"get",
|
||||
@ -315,6 +316,7 @@ func getOperatorClusterRules() *[]rbacv1.PolicyRule {
|
||||
Resources: []string{
|
||||
"persistentvolumeclaims/finalizers",
|
||||
"pods/finalizers",
|
||||
"volumesnapshots/finalizers",
|
||||
},
|
||||
Verbs: []string{
|
||||
"update",
|
||||
@ -389,6 +391,28 @@ func getOperatorClusterRules() *[]rbacv1.PolicyRule {
|
||||
"update",
|
||||
},
|
||||
},
|
||||
{
|
||||
APIGroups: []string{
|
||||
"snapshot.storage.k8s.io",
|
||||
},
|
||||
Resources: []string{
|
||||
"*",
|
||||
},
|
||||
Verbs: []string{
|
||||
"*",
|
||||
},
|
||||
},
|
||||
{
|
||||
APIGroups: []string{
|
||||
"apiextensions.k8s.io",
|
||||
},
|
||||
Resources: []string{
|
||||
"customresourcedefinitions",
|
||||
},
|
||||
Verbs: []string{
|
||||
"*",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return &rules
|
||||
|
98
pkg/snapshot-client/clientset/versioned/clientset.go
Normal file
98
pkg/snapshot-client/clientset/versioned/clientset.go
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package versioned
|
||||
|
||||
import (
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
snapshotv1alpha1 "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/typed/volumesnapshot/v1alpha1"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Snapshot() snapshotv1alpha1.SnapshotV1alpha1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
// version included in a Clientset.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
snapshotV1alpha1 *snapshotv1alpha1.SnapshotV1alpha1Client
|
||||
}
|
||||
|
||||
// SnapshotV1alpha1 retrieves the SnapshotV1alpha1Client
|
||||
func (c *Clientset) SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface {
|
||||
return c.snapshotV1alpha1
|
||||
}
|
||||
|
||||
// Deprecated: Snapshot retrieves the default version of SnapshotClient.
|
||||
// Please explicitly pick a version.
|
||||
func (c *Clientset) Snapshot() snapshotv1alpha1.SnapshotV1alpha1Interface {
|
||||
return c.snapshotV1alpha1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.DiscoveryClient
|
||||
}
|
||||
|
||||
// NewForConfig creates a new Clientset for the given config.
|
||||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
configShallowCopy := *c
|
||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||
}
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.snapshotV1alpha1, err = snapshotv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &cs, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new Clientset for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
var cs Clientset
|
||||
cs.snapshotV1alpha1 = snapshotv1alpha1.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
}
|
||||
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.snapshotV1alpha1 = snapshotv1alpha1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
}
|
20
pkg/snapshot-client/clientset/versioned/doc.go
Normal file
20
pkg/snapshot-client/clientset/versioned/doc.go
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated clientset.
|
||||
package versioned
|
@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||
"k8s.io/client-go/testing"
|
||||
clientset "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
snapshotv1alpha1 "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/typed/volumesnapshot/v1alpha1"
|
||||
fakesnapshotv1alpha1 "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/typed/volumesnapshot/v1alpha1/fake"
|
||||
)
|
||||
|
||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
cs := &Clientset{}
|
||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, watch, nil
|
||||
})
|
||||
|
||||
return cs
|
||||
}
|
||||
|
||||
// Clientset implements clientset.Interface. Meant to be embedded into a
|
||||
// struct to get a default implementation. This makes faking out just the method
|
||||
// you want to test easier.
|
||||
type Clientset struct {
|
||||
testing.Fake
|
||||
discovery *fakediscovery.FakeDiscovery
|
||||
}
|
||||
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
return c.discovery
|
||||
}
|
||||
|
||||
var _ clientset.Interface = &Clientset{}
|
||||
|
||||
// SnapshotV1alpha1 retrieves the SnapshotV1alpha1Client
|
||||
func (c *Clientset) SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface {
|
||||
return &fakesnapshotv1alpha1.FakeSnapshotV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// Snapshot retrieves the SnapshotV1alpha1Client
|
||||
func (c *Clientset) Snapshot() snapshotv1alpha1.SnapshotV1alpha1Interface {
|
||||
return &fakesnapshotv1alpha1.FakeSnapshotV1alpha1{Fake: &c.Fake}
|
||||
}
|
20
pkg/snapshot-client/clientset/versioned/fake/doc.go
Normal file
20
pkg/snapshot-client/clientset/versioned/fake/doc.go
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated fake clientset.
|
||||
package fake
|
56
pkg/snapshot-client/clientset/versioned/fake/register.go
Normal file
56
pkg/snapshot-client/clientset/versioned/fake/register.go
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
snapshotv1alpha1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
// of clientsets, like in:
|
||||
//
|
||||
// import (
|
||||
// "k8s.io/client-go/kubernetes"
|
||||
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
||||
// )
|
||||
//
|
||||
// kclientset, _ := kubernetes.NewForConfig(c)
|
||||
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
||||
//
|
||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||
// correctly.
|
||||
var AddToScheme = localSchemeBuilder.AddToScheme
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
|
||||
utilruntime.Must(AddToScheme(scheme))
|
||||
}
|
20
pkg/snapshot-client/clientset/versioned/scheme/doc.go
Normal file
20
pkg/snapshot-client/clientset/versioned/scheme/doc.go
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package contains the scheme of the automatically generated clientset.
|
||||
package scheme
|
56
pkg/snapshot-client/clientset/versioned/scheme/register.go
Normal file
56
pkg/snapshot-client/clientset/versioned/scheme/register.go
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package scheme
|
||||
|
||||
import (
|
||||
snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
snapshotv1alpha1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
// of clientsets, like in:
|
||||
//
|
||||
// import (
|
||||
// "k8s.io/client-go/kubernetes"
|
||||
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
||||
// )
|
||||
//
|
||||
// kclientset, _ := kubernetes.NewForConfig(c)
|
||||
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
||||
//
|
||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||
// correctly.
|
||||
var AddToScheme = localSchemeBuilder.AddToScheme
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
|
||||
utilruntime.Must(AddToScheme(Scheme))
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1alpha1
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
@ -0,0 +1,140 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshots implements VolumeSnapshotInterface
|
||||
type FakeVolumeSnapshots struct {
|
||||
Fake *FakeSnapshotV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var volumesnapshotsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumesnapshots"}
|
||||
|
||||
var volumesnapshotsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeSnapshot"}
|
||||
|
||||
// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshots) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(volumesnapshotsResource, c.ns, name), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors.
|
||||
func (c *FakeVolumeSnapshots) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(volumesnapshotsResource, volumesnapshotsKind, c.ns, opts), &v1alpha1.VolumeSnapshotList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.VolumeSnapshotList{ListMeta: obj.(*v1alpha1.VolumeSnapshotList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.VolumeSnapshotList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshots.
|
||||
func (c *FakeVolumeSnapshots) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(volumesnapshotsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshots) Create(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshots) Update(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeVolumeSnapshots) UpdateStatus(volumeSnapshot *v1alpha1.VolumeSnapshot) (*v1alpha1.VolumeSnapshot, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(volumesnapshotsResource, "status", c.ns, volumeSnapshot), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshots) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(volumesnapshotsResource, c.ns, name), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshots) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(volumesnapshotsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.VolumeSnapshotList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshot.
|
||||
func (c *FakeVolumeSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(volumesnapshotsResource, c.ns, name, pt, data, subresources...), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
v1alpha1 "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/typed/volumesnapshot/v1alpha1"
|
||||
)
|
||||
|
||||
type FakeSnapshotV1alpha1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1alpha1) VolumeSnapshots(namespace string) v1alpha1.VolumeSnapshotInterface {
|
||||
return &FakeVolumeSnapshots{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1alpha1) VolumeSnapshotClasses() v1alpha1.VolumeSnapshotClassInterface {
|
||||
return &FakeVolumeSnapshotClasses{c}
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1alpha1) VolumeSnapshotContents() v1alpha1.VolumeSnapshotContentInterface {
|
||||
return &FakeVolumeSnapshotContents{c}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeSnapshotV1alpha1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshotClasses implements VolumeSnapshotClassInterface
|
||||
type FakeVolumeSnapshotClasses struct {
|
||||
Fake *FakeSnapshotV1alpha1
|
||||
}
|
||||
|
||||
var volumesnapshotclassesResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumesnapshotclasses"}
|
||||
|
||||
var volumesnapshotclassesKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeSnapshotClass"}
|
||||
|
||||
// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(volumesnapshotclassesResource, name), &v1alpha1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors.
|
||||
func (c *FakeVolumeSnapshotClasses) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotClassList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(volumesnapshotclassesResource, volumesnapshotclassesKind, opts), &v1alpha1.VolumeSnapshotClassList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.VolumeSnapshotClassList{ListMeta: obj.(*v1alpha1.VolumeSnapshotClassList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.VolumeSnapshotClassList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses.
|
||||
func (c *FakeVolumeSnapshotClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(volumesnapshotclassesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Create(volumeSnapshotClass *v1alpha1.VolumeSnapshotClass) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(volumesnapshotclassesResource, volumeSnapshotClass), &v1alpha1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Update(volumeSnapshotClass *v1alpha1.VolumeSnapshotClass) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(volumesnapshotclassesResource, volumeSnapshotClass), &v1alpha1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshotClasses) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(volumesnapshotclassesResource, name), &v1alpha1.VolumeSnapshotClass{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshotClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(volumesnapshotclassesResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.VolumeSnapshotClassList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotClass.
|
||||
func (c *FakeVolumeSnapshotClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotclassesResource, name, pt, data, subresources...), &v1alpha1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), err
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshotContents implements VolumeSnapshotContentInterface
|
||||
type FakeVolumeSnapshotContents struct {
|
||||
Fake *FakeSnapshotV1alpha1
|
||||
}
|
||||
|
||||
var volumesnapshotcontentsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumesnapshotcontents"}
|
||||
|
||||
var volumesnapshotcontentsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeSnapshotContent"}
|
||||
|
||||
// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(volumesnapshotcontentsResource, name), &v1alpha1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors.
|
||||
func (c *FakeVolumeSnapshotContents) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotContentList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(volumesnapshotcontentsResource, volumesnapshotcontentsKind, opts), &v1alpha1.VolumeSnapshotContentList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.VolumeSnapshotContentList{ListMeta: obj.(*v1alpha1.VolumeSnapshotContentList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.VolumeSnapshotContentList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotContents.
|
||||
func (c *FakeVolumeSnapshotContents) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(volumesnapshotcontentsResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Create(volumeSnapshotContent *v1alpha1.VolumeSnapshotContent) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &v1alpha1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Update(volumeSnapshotContent *v1alpha1.VolumeSnapshotContent) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &v1alpha1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshotContents) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(volumesnapshotcontentsResource, name), &v1alpha1.VolumeSnapshotContent{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshotContents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(volumesnapshotcontentsResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.VolumeSnapshotContentList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotContent.
|
||||
func (c *FakeVolumeSnapshotContents) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotcontentsResource, name, pt, data, subresources...), &v1alpha1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), err
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
type VolumeSnapshotExpansion interface{}
|
||||
|
||||
type VolumeSnapshotClassExpansion interface{}
|
||||
|
||||
type VolumeSnapshotContentExpansion interface{}
|
@ -0,0 +1,191 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
scheme "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
// VolumeSnapshotsGetter has a method to return a VolumeSnapshotInterface.
|
||||
// A group's client should implement this interface.
|
||||
type VolumeSnapshotsGetter interface {
|
||||
VolumeSnapshots(namespace string) VolumeSnapshotInterface
|
||||
}
|
||||
|
||||
// VolumeSnapshotInterface has methods to work with VolumeSnapshot resources.
|
||||
type VolumeSnapshotInterface interface {
|
||||
Create(*v1alpha1.VolumeSnapshot) (*v1alpha1.VolumeSnapshot, error)
|
||||
Update(*v1alpha1.VolumeSnapshot) (*v1alpha1.VolumeSnapshot, error)
|
||||
UpdateStatus(*v1alpha1.VolumeSnapshot) (*v1alpha1.VolumeSnapshot, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.VolumeSnapshot, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.VolumeSnapshotList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshot, err error)
|
||||
VolumeSnapshotExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshots implements VolumeSnapshotInterface
|
||||
type volumeSnapshots struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newVolumeSnapshots returns a VolumeSnapshots
|
||||
func newVolumeSnapshots(c *SnapshotV1alpha1Client, namespace string) *volumeSnapshots {
|
||||
return &volumeSnapshots{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any.
|
||||
func (c *volumeSnapshots) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors.
|
||||
func (c *volumeSnapshots) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.VolumeSnapshotList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshots.
|
||||
func (c *volumeSnapshots) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
||||
func (c *volumeSnapshots) Create(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Body(volumeSnapshot).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
||||
func (c *volumeSnapshots) Update(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(volumeSnapshot.Name).
|
||||
Body(volumeSnapshot).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *volumeSnapshots) UpdateStatus(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(volumeSnapshot.Name).
|
||||
SubResource("status").
|
||||
Body(volumeSnapshot).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshots) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshots) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOptions.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshot.
|
||||
func (c *volumeSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
"kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
type SnapshotV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
VolumeSnapshotsGetter
|
||||
VolumeSnapshotClassesGetter
|
||||
VolumeSnapshotContentsGetter
|
||||
}
|
||||
|
||||
// SnapshotV1alpha1Client is used to interact with features provided by the snapshot.storage.k8s.io group.
|
||||
type SnapshotV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *SnapshotV1alpha1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface {
|
||||
return newVolumeSnapshots(c, namespace)
|
||||
}
|
||||
|
||||
func (c *SnapshotV1alpha1Client) VolumeSnapshotClasses() VolumeSnapshotClassInterface {
|
||||
return newVolumeSnapshotClasses(c)
|
||||
}
|
||||
|
||||
func (c *SnapshotV1alpha1Client) VolumeSnapshotContents() VolumeSnapshotContentInterface {
|
||||
return newVolumeSnapshotContents(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new SnapshotV1alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*SnapshotV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SnapshotV1alpha1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new SnapshotV1alpha1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *SnapshotV1alpha1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new SnapshotV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *SnapshotV1alpha1Client {
|
||||
return &SnapshotV1alpha1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *SnapshotV1alpha1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
scheme "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
// VolumeSnapshotClassesGetter has a method to return a VolumeSnapshotClassInterface.
|
||||
// A group's client should implement this interface.
|
||||
type VolumeSnapshotClassesGetter interface {
|
||||
VolumeSnapshotClasses() VolumeSnapshotClassInterface
|
||||
}
|
||||
|
||||
// VolumeSnapshotClassInterface has methods to work with VolumeSnapshotClass resources.
|
||||
type VolumeSnapshotClassInterface interface {
|
||||
Create(*v1alpha1.VolumeSnapshotClass) (*v1alpha1.VolumeSnapshotClass, error)
|
||||
Update(*v1alpha1.VolumeSnapshotClass) (*v1alpha1.VolumeSnapshotClass, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.VolumeSnapshotClass, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.VolumeSnapshotClassList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotClass, err error)
|
||||
VolumeSnapshotClassExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotClasses implements VolumeSnapshotClassInterface
|
||||
type volumeSnapshotClasses struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newVolumeSnapshotClasses returns a VolumeSnapshotClasses
|
||||
func newVolumeSnapshotClasses(c *SnapshotV1alpha1Client) *volumeSnapshotClasses {
|
||||
return &volumeSnapshotClasses{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any.
|
||||
func (c *volumeSnapshotClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotClass{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors.
|
||||
func (c *volumeSnapshotClasses) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotClassList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.VolumeSnapshotClassList{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses.
|
||||
func (c *volumeSnapshotClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *volumeSnapshotClasses) Create(volumeSnapshotClass *v1alpha1.VolumeSnapshotClass) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotClass{}
|
||||
err = c.client.Post().
|
||||
Resource("volumesnapshotclasses").
|
||||
Body(volumeSnapshotClass).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *volumeSnapshotClasses) Update(volumeSnapshotClass *v1alpha1.VolumeSnapshotClass) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotClass{}
|
||||
err = c.client.Put().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(volumeSnapshotClass.Name).
|
||||
Body(volumeSnapshotClass).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshotClasses) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshotClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOptions.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotClass.
|
||||
func (c *volumeSnapshotClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotClass{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("volumesnapshotclasses").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
scheme "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned/scheme"
|
||||
)
|
||||
|
||||
// VolumeSnapshotContentsGetter has a method to return a VolumeSnapshotContentInterface.
|
||||
// A group's client should implement this interface.
|
||||
type VolumeSnapshotContentsGetter interface {
|
||||
VolumeSnapshotContents() VolumeSnapshotContentInterface
|
||||
}
|
||||
|
||||
// VolumeSnapshotContentInterface has methods to work with VolumeSnapshotContent resources.
|
||||
type VolumeSnapshotContentInterface interface {
|
||||
Create(*v1alpha1.VolumeSnapshotContent) (*v1alpha1.VolumeSnapshotContent, error)
|
||||
Update(*v1alpha1.VolumeSnapshotContent) (*v1alpha1.VolumeSnapshotContent, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.VolumeSnapshotContent, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.VolumeSnapshotContentList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotContent, err error)
|
||||
VolumeSnapshotContentExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotContents implements VolumeSnapshotContentInterface
|
||||
type volumeSnapshotContents struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newVolumeSnapshotContents returns a VolumeSnapshotContents
|
||||
func newVolumeSnapshotContents(c *SnapshotV1alpha1Client) *volumeSnapshotContents {
|
||||
return &volumeSnapshotContents{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any.
|
||||
func (c *volumeSnapshotContents) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotContent{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotcontents").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors.
|
||||
func (c *volumeSnapshotContents) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotContentList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.VolumeSnapshotContentList{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotcontents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotContents.
|
||||
func (c *volumeSnapshotContents) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("volumesnapshotcontents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *volumeSnapshotContents) Create(volumeSnapshotContent *v1alpha1.VolumeSnapshotContent) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotContent{}
|
||||
err = c.client.Post().
|
||||
Resource("volumesnapshotcontents").
|
||||
Body(volumeSnapshotContent).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *volumeSnapshotContents) Update(volumeSnapshotContent *v1alpha1.VolumeSnapshotContent) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotContent{}
|
||||
err = c.client.Put().
|
||||
Resource("volumesnapshotcontents").
|
||||
Name(volumeSnapshotContent.Name).
|
||||
Body(volumeSnapshotContent).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshotContents) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotcontents").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshotContents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOptions.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotcontents").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotContent.
|
||||
func (c *volumeSnapshotContents) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotContent{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("volumesnapshotcontents").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
180
pkg/snapshot-client/informers/externalversions/factory.go
Normal file
180
pkg/snapshot-client/informers/externalversions/factory.go
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package externalversions
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
time "time"
|
||||
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
versioned "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
internalinterfaces "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/internalinterfaces"
|
||||
volumesnapshot "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/volumesnapshot"
|
||||
)
|
||||
|
||||
// SharedInformerOption defines the functional option type for SharedInformerFactory.
|
||||
type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory
|
||||
|
||||
type sharedInformerFactory struct {
|
||||
client versioned.Interface
|
||||
namespace string
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
lock sync.Mutex
|
||||
defaultResync time.Duration
|
||||
customResync map[reflect.Type]time.Duration
|
||||
|
||||
informers map[reflect.Type]cache.SharedIndexInformer
|
||||
// startedInformers is used for tracking which informers have been started.
|
||||
// This allows Start() to be called multiple times safely.
|
||||
startedInformers map[reflect.Type]bool
|
||||
}
|
||||
|
||||
// WithCustomResyncConfig sets a custom resync period for the specified informer types.
|
||||
func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption {
|
||||
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||
for k, v := range resyncConfig {
|
||||
factory.customResync[reflect.TypeOf(k)] = v
|
||||
}
|
||||
return factory
|
||||
}
|
||||
}
|
||||
|
||||
// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory.
|
||||
func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption {
|
||||
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||
factory.tweakListOptions = tweakListOptions
|
||||
return factory
|
||||
}
|
||||
}
|
||||
|
||||
// WithNamespace limits the SharedInformerFactory to the specified namespace.
|
||||
func WithNamespace(namespace string) SharedInformerOption {
|
||||
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||
factory.namespace = namespace
|
||||
return factory
|
||||
}
|
||||
}
|
||||
|
||||
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
|
||||
func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
|
||||
return NewSharedInformerFactoryWithOptions(client, defaultResync)
|
||||
}
|
||||
|
||||
// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory.
|
||||
// Listers obtained via this SharedInformerFactory will be subject to the same filters
|
||||
// as specified here.
|
||||
// Deprecated: Please use NewSharedInformerFactoryWithOptions instead
|
||||
func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory {
|
||||
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
|
||||
}
|
||||
|
||||
// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options.
|
||||
func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory {
|
||||
factory := &sharedInformerFactory{
|
||||
client: client,
|
||||
namespace: v1.NamespaceAll,
|
||||
defaultResync: defaultResync,
|
||||
informers: make(map[reflect.Type]cache.SharedIndexInformer),
|
||||
startedInformers: make(map[reflect.Type]bool),
|
||||
customResync: make(map[reflect.Type]time.Duration),
|
||||
}
|
||||
|
||||
// Apply all options
|
||||
for _, opt := range options {
|
||||
factory = opt(factory)
|
||||
}
|
||||
|
||||
return factory
|
||||
}
|
||||
|
||||
// Start initializes all requested informers.
|
||||
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
for informerType, informer := range f.informers {
|
||||
if !f.startedInformers[informerType] {
|
||||
go informer.Run(stopCh)
|
||||
f.startedInformers[informerType] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WaitForCacheSync waits for all started informers' cache were synced.
|
||||
func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
|
||||
informers := func() map[reflect.Type]cache.SharedIndexInformer {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
informers := map[reflect.Type]cache.SharedIndexInformer{}
|
||||
for informerType, informer := range f.informers {
|
||||
if f.startedInformers[informerType] {
|
||||
informers[informerType] = informer
|
||||
}
|
||||
}
|
||||
return informers
|
||||
}()
|
||||
|
||||
res := map[reflect.Type]bool{}
|
||||
for informType, informer := range informers {
|
||||
res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// InternalInformerFor returns the SharedIndexInformer for obj using an internal
|
||||
// client.
|
||||
func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
informerType := reflect.TypeOf(obj)
|
||||
informer, exists := f.informers[informerType]
|
||||
if exists {
|
||||
return informer
|
||||
}
|
||||
|
||||
resyncPeriod, exists := f.customResync[informerType]
|
||||
if !exists {
|
||||
resyncPeriod = f.defaultResync
|
||||
}
|
||||
|
||||
informer = newFunc(f.client, resyncPeriod)
|
||||
f.informers[informerType] = informer
|
||||
|
||||
return informer
|
||||
}
|
||||
|
||||
// SharedInformerFactory provides shared informers for resources in all known
|
||||
// API group versions.
|
||||
type SharedInformerFactory interface {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
|
||||
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
||||
|
||||
Snapshot() volumesnapshot.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Snapshot() volumesnapshot.Interface {
|
||||
return volumesnapshot.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
66
pkg/snapshot-client/informers/externalversions/generic.go
Normal file
66
pkg/snapshot-client/informers/externalversions/generic.go
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package externalversions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
|
||||
// sharedInformers based on type
|
||||
type GenericInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() cache.GenericLister
|
||||
}
|
||||
|
||||
type genericInformer struct {
|
||||
informer cache.SharedIndexInformer
|
||||
resource schema.GroupResource
|
||||
}
|
||||
|
||||
// Informer returns the SharedIndexInformer.
|
||||
func (f *genericInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.informer
|
||||
}
|
||||
|
||||
// Lister returns the GenericLister.
|
||||
func (f *genericInformer) Lister() cache.GenericLister {
|
||||
return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
|
||||
}
|
||||
|
||||
// ForResource gives generic access to a shared informer of the matching type
|
||||
// TODO extend this to unknown resources with a client pool
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=snapshot.storage.k8s.io, Version=v1alpha1
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("volumesnapshots"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1alpha1().VolumeSnapshots().Informer()}, nil
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("volumesnapshotclasses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1alpha1().VolumeSnapshotClasses().Informer()}, nil
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("volumesnapshotcontents"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1alpha1().VolumeSnapshotContents().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no informer found for %v", resource)
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package internalinterfaces
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
versioned "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
)
|
||||
|
||||
// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.
|
||||
type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer
|
||||
|
||||
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
|
||||
type SharedInformerFactory interface {
|
||||
Start(stopCh <-chan struct{})
|
||||
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
|
||||
}
|
||||
|
||||
// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
|
||||
type TweakListOptionsFunc func(*v1.ListOptions)
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package snapshot
|
||||
|
||||
import (
|
||||
internalinterfaces "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/volumesnapshot/v1alpha1"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// V1alpha1 provides access to shared informers for resources in V1alpha1.
|
||||
V1alpha1() v1alpha1.Interface
|
||||
}
|
||||
|
||||
type group struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
namespace string
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// V1alpha1 returns a new v1alpha1.Interface.
|
||||
func (g *group) V1alpha1() v1alpha1.Interface {
|
||||
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
internalinterfaces "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// VolumeSnapshots returns a VolumeSnapshotInformer.
|
||||
VolumeSnapshots() VolumeSnapshotInformer
|
||||
// VolumeSnapshotClasses returns a VolumeSnapshotClassInformer.
|
||||
VolumeSnapshotClasses() VolumeSnapshotClassInformer
|
||||
// VolumeSnapshotContents returns a VolumeSnapshotContentInformer.
|
||||
VolumeSnapshotContents() VolumeSnapshotContentInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
namespace string
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// VolumeSnapshots returns a VolumeSnapshotInformer.
|
||||
func (v *version) VolumeSnapshots() VolumeSnapshotInformer {
|
||||
return &volumeSnapshotInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// VolumeSnapshotClasses returns a VolumeSnapshotClassInformer.
|
||||
func (v *version) VolumeSnapshotClasses() VolumeSnapshotClassInformer {
|
||||
return &volumeSnapshotClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// VolumeSnapshotContents returns a VolumeSnapshotContentInformer.
|
||||
func (v *version) VolumeSnapshotContents() VolumeSnapshotContentInformer {
|
||||
return &volumeSnapshotContentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
volumesnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
versioned "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
internalinterfaces "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "kubevirt.io/containerized-data-importer/pkg/snapshot-client/listers/volumesnapshot/v1alpha1"
|
||||
)
|
||||
|
||||
// VolumeSnapshotInformer provides access to a shared informer and lister for
|
||||
// VolumeSnapshots.
|
||||
type VolumeSnapshotInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.VolumeSnapshotLister
|
||||
}
|
||||
|
||||
type volumeSnapshotInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotInformer constructs a new informer for VolumeSnapshot type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredVolumeSnapshotInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredVolumeSnapshotInformer constructs a new informer for VolumeSnapshot type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SnapshotV1alpha1().VolumeSnapshots(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SnapshotV1alpha1().VolumeSnapshots(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&volumesnapshotv1alpha1.VolumeSnapshot{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredVolumeSnapshotInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&volumesnapshotv1alpha1.VolumeSnapshot{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotInformer) Lister() v1alpha1.VolumeSnapshotLister {
|
||||
return v1alpha1.NewVolumeSnapshotLister(f.Informer().GetIndexer())
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
volumesnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
versioned "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
internalinterfaces "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "kubevirt.io/containerized-data-importer/pkg/snapshot-client/listers/volumesnapshot/v1alpha1"
|
||||
)
|
||||
|
||||
// VolumeSnapshotClassInformer provides access to a shared informer and lister for
|
||||
// VolumeSnapshotClasses.
|
||||
type VolumeSnapshotClassInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.VolumeSnapshotClassLister
|
||||
}
|
||||
|
||||
type volumeSnapshotClassInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotClassInformer constructs a new informer for VolumeSnapshotClass type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewVolumeSnapshotClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredVolumeSnapshotClassInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredVolumeSnapshotClassInformer constructs a new informer for VolumeSnapshotClass type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredVolumeSnapshotClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SnapshotV1alpha1().VolumeSnapshotClasses().List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SnapshotV1alpha1().VolumeSnapshotClasses().Watch(options)
|
||||
},
|
||||
},
|
||||
&volumesnapshotv1alpha1.VolumeSnapshotClass{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredVolumeSnapshotClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotClassInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&volumesnapshotv1alpha1.VolumeSnapshotClass{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotClassInformer) Lister() v1alpha1.VolumeSnapshotClassLister {
|
||||
return v1alpha1.NewVolumeSnapshotClassLister(f.Informer().GetIndexer())
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
volumesnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
versioned "kubevirt.io/containerized-data-importer/pkg/snapshot-client/clientset/versioned"
|
||||
internalinterfaces "kubevirt.io/containerized-data-importer/pkg/snapshot-client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "kubevirt.io/containerized-data-importer/pkg/snapshot-client/listers/volumesnapshot/v1alpha1"
|
||||
)
|
||||
|
||||
// VolumeSnapshotContentInformer provides access to a shared informer and lister for
|
||||
// VolumeSnapshotContents.
|
||||
type VolumeSnapshotContentInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.VolumeSnapshotContentLister
|
||||
}
|
||||
|
||||
type volumeSnapshotContentInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotContentInformer constructs a new informer for VolumeSnapshotContent type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewVolumeSnapshotContentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredVolumeSnapshotContentInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredVolumeSnapshotContentInformer constructs a new informer for VolumeSnapshotContent type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredVolumeSnapshotContentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SnapshotV1alpha1().VolumeSnapshotContents().List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SnapshotV1alpha1().VolumeSnapshotContents().Watch(options)
|
||||
},
|
||||
},
|
||||
&volumesnapshotv1alpha1.VolumeSnapshotContent{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotContentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredVolumeSnapshotContentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotContentInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&volumesnapshotv1alpha1.VolumeSnapshotContent{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotContentInformer) Lister() v1alpha1.VolumeSnapshotContentLister {
|
||||
return v1alpha1.NewVolumeSnapshotContentLister(f.Informer().GetIndexer())
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// VolumeSnapshotListerExpansion allows custom methods to be added to
|
||||
// VolumeSnapshotLister.
|
||||
type VolumeSnapshotListerExpansion interface{}
|
||||
|
||||
// VolumeSnapshotNamespaceListerExpansion allows custom methods to be added to
|
||||
// VolumeSnapshotNamespaceLister.
|
||||
type VolumeSnapshotNamespaceListerExpansion interface{}
|
||||
|
||||
// VolumeSnapshotClassListerExpansion allows custom methods to be added to
|
||||
// VolumeSnapshotClassLister.
|
||||
type VolumeSnapshotClassListerExpansion interface{}
|
||||
|
||||
// VolumeSnapshotContentListerExpansion allows custom methods to be added to
|
||||
// VolumeSnapshotContentLister.
|
||||
type VolumeSnapshotContentListerExpansion interface{}
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// VolumeSnapshotLister helps list VolumeSnapshots.
|
||||
type VolumeSnapshotLister interface {
|
||||
// List lists all VolumeSnapshots in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.VolumeSnapshot, err error)
|
||||
// VolumeSnapshots returns an object that can list and get VolumeSnapshots.
|
||||
VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister
|
||||
VolumeSnapshotListerExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotLister implements the VolumeSnapshotLister interface.
|
||||
type volumeSnapshotLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotLister returns a new VolumeSnapshotLister.
|
||||
func NewVolumeSnapshotLister(indexer cache.Indexer) VolumeSnapshotLister {
|
||||
return &volumeSnapshotLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all VolumeSnapshots in the indexer.
|
||||
func (s *volumeSnapshotLister) List(selector labels.Selector) (ret []*v1alpha1.VolumeSnapshot, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.VolumeSnapshot))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// VolumeSnapshots returns an object that can list and get VolumeSnapshots.
|
||||
func (s *volumeSnapshotLister) VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister {
|
||||
return volumeSnapshotNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// VolumeSnapshotNamespaceLister helps list and get VolumeSnapshots.
|
||||
type VolumeSnapshotNamespaceLister interface {
|
||||
// List lists all VolumeSnapshots in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.VolumeSnapshot, err error)
|
||||
// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1alpha1.VolumeSnapshot, error)
|
||||
VolumeSnapshotNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotNamespaceLister implements the VolumeSnapshotNamespaceLister
|
||||
// interface.
|
||||
type volumeSnapshotNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all VolumeSnapshots in the indexer for a given namespace.
|
||||
func (s volumeSnapshotNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VolumeSnapshot, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.VolumeSnapshot))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name.
|
||||
func (s volumeSnapshotNamespaceLister) Get(name string) (*v1alpha1.VolumeSnapshot, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1alpha1.Resource("volumesnapshot"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), nil
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// VolumeSnapshotClassLister helps list VolumeSnapshotClasses.
|
||||
type VolumeSnapshotClassLister interface {
|
||||
// List lists all VolumeSnapshotClasses in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.VolumeSnapshotClass, err error)
|
||||
// Get retrieves the VolumeSnapshotClass from the index for a given name.
|
||||
Get(name string) (*v1alpha1.VolumeSnapshotClass, error)
|
||||
VolumeSnapshotClassListerExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotClassLister implements the VolumeSnapshotClassLister interface.
|
||||
type volumeSnapshotClassLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotClassLister returns a new VolumeSnapshotClassLister.
|
||||
func NewVolumeSnapshotClassLister(indexer cache.Indexer) VolumeSnapshotClassLister {
|
||||
return &volumeSnapshotClassLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all VolumeSnapshotClasses in the indexer.
|
||||
func (s *volumeSnapshotClassLister) List(selector labels.Selector) (ret []*v1alpha1.VolumeSnapshotClass, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.VolumeSnapshotClass))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the VolumeSnapshotClass from the index for a given name.
|
||||
func (s *volumeSnapshotClassLister) Get(name string) (*v1alpha1.VolumeSnapshotClass, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1alpha1.Resource("volumesnapshotclass"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), nil
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright 2018 The CDI 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.
|
||||
*/
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// VolumeSnapshotContentLister helps list VolumeSnapshotContents.
|
||||
type VolumeSnapshotContentLister interface {
|
||||
// List lists all VolumeSnapshotContents in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.VolumeSnapshotContent, err error)
|
||||
// Get retrieves the VolumeSnapshotContent from the index for a given name.
|
||||
Get(name string) (*v1alpha1.VolumeSnapshotContent, error)
|
||||
VolumeSnapshotContentListerExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotContentLister implements the VolumeSnapshotContentLister interface.
|
||||
type volumeSnapshotContentLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotContentLister returns a new VolumeSnapshotContentLister.
|
||||
func NewVolumeSnapshotContentLister(indexer cache.Indexer) VolumeSnapshotContentLister {
|
||||
return &volumeSnapshotContentLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all VolumeSnapshotContents in the indexer.
|
||||
func (s *volumeSnapshotContentLister) List(selector labels.Selector) (ret []*v1alpha1.VolumeSnapshotContent, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.VolumeSnapshotContent))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the VolumeSnapshotContent from the index for a given name.
|
||||
func (s *volumeSnapshotContentLister) Get(name string) (*v1alpha1.VolumeSnapshotContent, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1alpha1.Resource("volumesnapshotcontent"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), nil
|
||||
}
|
@ -40,12 +40,13 @@ const (
|
||||
|
||||
// run-time flags
|
||||
var (
|
||||
kubectlPath *string
|
||||
ocPath *string
|
||||
cdiInstallNs *string
|
||||
kubeConfig *string
|
||||
master *string
|
||||
goCLIPath *string
|
||||
kubectlPath *string
|
||||
ocPath *string
|
||||
cdiInstallNs *string
|
||||
kubeConfig *string
|
||||
master *string
|
||||
goCLIPath *string
|
||||
snapshotSCName *string
|
||||
)
|
||||
|
||||
// Config provides some basic test config options
|
||||
@ -91,6 +92,8 @@ type Framework struct {
|
||||
Master string
|
||||
// GoCliPath is a test run-time flag to store the location of gocli
|
||||
GoCLIPath string
|
||||
// SnapshotSCName is the Storage Class name that supports Snapshots
|
||||
SnapshotSCName string
|
||||
}
|
||||
|
||||
// TODO: look into k8s' SynchronizedBeforeSuite() and SynchronizedAfterSuite() code and their general
|
||||
@ -108,6 +111,7 @@ func init() {
|
||||
kubeConfig = flag.String("kubeconfig", "/var/run/kubernetes/admin.kubeconfig", "The absolute path to the kubeconfig file")
|
||||
master = flag.String("master", "", "master url:port")
|
||||
goCLIPath = flag.String("gocli-path", "cli.sh", "The path to cli script")
|
||||
snapshotSCName = flag.String("snapshot-sc", "", "The Storage Class supporting snapshots")
|
||||
}
|
||||
|
||||
// NewFrameworkOrDie calls NewFramework and handles errors by calling Fail. Config is optional, but
|
||||
@ -158,6 +162,7 @@ func NewFramework(prefix string, config Config) (*Framework, error) {
|
||||
f.KubeConfig = *kubeConfig
|
||||
f.Master = *master
|
||||
f.GoCLIPath = *goCLIPath
|
||||
f.SnapshotSCName = *snapshotSCName
|
||||
|
||||
restConfig, err := f.LoadConfig()
|
||||
if err != nil {
|
||||
|
147
tests/smartclone_test.go
Normal file
147
tests/smartclone_test.go
Normal file
@ -0,0 +1,147 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"kubevirt.io/containerized-data-importer/pkg/controller"
|
||||
"kubevirt.io/containerized-data-importer/tests/framework"
|
||||
"kubevirt.io/containerized-data-importer/tests/utils"
|
||||
|
||||
cdiv1 "kubevirt.io/containerized-data-importer/pkg/apis/core/v1alpha1"
|
||||
)
|
||||
|
||||
var _ = Describe("[vendor:cnv-qe@redhat.com][level:component]SmartClone tests", func() {
|
||||
|
||||
var sourcePvc *v1.PersistentVolumeClaim
|
||||
|
||||
fillData := "123456789012345678901234567890123456789012345678901234567890"
|
||||
testFile := utils.DefaultPvcMountPath + "/source.txt"
|
||||
fillCommand := "echo \"" + fillData + "\" >> " + testFile
|
||||
|
||||
f := framework.NewFrameworkOrDie("dv-func-test")
|
||||
|
||||
AfterEach(func() {
|
||||
if sourcePvc != nil {
|
||||
By("[AfterEach] Clean up source PVC")
|
||||
err := f.DeletePVC(sourcePvc)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
sourcePvc = nil
|
||||
}
|
||||
})
|
||||
|
||||
Describe("Verify DataVolume Smart Cloning - Positive flow", func() {
|
||||
It("succeed creating smart-clone dv", func() {
|
||||
if !IsSnapshotStorageClassAvailable(f) {
|
||||
Skip("Storage Class for clone via snapshot is not available")
|
||||
}
|
||||
dataVolume := createDataVolume("dv-smart-clone-test-1", sourcePvc, fillCommand, f.SnapshotSCName, f)
|
||||
// Wait for snapshot creation to start
|
||||
waitForDvPhase(cdiv1.SnapshotForSmartCloneInProgress, dataVolume, f)
|
||||
verifyEvent(controller.SnapshotForSmartCloneInProgress, dataVolume.Namespace, f)
|
||||
// Wait for PVC creation to start
|
||||
waitForDvPhase(cdiv1.SmartClonePVCInProgress, dataVolume, f)
|
||||
verifyEvent(controller.SmartClonePVCInProgress, dataVolume.Namespace, f)
|
||||
// Verify PVC's content
|
||||
verifyPVC(dataVolume, f)
|
||||
// Wait for operation Succeeded
|
||||
waitForDvPhase(cdiv1.Succeeded, dataVolume, f)
|
||||
verifyEvent(controller.CloneSucceeded, dataVolume.Namespace, f)
|
||||
|
||||
// Cleanup
|
||||
err := utils.DeleteDataVolume(f.CdiClient, f.Namespace.Name, dataVolume.Name)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Verify DataVolume Smart Cloning - Negative flow", func() {
|
||||
It("verify inapplicable smart-clone dv", func() {
|
||||
if controller.IsOpenshift(f.K8sClient) {
|
||||
Skip("Test not available in openshift")
|
||||
}
|
||||
dataVolume := createDataVolume("dv-smart-clone-test-negative", sourcePvc, fillCommand, "", f)
|
||||
|
||||
// Wait for operation Succeeded
|
||||
waitForDvPhase(cdiv1.Succeeded, dataVolume, f)
|
||||
verifyEvent(controller.CloneSucceeded, dataVolume.Namespace, f)
|
||||
|
||||
events, _ := RunKubectlCommand(f, "get", "events", "-n", dataVolume.Namespace)
|
||||
Expect(strings.Contains(events, controller.SnapshotForSmartCloneInProgress)).To(BeFalse())
|
||||
|
||||
// Cleanup
|
||||
err := utils.DeleteDataVolume(f.CdiClient, f.Namespace.Name, dataVolume.Name)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
func verifyPVC(dataVolume *cdiv1.DataVolume, f *framework.Framework) {
|
||||
By("verifying pvc was created")
|
||||
targetPvc, err := f.K8sClient.CoreV1().PersistentVolumeClaims(dataVolume.Namespace).Get(dataVolume.Name, metav1.GetOptions{})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
By(fmt.Sprint("Verifying target PVC content"))
|
||||
Expect(f.VerifyTargetPVCContent(f.Namespace, targetPvc, fillData, testBaseDir, testFile)).To(BeTrue())
|
||||
}
|
||||
|
||||
func waitForDvPhase(phase cdiv1.DataVolumePhase, dataVolume *cdiv1.DataVolume, f *framework.Framework) {
|
||||
By(fmt.Sprintf("waiting for datavolume to match phase %s", string(phase)))
|
||||
err := utils.WaitForDataVolumePhase(f.CdiClient, f.Namespace.Name, phase, dataVolume.Name)
|
||||
if err != nil {
|
||||
PrintControllerLog(f)
|
||||
dv, dverr := f.CdiClient.CdiV1alpha1().DataVolumes(f.Namespace.Name).Get(dataVolume.Name, metav1.GetOptions{})
|
||||
if dverr != nil {
|
||||
Fail(fmt.Sprintf("datavolume %s phase %s", dv.Name, dv.Status.Phase))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func IsSnapshotStorageClassAvailable(f *framework.Framework) bool {
|
||||
sc, err := f.K8sClient.StorageV1().StorageClasses().Get(f.SnapshotSCName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return sc.Name == f.SnapshotSCName
|
||||
}
|
||||
|
||||
func createDataVolume(dataVolumeName string, sourcePvc *v1.PersistentVolumeClaim, command string, scName string, f *framework.Framework) *cdiv1.DataVolume {
|
||||
By(fmt.Sprintf("Storage Class name: %s", scName))
|
||||
sourcePVCName := fmt.Sprintf("%s-src-pvc", dataVolumeName)
|
||||
sourcePodFillerName := fmt.Sprintf("%s-filler-pod", dataVolumeName)
|
||||
pvcDef := utils.NewPVCDefinition(sourcePVCName, "1G", nil, nil)
|
||||
if scName != "" {
|
||||
pvcDef.Spec.StorageClassName = &scName
|
||||
}
|
||||
sourcePvc = f.CreateAndPopulateSourcePVC(pvcDef, sourcePodFillerName, command)
|
||||
|
||||
By(fmt.Sprintf("creating a new target PVC (datavolume) to clone %s", sourcePvc.Name))
|
||||
dataVolume := utils.NewCloningDataVolume(dataVolumeName, "1Gi", sourcePvc)
|
||||
if scName != "" {
|
||||
dataVolume.Spec.PVC.StorageClassName = &scName
|
||||
}
|
||||
|
||||
By(fmt.Sprintf("creating new datavolume %s", dataVolume.Name))
|
||||
dataVolume, err := utils.CreateDataVolumeFromDefinition(f.CdiClient, f.Namespace.Name, dataVolume)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
return dataVolume
|
||||
}
|
||||
|
||||
func verifyEvent(eventReason string, dataVolumeNamespace string, f *framework.Framework) {
|
||||
By(fmt.Sprintf("Verifying event occurred: %s", eventReason))
|
||||
Eventually(func() bool {
|
||||
events, err := RunKubectlCommand(f, "get", "events", "-n", dataVolumeNamespace)
|
||||
if err == nil {
|
||||
fmt.Fprintf(GinkgoWriter, "%s", events)
|
||||
return strings.Contains(events, eventReason)
|
||||
}
|
||||
fmt.Fprintf(GinkgoWriter, "ERROR: %s\n", err.Error())
|
||||
return false
|
||||
}, timeout, pollingInterval).Should(BeTrue())
|
||||
}
|
37
vendor/github.com/gorilla/mux/regexp.go
generated
vendored
37
vendor/github.com/gorilla/mux/regexp.go
generated
vendored
@ -113,6 +113,13 @@ func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*ro
|
||||
if typ != regexpTypePrefix {
|
||||
pattern.WriteByte('$')
|
||||
}
|
||||
|
||||
var wildcardHostPort bool
|
||||
if typ == regexpTypeHost {
|
||||
if !strings.Contains(pattern.String(), ":") {
|
||||
wildcardHostPort = true
|
||||
}
|
||||
}
|
||||
reverse.WriteString(raw)
|
||||
if endSlash {
|
||||
reverse.WriteByte('/')
|
||||
@ -131,13 +138,14 @@ func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*ro
|
||||
|
||||
// Done!
|
||||
return &routeRegexp{
|
||||
template: template,
|
||||
regexpType: typ,
|
||||
options: options,
|
||||
regexp: reg,
|
||||
reverse: reverse.String(),
|
||||
varsN: varsN,
|
||||
varsR: varsR,
|
||||
template: template,
|
||||
regexpType: typ,
|
||||
options: options,
|
||||
regexp: reg,
|
||||
reverse: reverse.String(),
|
||||
varsN: varsN,
|
||||
varsR: varsR,
|
||||
wildcardHostPort: wildcardHostPort,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -158,11 +166,22 @@ type routeRegexp struct {
|
||||
varsN []string
|
||||
// Variable regexps (validators).
|
||||
varsR []*regexp.Regexp
|
||||
// Wildcard host-port (no strict port match in hostname)
|
||||
wildcardHostPort bool
|
||||
}
|
||||
|
||||
// Match matches the regexp against the URL host or path.
|
||||
func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
|
||||
if r.regexpType != regexpTypeHost {
|
||||
if r.regexpType == regexpTypeHost {
|
||||
host := getHost(req)
|
||||
if r.wildcardHostPort {
|
||||
// Don't be strict on the port match
|
||||
if i := strings.Index(host, ":"); i != -1 {
|
||||
host = host[:i]
|
||||
}
|
||||
}
|
||||
return r.regexp.MatchString(host)
|
||||
} else {
|
||||
if r.regexpType == regexpTypeQuery {
|
||||
return r.matchQueryString(req)
|
||||
}
|
||||
@ -172,8 +191,6 @@ func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
|
||||
}
|
||||
return r.regexp.MatchString(path)
|
||||
}
|
||||
|
||||
return r.regexp.MatchString(getHost(req))
|
||||
}
|
||||
|
||||
// url builds a URL part using the given values.
|
||||
|
40
vendor/github.com/kubernetes-csi/external-snapshotter/.github/PULL_REQUEST_TEMPLATE.md
generated
vendored
Normal file
40
vendor/github.com/kubernetes-csi/external-snapshotter/.github/PULL_REQUEST_TEMPLATE.md
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<!-- Thanks for sending a pull request! Here are some tips for you:
|
||||
|
||||
1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
|
||||
2. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/release-notes.md
|
||||
3. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
|
||||
-->
|
||||
|
||||
**What type of PR is this?**
|
||||
> Uncomment only one ` /kind <>` line, hit enter to put that in a new line, and remove leading whitespaces from that line:
|
||||
>
|
||||
> /kind api-change
|
||||
> /kind bug
|
||||
> /kind cleanup
|
||||
> /kind design
|
||||
> /kind documentation
|
||||
> /kind failing-test
|
||||
> /kind feature
|
||||
> /kind flake
|
||||
|
||||
**What this PR does / why we need it**:
|
||||
|
||||
**Which issue(s) this PR fixes**:
|
||||
<!--
|
||||
*Automatically closes linked issue when PR is merged.
|
||||
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
|
||||
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
|
||||
-->
|
||||
Fixes #
|
||||
|
||||
**Special notes for your reviewer**:
|
||||
|
||||
**Does this PR introduce a user-facing change?**:
|
||||
<!--
|
||||
If no, just write "NONE" in the release-note block below.
|
||||
If yes, a release note is required:
|
||||
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
|
||||
-->
|
||||
```release-note
|
||||
|
||||
```
|
2
vendor/github.com/kubernetes-csi/external-snapshotter/.gitignore
generated
vendored
Normal file
2
vendor/github.com/kubernetes-csi/external-snapshotter/.gitignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Compiled binaries and deployment files
|
||||
/bin/
|
5
vendor/github.com/kubernetes-csi/external-snapshotter/.prow.sh
generated
vendored
Executable file
5
vendor/github.com/kubernetes-csi/external-snapshotter/.prow.sh
generated
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
#! /bin/bash
|
||||
|
||||
. release-tools/prow.sh
|
||||
|
||||
main
|
1
vendor/github.com/kubernetes-csi/external-snapshotter/.travis.yml
generated
vendored
Symbolic link
1
vendor/github.com/kubernetes-csi/external-snapshotter/.travis.yml
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
release-tools/travis.yml
|
23
vendor/github.com/kubernetes-csi/external-snapshotter/CHANGELOG-1.1.md
generated
vendored
Normal file
23
vendor/github.com/kubernetes-csi/external-snapshotter/CHANGELOG-1.1.md
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# Changelog since v1.0.1
|
||||
|
||||
## Deprecations
|
||||
* Command line flag `--connection-timeout` is deprecated and has no effect.
|
||||
* Command line flag `--snapshotter` is deprecated and has no effect ([#103](https://github.com/kubernetes-csi/external-snapshotter/pull/103))
|
||||
|
||||
## Notable Features
|
||||
* Add Lease based Leader Election Support ([#107](https://github.com/kubernetes-csi/external-snapshotter/pull/107))
|
||||
* The external snapshotter now tries to connect to the CSI driver indefinitely ([#92](https://github.com/kubernetes-csi/external-snapshotter/pull/92))
|
||||
* A new --timeout parameter has been added for CSI operations ([#93](https://github.com/kubernetes-csi/external-snapshotter/pull/93))
|
||||
* Prow testing ([#111](https://github.com/kubernetes-csi/external-snapshotter/pull/111))
|
||||
|
||||
## Other Notable Changes
|
||||
* Add PR template ([#113](https://github.com/kubernetes-csi/external-snapshotter/pull/113))
|
||||
* Un-prune code-generator scripts ([#110](https://github.com/kubernetes-csi/external-snapshotter/pull/110))
|
||||
* Refactor external snapshotter to use csi-lib-utils/rpc ([#97](https://github.com/kubernetes-csi/external-snapshotter/pull/97))
|
||||
* Fix for pre-bound snapshot empty source error ([#98](https://github.com/kubernetes-csi/external-snapshotter/pull/98))
|
||||
* Update vendor to k8s 1.14.0 ([#105](https://github.com/kubernetes-csi/external-snapshotter/pull/105))
|
||||
* Migrate to k8s.io/klog from glog. ([#88](https://github.com/kubernetes-csi/external-snapshotter/pull/88))
|
||||
* Use distroless as base image ([#101](https://github.com/kubernetes-csi/external-snapshotter/pull/101))
|
||||
* Remove constraints and update all vendor pkgs ([#100](https://github.com/kubernetes-csi/external-snapshotter/pull/100))
|
||||
* Add dep prune options and remove unused packages ([#99](https://github.com/kubernetes-csi/external-snapshotter/pull/99))
|
||||
* Release tools ([#86](https://github.com/kubernetes-csi/external-snapshotter/pull/86))
|
22
vendor/github.com/kubernetes-csi/external-snapshotter/CONTRIBUTING.md
generated
vendored
Normal file
22
vendor/github.com/kubernetes-csi/external-snapshotter/CONTRIBUTING.md
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://github.com/kubernetes/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt:
|
||||
|
||||
_As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._
|
||||
|
||||
## Getting Started
|
||||
|
||||
We have full documentation on how to get started contributing here:
|
||||
|
||||
- [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests
|
||||
- [Kubernetes Contributor Guide](http://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](http://git.k8s.io/community/contributors/guide#contributing)
|
||||
- [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet.md) - Common resources for existing developers
|
||||
|
||||
## Mentorship
|
||||
|
||||
- [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers!
|
||||
|
||||
## Contact Information
|
||||
|
||||
- [Slack channel](https://kubernetes.slack.com/messages/sig-storage)
|
||||
- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-storage)
|
6
vendor/github.com/kubernetes-csi/external-snapshotter/Dockerfile
generated
vendored
Normal file
6
vendor/github.com/kubernetes-csi/external-snapshotter/Dockerfile
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
FROM gcr.io/distroless/static:latest
|
||||
LABEL maintainers="Kubernetes Authors"
|
||||
LABEL description="CSI External Snapshotter"
|
||||
|
||||
COPY ./bin/csi-snapshotter csi-snapshotter
|
||||
ENTRYPOINT ["/csi-snapshotter"]
|
813
vendor/github.com/kubernetes-csi/external-snapshotter/Gopkg.lock
generated
vendored
Normal file
813
vendor/github.com/kubernetes-csi/external-snapshotter/Gopkg.lock
generated
vendored
Normal file
@ -0,0 +1,813 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:7f21fa1f8ab9a529dba26a7e9cf20de217c307fa1d96cb599d3afd9e5c83e9d6"
|
||||
name = "github.com/container-storage-interface/spec"
|
||||
packages = ["lib/go/csi"]
|
||||
pruneopts = "NUT"
|
||||
revision = "f750e6765f5f6b4ac0e13e95214d58901290fb4b"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
pruneopts = "NUT"
|
||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:32598368f409bbee79deb9d43569fcd92b9fb27f39155f5e166b3371217f051f"
|
||||
name = "github.com/evanphx/json-patch"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "72bf35d0ff611848c1dc9df0f976c81192392fa5"
|
||||
version = "v4.1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a1b2a5e38f79688ee8250942d5fa960525fceb1024c855c7bc76fa77b0f3cca2"
|
||||
name = "github.com/gogo/protobuf"
|
||||
packages = [
|
||||
"proto",
|
||||
"sortkeys",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "ba06b47c162d49f2af050fb4c75bcbc86a159d5c"
|
||||
version = "v1.2.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:b7cb6054d3dff43b38ad2e92492f220f57ae6087ee797dca298139776749ace8"
|
||||
name = "github.com/golang/groupcache"
|
||||
packages = ["lru"]
|
||||
pruneopts = "NUT"
|
||||
revision = "5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:b60efdeb75d3c0ceed88783ac2495256aba3491a537d0f31401202579fd62a94"
|
||||
name = "github.com/golang/mock"
|
||||
packages = ["gomock"]
|
||||
pruneopts = "NUT"
|
||||
revision = "51421b967af1f557f93a59e0057aaf15ca02e29c"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:f0ba580759848d2bb230cb37bc288690f92812d0850112e07ecbd1b727f3d973"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"descriptor",
|
||||
"proto",
|
||||
"protoc-gen-go/descriptor",
|
||||
"ptypes",
|
||||
"ptypes/any",
|
||||
"ptypes/duration",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30"
|
||||
version = "v1.3.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:52c5834e2bebac9030c97cc0798ac11c3aa8a39f098aeb419f142533da6cd3cc"
|
||||
name = "github.com/google/gofuzz"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:06a7dadb7b760767341ffb6c8d377238d68a1226f2b21b5d497d2e3f6ecf6b4e"
|
||||
name = "github.com/googleapis/gnostic"
|
||||
packages = [
|
||||
"OpenAPIv2",
|
||||
"compiler",
|
||||
"extensions",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "7c663266750e7d82587642f65e60bc4083f1f84e"
|
||||
version = "v0.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:52094d0f8bdf831d1a2401e9b6fee5795fdc0b2a2d1f8bb1980834c289e79129"
|
||||
name = "github.com/hashicorp/golang-lru"
|
||||
packages = [
|
||||
".",
|
||||
"simplelru",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c"
|
||||
version = "v0.5.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:aaa38889f11896ee3644d77e17dc7764cc47f5f3d3b488268df2af2b52541c5f"
|
||||
name = "github.com/imdario/mergo"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "7c29201646fa3de8506f701213473dd407f19646"
|
||||
version = "v0.3.7"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4e903242fe176238aaa469f59d7035f5abf2aa9acfefb8964ddd203651b574e9"
|
||||
name = "github.com/json-iterator/go"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "0ff49de124c6f76f8494e194af75bde0f1a49a29"
|
||||
version = "v1.1.6"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:cfbb7ea18e982b7f97205743fcbdd7828f42ce1ac667192b713ada9fc62a958d"
|
||||
name = "github.com/kubernetes-csi/csi-lib-utils"
|
||||
packages = [
|
||||
"connection",
|
||||
"leaderelection",
|
||||
"protosanitizer",
|
||||
"rpc",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "b8b7a89535d80e12f2c0f4c53cfb981add8aaca2"
|
||||
version = "v0.6.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:189ada87769e6bd22de67cf8d5ac2f348070e7bcc4cdc5be3aaa5b19758e8fc2"
|
||||
name = "github.com/kubernetes-csi/csi-test"
|
||||
packages = [
|
||||
"driver",
|
||||
"utils",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "5421d9f3c37be3b95b241b44a094a3db11bee789"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:2f42fa12d6911c7b7659738758631bec870b7e9b4c6be5444f963cdcfccc191f"
|
||||
name = "github.com/modern-go/concurrent"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94"
|
||||
version = "1.0.3"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c6aca19413b13dc59c220ad7430329e2ec454cc310bc6d8de2c7e2b93c18a0f6"
|
||||
name = "github.com/modern-go/reflect2"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
|
||||
version = "1.0.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:9d8420bbf131d1618bde6530af37c3799340d3762cc47210c1d9532a4c3a2779"
|
||||
name = "github.com/spf13/pflag"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "298182f68c66c05229eb03ac171abe6e309ee79a"
|
||||
version = "v1.0.3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:bbe51412d9915d64ffaa96b51d409e070665efc5194fcf145c4a27d4133107a4"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["ssh/terminal"]
|
||||
pruneopts = "NUT"
|
||||
revision = "a5d413f7728c81fb97d96a2b722368945f651e78"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:8750c495cba39e0d2402c424760734a695d4ab91579374f0624f411d52cda1a6"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
"context/ctxhttp",
|
||||
"http/httpguts",
|
||||
"http2",
|
||||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "b630fd6fe46bcfc98f989005d8b8ec1400e60a6e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:4d25d388c9ad5169b31c1a6f16cc7bcdb856489958e99f2123d8d8cdf000d7eb"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [
|
||||
".",
|
||||
"internal",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "9f3314589c9a9136388751d9adae6b0ed400978a"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:992976af3618fd8fb06e5e4c4fa177800a1e0880cbbbc91df3f952520808806c"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "81d4e9dc473e5e8c933f2aaeba2a3d81efb9aed2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e7071ed636b5422cc51c0e3a6cebc229d6c9fffc528814b519a980641422d619"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
"collate/build",
|
||||
"internal/colltab",
|
||||
"internal/gen",
|
||||
"internal/tag",
|
||||
"internal/triegen",
|
||||
"internal/ucd",
|
||||
"language",
|
||||
"secure/bidirule",
|
||||
"transform",
|
||||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:9fdc2b55e8e0fafe4b41884091e51e77344f7dc511c5acedcfd98200003bff90"
|
||||
name = "golang.org/x/time"
|
||||
packages = ["rate"]
|
||||
pruneopts = "NUT"
|
||||
revision = "9d24e82272b4f38b78bc8cff74fa936d31ccd8ef"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:59b401940f79c311efa01c10e2fa8e78522a978538127f369fb39690a03c3eb4"
|
||||
name = "golang.org/x/tools"
|
||||
packages = [
|
||||
"go/ast/astutil",
|
||||
"go/gcexportdata",
|
||||
"go/internal/gcimporter",
|
||||
"go/internal/packagesdriver",
|
||||
"go/packages",
|
||||
"go/types/typeutil",
|
||||
"imports",
|
||||
"internal/fastwalk",
|
||||
"internal/gopathwalk",
|
||||
"internal/module",
|
||||
"internal/semver",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "8a44e74612bcf51f0d4407df3d3a8377cb99c2d8"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:372cd8eba449f9b6db06677d0e73fa193ec5b19aaee148f355503ab6127045ca"
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [
|
||||
"internal",
|
||||
"internal/base",
|
||||
"internal/datastore",
|
||||
"internal/log",
|
||||
"internal/remote_api",
|
||||
"internal/urlfetch",
|
||||
"urlfetch",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "54a98f90d1c46b7731eb8fb305d2a321c30ef610"
|
||||
version = "v1.5.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:c3076e7defee87de1236f1814beb588f40a75544c60121e6eb38b3b3721783e2"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/rpc/status"]
|
||||
pruneopts = "NUT"
|
||||
revision = "f467c93bbac2133ff463e1f93d18d8f9f3f04451"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:119dce30813e7fe92f031c730bd2fb3ff1bac6fc6bb9d1450507e8bf0ad77620"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
"balancer",
|
||||
"balancer/base",
|
||||
"balancer/roundrobin",
|
||||
"binarylog/grpc_binarylog_v1",
|
||||
"codes",
|
||||
"connectivity",
|
||||
"credentials",
|
||||
"credentials/internal",
|
||||
"encoding",
|
||||
"encoding/proto",
|
||||
"grpclog",
|
||||
"internal",
|
||||
"internal/backoff",
|
||||
"internal/binarylog",
|
||||
"internal/channelz",
|
||||
"internal/envconfig",
|
||||
"internal/grpcrand",
|
||||
"internal/grpcsync",
|
||||
"internal/syscall",
|
||||
"internal/transport",
|
||||
"keepalive",
|
||||
"metadata",
|
||||
"naming",
|
||||
"peer",
|
||||
"reflection",
|
||||
"reflection/grpc_reflection_v1alpha",
|
||||
"resolver",
|
||||
"resolver/dns",
|
||||
"resolver/passthrough",
|
||||
"stats",
|
||||
"status",
|
||||
"tap",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "3507fb8e1a5ad030303c106fef3a47c9fdad16ad"
|
||||
version = "v1.19.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:2d1fbdc6777e5408cabeb02bf336305e724b925ff4546ded0fa8715a7267922a"
|
||||
name = "gopkg.in/inf.v0"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf"
|
||||
version = "v0.9.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:18108594151654e9e696b27b181b953f9a90b16bf14d253dd1b397b025a1487f"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "51d6538a90f86fe93ac480b35f37b2be17fef232"
|
||||
version = "v2.2.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a937ed4322409fa22924f02124fd0727c19662f73cf15406646d19bdce972df2"
|
||||
name = "k8s.io/api"
|
||||
packages = [
|
||||
"admissionregistration/v1beta1",
|
||||
"apps/v1",
|
||||
"apps/v1beta1",
|
||||
"apps/v1beta2",
|
||||
"auditregistration/v1alpha1",
|
||||
"authentication/v1",
|
||||
"authentication/v1beta1",
|
||||
"authorization/v1",
|
||||
"authorization/v1beta1",
|
||||
"autoscaling/v1",
|
||||
"autoscaling/v2beta1",
|
||||
"autoscaling/v2beta2",
|
||||
"batch/v1",
|
||||
"batch/v1beta1",
|
||||
"batch/v2alpha1",
|
||||
"certificates/v1beta1",
|
||||
"coordination/v1",
|
||||
"coordination/v1beta1",
|
||||
"core/v1",
|
||||
"events/v1beta1",
|
||||
"extensions/v1beta1",
|
||||
"networking/v1",
|
||||
"networking/v1beta1",
|
||||
"node/v1alpha1",
|
||||
"node/v1beta1",
|
||||
"policy/v1beta1",
|
||||
"rbac/v1",
|
||||
"rbac/v1alpha1",
|
||||
"rbac/v1beta1",
|
||||
"scheduling/v1",
|
||||
"scheduling/v1alpha1",
|
||||
"scheduling/v1beta1",
|
||||
"settings/v1alpha1",
|
||||
"storage/v1",
|
||||
"storage/v1alpha1",
|
||||
"storage/v1beta1",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "40a48860b5abbba9aa891b02b32da429b08d96a0"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:edf8a3c5c2f8f46ae492c7272bb451f18a423639e86b10cd0ec72b56fe50f60a"
|
||||
name = "k8s.io/apiextensions-apiserver"
|
||||
packages = [
|
||||
"pkg/apis/apiextensions",
|
||||
"pkg/apis/apiextensions/v1beta1",
|
||||
"pkg/client/clientset/clientset",
|
||||
"pkg/client/clientset/clientset/scheme",
|
||||
"pkg/client/clientset/clientset/typed/apiextensions/v1beta1",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "53c4693659ed354d76121458fb819202dd1635fa"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d8205124c900012b3395c3ef374c1e7a385a66e2587b5267cc6106552314241b"
|
||||
name = "k8s.io/apimachinery"
|
||||
packages = [
|
||||
"pkg/api/errors",
|
||||
"pkg/api/meta",
|
||||
"pkg/api/resource",
|
||||
"pkg/apis/meta/internalversion",
|
||||
"pkg/apis/meta/v1",
|
||||
"pkg/apis/meta/v1/unstructured",
|
||||
"pkg/apis/meta/v1beta1",
|
||||
"pkg/conversion",
|
||||
"pkg/conversion/queryparams",
|
||||
"pkg/fields",
|
||||
"pkg/labels",
|
||||
"pkg/runtime",
|
||||
"pkg/runtime/schema",
|
||||
"pkg/runtime/serializer",
|
||||
"pkg/runtime/serializer/json",
|
||||
"pkg/runtime/serializer/protobuf",
|
||||
"pkg/runtime/serializer/recognizer",
|
||||
"pkg/runtime/serializer/streaming",
|
||||
"pkg/runtime/serializer/versioning",
|
||||
"pkg/selection",
|
||||
"pkg/types",
|
||||
"pkg/util/cache",
|
||||
"pkg/util/clock",
|
||||
"pkg/util/diff",
|
||||
"pkg/util/errors",
|
||||
"pkg/util/framer",
|
||||
"pkg/util/intstr",
|
||||
"pkg/util/json",
|
||||
"pkg/util/mergepatch",
|
||||
"pkg/util/naming",
|
||||
"pkg/util/net",
|
||||
"pkg/util/rand",
|
||||
"pkg/util/runtime",
|
||||
"pkg/util/sets",
|
||||
"pkg/util/strategicpatch",
|
||||
"pkg/util/validation",
|
||||
"pkg/util/validation/field",
|
||||
"pkg/util/wait",
|
||||
"pkg/util/yaml",
|
||||
"pkg/version",
|
||||
"pkg/watch",
|
||||
"third_party/forked/golang/json",
|
||||
"third_party/forked/golang/reflect",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "d7deff9243b165ee192f5551710ea4285dcfd615"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:85f25c196bc700354adc889a397f6550105865ad2588704094276f78f6e9d9ba"
|
||||
name = "k8s.io/client-go"
|
||||
packages = [
|
||||
"discovery",
|
||||
"discovery/fake",
|
||||
"informers",
|
||||
"informers/admissionregistration",
|
||||
"informers/admissionregistration/v1beta1",
|
||||
"informers/apps",
|
||||
"informers/apps/v1",
|
||||
"informers/apps/v1beta1",
|
||||
"informers/apps/v1beta2",
|
||||
"informers/auditregistration",
|
||||
"informers/auditregistration/v1alpha1",
|
||||
"informers/autoscaling",
|
||||
"informers/autoscaling/v1",
|
||||
"informers/autoscaling/v2beta1",
|
||||
"informers/autoscaling/v2beta2",
|
||||
"informers/batch",
|
||||
"informers/batch/v1",
|
||||
"informers/batch/v1beta1",
|
||||
"informers/batch/v2alpha1",
|
||||
"informers/certificates",
|
||||
"informers/certificates/v1beta1",
|
||||
"informers/coordination",
|
||||
"informers/coordination/v1",
|
||||
"informers/coordination/v1beta1",
|
||||
"informers/core",
|
||||
"informers/core/v1",
|
||||
"informers/events",
|
||||
"informers/events/v1beta1",
|
||||
"informers/extensions",
|
||||
"informers/extensions/v1beta1",
|
||||
"informers/internalinterfaces",
|
||||
"informers/networking",
|
||||
"informers/networking/v1",
|
||||
"informers/networking/v1beta1",
|
||||
"informers/node",
|
||||
"informers/node/v1alpha1",
|
||||
"informers/node/v1beta1",
|
||||
"informers/policy",
|
||||
"informers/policy/v1beta1",
|
||||
"informers/rbac",
|
||||
"informers/rbac/v1",
|
||||
"informers/rbac/v1alpha1",
|
||||
"informers/rbac/v1beta1",
|
||||
"informers/scheduling",
|
||||
"informers/scheduling/v1",
|
||||
"informers/scheduling/v1alpha1",
|
||||
"informers/scheduling/v1beta1",
|
||||
"informers/settings",
|
||||
"informers/settings/v1alpha1",
|
||||
"informers/storage",
|
||||
"informers/storage/v1",
|
||||
"informers/storage/v1alpha1",
|
||||
"informers/storage/v1beta1",
|
||||
"kubernetes",
|
||||
"kubernetes/fake",
|
||||
"kubernetes/scheme",
|
||||
"kubernetes/typed/admissionregistration/v1beta1",
|
||||
"kubernetes/typed/admissionregistration/v1beta1/fake",
|
||||
"kubernetes/typed/apps/v1",
|
||||
"kubernetes/typed/apps/v1/fake",
|
||||
"kubernetes/typed/apps/v1beta1",
|
||||
"kubernetes/typed/apps/v1beta1/fake",
|
||||
"kubernetes/typed/apps/v1beta2",
|
||||
"kubernetes/typed/apps/v1beta2/fake",
|
||||
"kubernetes/typed/auditregistration/v1alpha1",
|
||||
"kubernetes/typed/auditregistration/v1alpha1/fake",
|
||||
"kubernetes/typed/authentication/v1",
|
||||
"kubernetes/typed/authentication/v1/fake",
|
||||
"kubernetes/typed/authentication/v1beta1",
|
||||
"kubernetes/typed/authentication/v1beta1/fake",
|
||||
"kubernetes/typed/authorization/v1",
|
||||
"kubernetes/typed/authorization/v1/fake",
|
||||
"kubernetes/typed/authorization/v1beta1",
|
||||
"kubernetes/typed/authorization/v1beta1/fake",
|
||||
"kubernetes/typed/autoscaling/v1",
|
||||
"kubernetes/typed/autoscaling/v1/fake",
|
||||
"kubernetes/typed/autoscaling/v2beta1",
|
||||
"kubernetes/typed/autoscaling/v2beta1/fake",
|
||||
"kubernetes/typed/autoscaling/v2beta2",
|
||||
"kubernetes/typed/autoscaling/v2beta2/fake",
|
||||
"kubernetes/typed/batch/v1",
|
||||
"kubernetes/typed/batch/v1/fake",
|
||||
"kubernetes/typed/batch/v1beta1",
|
||||
"kubernetes/typed/batch/v1beta1/fake",
|
||||
"kubernetes/typed/batch/v2alpha1",
|
||||
"kubernetes/typed/batch/v2alpha1/fake",
|
||||
"kubernetes/typed/certificates/v1beta1",
|
||||
"kubernetes/typed/certificates/v1beta1/fake",
|
||||
"kubernetes/typed/coordination/v1",
|
||||
"kubernetes/typed/coordination/v1/fake",
|
||||
"kubernetes/typed/coordination/v1beta1",
|
||||
"kubernetes/typed/coordination/v1beta1/fake",
|
||||
"kubernetes/typed/core/v1",
|
||||
"kubernetes/typed/core/v1/fake",
|
||||
"kubernetes/typed/events/v1beta1",
|
||||
"kubernetes/typed/events/v1beta1/fake",
|
||||
"kubernetes/typed/extensions/v1beta1",
|
||||
"kubernetes/typed/extensions/v1beta1/fake",
|
||||
"kubernetes/typed/networking/v1",
|
||||
"kubernetes/typed/networking/v1/fake",
|
||||
"kubernetes/typed/networking/v1beta1",
|
||||
"kubernetes/typed/networking/v1beta1/fake",
|
||||
"kubernetes/typed/node/v1alpha1",
|
||||
"kubernetes/typed/node/v1alpha1/fake",
|
||||
"kubernetes/typed/node/v1beta1",
|
||||
"kubernetes/typed/node/v1beta1/fake",
|
||||
"kubernetes/typed/policy/v1beta1",
|
||||
"kubernetes/typed/policy/v1beta1/fake",
|
||||
"kubernetes/typed/rbac/v1",
|
||||
"kubernetes/typed/rbac/v1/fake",
|
||||
"kubernetes/typed/rbac/v1alpha1",
|
||||
"kubernetes/typed/rbac/v1alpha1/fake",
|
||||
"kubernetes/typed/rbac/v1beta1",
|
||||
"kubernetes/typed/rbac/v1beta1/fake",
|
||||
"kubernetes/typed/scheduling/v1",
|
||||
"kubernetes/typed/scheduling/v1/fake",
|
||||
"kubernetes/typed/scheduling/v1alpha1",
|
||||
"kubernetes/typed/scheduling/v1alpha1/fake",
|
||||
"kubernetes/typed/scheduling/v1beta1",
|
||||
"kubernetes/typed/scheduling/v1beta1/fake",
|
||||
"kubernetes/typed/settings/v1alpha1",
|
||||
"kubernetes/typed/settings/v1alpha1/fake",
|
||||
"kubernetes/typed/storage/v1",
|
||||
"kubernetes/typed/storage/v1/fake",
|
||||
"kubernetes/typed/storage/v1alpha1",
|
||||
"kubernetes/typed/storage/v1alpha1/fake",
|
||||
"kubernetes/typed/storage/v1beta1",
|
||||
"kubernetes/typed/storage/v1beta1/fake",
|
||||
"listers/admissionregistration/v1beta1",
|
||||
"listers/apps/v1",
|
||||
"listers/apps/v1beta1",
|
||||
"listers/apps/v1beta2",
|
||||
"listers/auditregistration/v1alpha1",
|
||||
"listers/autoscaling/v1",
|
||||
"listers/autoscaling/v2beta1",
|
||||
"listers/autoscaling/v2beta2",
|
||||
"listers/batch/v1",
|
||||
"listers/batch/v1beta1",
|
||||
"listers/batch/v2alpha1",
|
||||
"listers/certificates/v1beta1",
|
||||
"listers/coordination/v1",
|
||||
"listers/coordination/v1beta1",
|
||||
"listers/core/v1",
|
||||
"listers/events/v1beta1",
|
||||
"listers/extensions/v1beta1",
|
||||
"listers/networking/v1",
|
||||
"listers/networking/v1beta1",
|
||||
"listers/node/v1alpha1",
|
||||
"listers/node/v1beta1",
|
||||
"listers/policy/v1beta1",
|
||||
"listers/rbac/v1",
|
||||
"listers/rbac/v1alpha1",
|
||||
"listers/rbac/v1beta1",
|
||||
"listers/scheduling/v1",
|
||||
"listers/scheduling/v1alpha1",
|
||||
"listers/scheduling/v1beta1",
|
||||
"listers/settings/v1alpha1",
|
||||
"listers/storage/v1",
|
||||
"listers/storage/v1alpha1",
|
||||
"listers/storage/v1beta1",
|
||||
"pkg/apis/clientauthentication",
|
||||
"pkg/apis/clientauthentication/v1alpha1",
|
||||
"pkg/apis/clientauthentication/v1beta1",
|
||||
"pkg/version",
|
||||
"plugin/pkg/client/auth/exec",
|
||||
"rest",
|
||||
"rest/watch",
|
||||
"testing",
|
||||
"tools/auth",
|
||||
"tools/cache",
|
||||
"tools/clientcmd",
|
||||
"tools/clientcmd/api",
|
||||
"tools/clientcmd/api/latest",
|
||||
"tools/clientcmd/api/v1",
|
||||
"tools/leaderelection",
|
||||
"tools/leaderelection/resourcelock",
|
||||
"tools/metrics",
|
||||
"tools/pager",
|
||||
"tools/record",
|
||||
"tools/record/util",
|
||||
"tools/reference",
|
||||
"transport",
|
||||
"util/cert",
|
||||
"util/connrotation",
|
||||
"util/flowcontrol",
|
||||
"util/homedir",
|
||||
"util/keyutil",
|
||||
"util/retry",
|
||||
"util/workqueue",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "6ee68ca5fd8355d024d02f9db0b3b667e8357a0f"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:2d821667dbd520a7ef31bdc923543f197ba30021b4317fd8871618ada52f23b0"
|
||||
name = "k8s.io/code-generator"
|
||||
packages = [
|
||||
"cmd/client-gen",
|
||||
"cmd/client-gen/args",
|
||||
"cmd/client-gen/generators",
|
||||
"cmd/client-gen/generators/fake",
|
||||
"cmd/client-gen/generators/scheme",
|
||||
"cmd/client-gen/generators/util",
|
||||
"cmd/client-gen/path",
|
||||
"cmd/client-gen/types",
|
||||
"cmd/deepcopy-gen",
|
||||
"cmd/deepcopy-gen/args",
|
||||
"cmd/defaulter-gen",
|
||||
"cmd/defaulter-gen/args",
|
||||
"cmd/informer-gen",
|
||||
"cmd/informer-gen/args",
|
||||
"cmd/informer-gen/generators",
|
||||
"cmd/lister-gen",
|
||||
"cmd/lister-gen/args",
|
||||
"cmd/lister-gen/generators",
|
||||
"pkg/namer",
|
||||
"pkg/util",
|
||||
]
|
||||
pruneopts = "T"
|
||||
revision = "50b561225d70b3eb79a1faafd3dfe7b1a62cbe73"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:39912eb5f8eaf46486faae0839586c27c93423e552f76875defa048f52c15c15"
|
||||
name = "k8s.io/gengo"
|
||||
packages = [
|
||||
"args",
|
||||
"examples/deepcopy-gen/generators",
|
||||
"examples/defaulter-gen/generators",
|
||||
"examples/set-gen/sets",
|
||||
"generator",
|
||||
"namer",
|
||||
"parser",
|
||||
"types",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "e17681d19d3ac4837a019ece36c2a0ec31ffe985"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c263611800c3a97991dbcf9d3bc4de390f6224aaa8ca0a7226a9d734f65a416a"
|
||||
name = "k8s.io/klog"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "71442cd4037d612096940ceb0f3fec3f7fff66e0"
|
||||
version = "v0.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:42674e29bf0cf4662d49bd9528e24b9ecc4895b32d0be281f9cf04d3a7671846"
|
||||
name = "k8s.io/kube-openapi"
|
||||
packages = ["pkg/util/proto"]
|
||||
pruneopts = "NUT"
|
||||
revision = "94e1e7b7574c44c4c0f2007de6fe617e259191f3"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:15eb7bbf576cc9517ba70b469f9097948ac32f6766bbf6f8b982b81a468b1b74"
|
||||
name = "k8s.io/kubernetes"
|
||||
packages = [
|
||||
"pkg/util/goroutinemap",
|
||||
"pkg/util/goroutinemap/exponentialbackoff",
|
||||
"pkg/util/slice",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "641856db18352033a0d96dbc99153fa3b27298e5"
|
||||
version = "v1.14.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:14e8a3b53e6d8cb5f44783056b71bb2ca1ac7e333939cc97f3e50b579c920845"
|
||||
name = "k8s.io/utils"
|
||||
packages = [
|
||||
"buffer",
|
||||
"integer",
|
||||
"trace",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "21c4ce38f2a793ec01e925ddc31216500183b773"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
|
||||
name = "sigs.k8s.io/yaml"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480"
|
||||
version = "v1.1.0"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
input-imports = [
|
||||
"github.com/container-storage-interface/spec/lib/go/csi",
|
||||
"github.com/golang/mock/gomock",
|
||||
"github.com/golang/protobuf/ptypes",
|
||||
"github.com/golang/protobuf/ptypes/timestamp",
|
||||
"github.com/kubernetes-csi/csi-lib-utils/connection",
|
||||
"github.com/kubernetes-csi/csi-lib-utils/leaderelection",
|
||||
"github.com/kubernetes-csi/csi-lib-utils/rpc",
|
||||
"github.com/kubernetes-csi/csi-test/driver",
|
||||
"google.golang.org/grpc",
|
||||
"google.golang.org/grpc/codes",
|
||||
"google.golang.org/grpc/status",
|
||||
"k8s.io/api/core/v1",
|
||||
"k8s.io/api/storage/v1",
|
||||
"k8s.io/api/storage/v1beta1",
|
||||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1",
|
||||
"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset",
|
||||
"k8s.io/apimachinery/pkg/api/errors",
|
||||
"k8s.io/apimachinery/pkg/api/meta",
|
||||
"k8s.io/apimachinery/pkg/api/resource",
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"k8s.io/apimachinery/pkg/labels",
|
||||
"k8s.io/apimachinery/pkg/runtime",
|
||||
"k8s.io/apimachinery/pkg/runtime/schema",
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer",
|
||||
"k8s.io/apimachinery/pkg/types",
|
||||
"k8s.io/apimachinery/pkg/util/diff",
|
||||
"k8s.io/apimachinery/pkg/util/runtime",
|
||||
"k8s.io/apimachinery/pkg/util/sets",
|
||||
"k8s.io/apimachinery/pkg/util/validation",
|
||||
"k8s.io/apimachinery/pkg/util/wait",
|
||||
"k8s.io/apimachinery/pkg/watch",
|
||||
"k8s.io/client-go/discovery",
|
||||
"k8s.io/client-go/discovery/fake",
|
||||
"k8s.io/client-go/informers",
|
||||
"k8s.io/client-go/informers/core/v1",
|
||||
"k8s.io/client-go/kubernetes",
|
||||
"k8s.io/client-go/kubernetes/fake",
|
||||
"k8s.io/client-go/kubernetes/scheme",
|
||||
"k8s.io/client-go/kubernetes/typed/core/v1",
|
||||
"k8s.io/client-go/listers/core/v1",
|
||||
"k8s.io/client-go/rest",
|
||||
"k8s.io/client-go/testing",
|
||||
"k8s.io/client-go/tools/cache",
|
||||
"k8s.io/client-go/tools/clientcmd",
|
||||
"k8s.io/client-go/tools/record",
|
||||
"k8s.io/client-go/tools/reference",
|
||||
"k8s.io/client-go/util/flowcontrol",
|
||||
"k8s.io/client-go/util/workqueue",
|
||||
"k8s.io/code-generator/cmd/client-gen",
|
||||
"k8s.io/code-generator/cmd/deepcopy-gen",
|
||||
"k8s.io/code-generator/cmd/defaulter-gen",
|
||||
"k8s.io/code-generator/cmd/informer-gen",
|
||||
"k8s.io/code-generator/cmd/lister-gen",
|
||||
"k8s.io/klog",
|
||||
"k8s.io/kubernetes/pkg/util/goroutinemap",
|
||||
"k8s.io/kubernetes/pkg/util/goroutinemap/exponentialbackoff",
|
||||
"k8s.io/kubernetes/pkg/util/slice",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
51
vendor/github.com/kubernetes-csi/external-snapshotter/Gopkg.toml
generated
vendored
Normal file
51
vendor/github.com/kubernetes-csi/external-snapshotter/Gopkg.toml
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
# List of dependecies for CSI snapshotter
|
||||
|
||||
required = [
|
||||
"k8s.io/code-generator/cmd/client-gen",
|
||||
"k8s.io/code-generator/cmd/informer-gen",
|
||||
"k8s.io/code-generator/cmd/lister-gen",
|
||||
"k8s.io/code-generator/cmd/deepcopy-gen",
|
||||
"k8s.io/code-generator/cmd/defaulter-gen",
|
||||
]
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/container-storage-interface/spec"
|
||||
version = "=1.1.0"
|
||||
|
||||
# The dependency on external-provisioner should be removed with #60.
|
||||
[[constraint]]
|
||||
name = "k8s.io/api"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/apimachinery"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/client-go"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/code-generator"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/apiextensions-apiserver"
|
||||
version = "kubernetes-1.14.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/kubernetes-csi/csi-lib-utils"
|
||||
version = ">=v0.6.1"
|
||||
|
||||
[prune]
|
||||
non-go = true
|
||||
go-tests = true
|
||||
unused-packages = true
|
||||
[[prune.project]]
|
||||
# Scripts under code-generator are required to generate code
|
||||
# when snapshot APIs are changed. Therefore they should not
|
||||
# be pruned.
|
||||
name = "k8s.io/code-generator"
|
||||
non-go = false
|
||||
unused-packages = false
|
201
vendor/github.com/kubernetes-csi/external-snapshotter/LICENSE
generated
vendored
Normal file
201
vendor/github.com/kubernetes-csi/external-snapshotter/LICENSE
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
19
vendor/github.com/kubernetes-csi/external-snapshotter/Makefile
generated
vendored
Normal file
19
vendor/github.com/kubernetes-csi/external-snapshotter/Makefile
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright 2018 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.
|
||||
|
||||
.PHONY: all csi-snapshotter clean test
|
||||
|
||||
CMDS=csi-snapshotter
|
||||
all: build
|
||||
include release-tools/build.make
|
6
vendor/github.com/kubernetes-csi/external-snapshotter/OWNERS
generated
vendored
Normal file
6
vendor/github.com/kubernetes-csi/external-snapshotter/OWNERS
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
approvers:
|
||||
- saad-ali
|
||||
- lpabon
|
||||
- jingxu97
|
||||
- xing-yang
|
||||
- wackxu
|
85
vendor/github.com/kubernetes-csi/external-snapshotter/README.md
generated
vendored
Normal file
85
vendor/github.com/kubernetes-csi/external-snapshotter/README.md
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
# CSI Snapshotter
|
||||
|
||||
The CSI external-snapshotter is part of Kubernetes implementation of [Container Storage Interface (CSI)](https://github.com/container-storage-interface/spec).
|
||||
|
||||
The volume snapshot feature supports CSI v1.0 and it has been an Alpha feature in Kubernetes since v1.12.
|
||||
|
||||
## Overview
|
||||
|
||||
CSI Snapshotter is an external controller that watches Kubernetes Snapshot CRD objects and triggers CreateSnapshot/DeleteSnapshot against a CSI endpoint. Full design can be found at Kubernetes proposal at [here](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/csi-snapshot.md)
|
||||
|
||||
## Design
|
||||
|
||||
External snapshotter follows [controller](https://github.com/kubernetes/community/blob/master/contributors/devel/controllers.md) pattern and uses informers to watch for `VolumeSnapshot` and `VolumeSnapshotContent` create/update/delete events. It filters out these objects with `Snapshotter==<CSI driver name>` specified in the associated VolumeSnapshotClass object and then processes these events in workqueues with exponential backoff.
|
||||
|
||||
### Snapshotter
|
||||
|
||||
Snapshotter talks to CSI over socket (/run/csi/socket by default, configurable by -csi-address). The snapshotter then:
|
||||
|
||||
* Discovers the supported snapshotter name by `GetDriverName` call.
|
||||
|
||||
* Uses ControllerGetCapabilities for find out if CSI driver supports `ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT` and `ControllerServiceCapability_RPC_LIST_SNAPSHOTS` calls. Otherwise, the controller will not start.
|
||||
|
||||
* Processes new/updated/deleted `VolumeSnapshots`: The snapshotter only processes `VolumeSnapshot` that has `snapshotter` specified in its `VolumeSnapshotClass` matches its driver name. The process workflow is as follows
|
||||
* If the snapshot status is `Ready`, the controller checks whether the snapshot and its content still binds correctly. If there is any problem with the binding (e.g., snapshot points to a non-exist snapshot content), update the snapshot status and emit event.
|
||||
* If the snapshot status is not ready, there are two cases.
|
||||
* `SnapshotContentName` is not empty: the controller verifies whether the snapshot content exists and also binds to the snapshot. If verification passes, the controller binds the snapshot and its content objects and marks it is ready. Otherwise, it updates the error status of the snapshot.
|
||||
* `SnapshotContentName` is set empty: the controller will first check whether there is already a content object which binds the snapshot correctly with snapshot uid (`VolumeSnapshotRef.UID`) specified. If so, the controller binds these two objects. Otherwise, the controller issues a create snapshot operation. Please note that if the error status shows that snapshot creation already failed before, it will not try to create snapshot again.
|
||||
|
||||
* Processes new/updated/deleted `VolumeSnapshotContents`: The snapshotter only processes `VolumeSnapshotContent` in which the CSI driver specified in the spec matches the controller's driver name.
|
||||
* If the `VolumeSnapshotRef` is set to nil, skip this content since it is not bound to any snapshot object.
|
||||
* Otherwise, the controller verifies whether the content object is correctly bound to a snapshot object. In case the `VolumeSnapshotRef.UID` is set but it does not match its snapshot object or snapshot no long exists, the content object and its associated snapshot will be deleted.
|
||||
|
||||
## Usage
|
||||
|
||||
### Running on command line
|
||||
|
||||
For debugging, it is possible to run snapshotter on command line. For example,
|
||||
|
||||
```bash
|
||||
csi-snapshotter -kubeconfig ~/.kube/config -v 5 -csi-address /run/csi/socket
|
||||
```
|
||||
|
||||
### Running in a statefulset
|
||||
|
||||
It is necessary to create a new service account and give it enough privileges to run the snapshotter. We provide .yaml files that deploy for use together with the hostpath example driver. A real production deployment must customize them:
|
||||
|
||||
```bash
|
||||
for i in $(find deploy/kubernetes -name '*.yaml'); do kubectl create -f $i; done
|
||||
```
|
||||
|
||||
### Running with Leader Election
|
||||
|
||||
If you want to run external-snapshotter with higher availability, you can enable resource based leader election. To enable this, set the following flags:
|
||||
```bash
|
||||
--leader-election=true
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Running Unit Tests:
|
||||
|
||||
```bash
|
||||
go test -timeout 30s github.com/kubernetes-csi/external-snapshotter/pkg/controller
|
||||
```
|
||||
|
||||
## Dependency Management
|
||||
|
||||
```bash
|
||||
dep ensure
|
||||
```
|
||||
|
||||
To modify dependencies or versions change `./Gopkg.toml`
|
||||
|
||||
## Community, discussion, contribution, and support
|
||||
|
||||
Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).
|
||||
|
||||
You can reach the maintainers of this project at:
|
||||
|
||||
* [Slack channel](https://kubernetes.slack.com/messages/sig-storage)
|
||||
* [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-storage)
|
||||
|
||||
### Code of conduct
|
||||
|
||||
Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
|
13
vendor/github.com/kubernetes-csi/external-snapshotter/SECURITY_CONTACTS
generated
vendored
Normal file
13
vendor/github.com/kubernetes-csi/external-snapshotter/SECURITY_CONTACTS
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# Defined below are the security contacts for this repo.
|
||||
#
|
||||
# They are the contact point for the Product Security Team to reach out
|
||||
# to for triaging and handling of incoming issues.
|
||||
#
|
||||
# The below names agree to abide by the
|
||||
# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy)
|
||||
# and will be removed and replaced if they violate that agreement.
|
||||
#
|
||||
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
|
||||
# INSTRUCTIONS AT https://kubernetes.io/security/
|
||||
|
||||
saad-ali
|
93
vendor/github.com/kubernetes-csi/external-snapshotter/cmd/csi-snapshotter/create_crd.go
generated
vendored
Normal file
93
vendor/github.com/kubernetes-csi/external-snapshotter/cmd/csi-snapshotter/create_crd.go
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
Copyright 2018 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.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
crdv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
|
||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// CreateCRD creates CustomResourceDefinition
|
||||
func CreateCRD(clientset apiextensionsclient.Interface) error {
|
||||
crd := &apiextensionsv1beta1.CustomResourceDefinition{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: crdv1.VolumeSnapshotClassResourcePlural + "." + crdv1.GroupName,
|
||||
},
|
||||
Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
|
||||
Group: crdv1.GroupName,
|
||||
Version: crdv1.SchemeGroupVersion.Version,
|
||||
Scope: apiextensionsv1beta1.ClusterScoped,
|
||||
Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
|
||||
Plural: crdv1.VolumeSnapshotClassResourcePlural,
|
||||
Kind: reflect.TypeOf(crdv1.VolumeSnapshotClass{}).Name(),
|
||||
},
|
||||
},
|
||||
}
|
||||
res, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd)
|
||||
|
||||
if err != nil && !apierrors.IsAlreadyExists(err) {
|
||||
klog.Fatalf("failed to create VolumeSnapshotResource: %#v, err: %#v",
|
||||
res, err)
|
||||
}
|
||||
|
||||
crd = &apiextensionsv1beta1.CustomResourceDefinition{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: crdv1.VolumeSnapshotContentResourcePlural + "." + crdv1.GroupName,
|
||||
},
|
||||
Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
|
||||
Group: crdv1.GroupName,
|
||||
Version: crdv1.SchemeGroupVersion.Version,
|
||||
Scope: apiextensionsv1beta1.ClusterScoped,
|
||||
Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
|
||||
Plural: crdv1.VolumeSnapshotContentResourcePlural,
|
||||
Kind: reflect.TypeOf(crdv1.VolumeSnapshotContent{}).Name(),
|
||||
},
|
||||
},
|
||||
}
|
||||
res, err = clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd)
|
||||
|
||||
if err != nil && !apierrors.IsAlreadyExists(err) {
|
||||
klog.Fatalf("failed to create VolumeSnapshotContentResource: %#v, err: %#v",
|
||||
res, err)
|
||||
}
|
||||
|
||||
crd = &apiextensionsv1beta1.CustomResourceDefinition{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: crdv1.VolumeSnapshotResourcePlural + "." + crdv1.GroupName,
|
||||
},
|
||||
Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
|
||||
Group: crdv1.GroupName,
|
||||
Version: crdv1.SchemeGroupVersion.Version,
|
||||
Scope: apiextensionsv1beta1.NamespaceScoped,
|
||||
Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
|
||||
Plural: crdv1.VolumeSnapshotResourcePlural,
|
||||
Kind: reflect.TypeOf(crdv1.VolumeSnapshot{}).Name(),
|
||||
},
|
||||
},
|
||||
}
|
||||
res, err = clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd)
|
||||
|
||||
if err != nil && !apierrors.IsAlreadyExists(err) {
|
||||
klog.Fatalf("failed to create VolumeSnapshotResource: %#v, err: %#v",
|
||||
res, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
241
vendor/github.com/kubernetes-csi/external-snapshotter/cmd/csi-snapshotter/main.go
generated
vendored
Normal file
241
vendor/github.com/kubernetes-csi/external-snapshotter/cmd/csi-snapshotter/main.go
generated
vendored
Normal file
@ -0,0 +1,241 @@
|
||||
/*
|
||||
Copyright 2018 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.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/klog"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/kubernetes-csi/csi-lib-utils/connection"
|
||||
"github.com/kubernetes-csi/csi-lib-utils/leaderelection"
|
||||
csirpc "github.com/kubernetes-csi/csi-lib-utils/rpc"
|
||||
"github.com/kubernetes-csi/external-snapshotter/pkg/controller"
|
||||
"github.com/kubernetes-csi/external-snapshotter/pkg/snapshotter"
|
||||
|
||||
clientset "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned"
|
||||
snapshotscheme "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/scheme"
|
||||
informers "github.com/kubernetes-csi/external-snapshotter/pkg/client/informers/externalversions"
|
||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
coreinformers "k8s.io/client-go/informers"
|
||||
)
|
||||
|
||||
const (
|
||||
// Number of worker threads
|
||||
threads = 10
|
||||
|
||||
// Default timeout of short CSI calls like GetPluginInfo
|
||||
defaultCSITimeout = time.Minute
|
||||
)
|
||||
|
||||
// Command line flags
|
||||
var (
|
||||
snapshotterName = flag.String("snapshotter", "", "This option is deprecated.")
|
||||
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
|
||||
connectionTimeout = flag.Duration("connection-timeout", 0, "The --connection-timeout flag is deprecated")
|
||||
csiAddress = flag.String("csi-address", "/run/csi/socket", "Address of the CSI driver socket.")
|
||||
createSnapshotContentRetryCount = flag.Int("create-snapshotcontent-retrycount", 5, "Number of retries when we create a snapshot content object for a snapshot.")
|
||||
createSnapshotContentInterval = flag.Duration("create-snapshotcontent-interval", 10*time.Second, "Interval between retries when we create a snapshot content object for a snapshot.")
|
||||
resyncPeriod = flag.Duration("resync-period", 60*time.Second, "Resync interval of the controller.")
|
||||
snapshotNamePrefix = flag.String("snapshot-name-prefix", "snapshot", "Prefix to apply to the name of a created snapshot")
|
||||
snapshotNameUUIDLength = flag.Int("snapshot-name-uuid-length", -1, "Length in characters for the generated uuid of a created snapshot. Defaults behavior is to NOT truncate.")
|
||||
showVersion = flag.Bool("version", false, "Show version.")
|
||||
csiTimeout = flag.Duration("timeout", defaultCSITimeout, "The timeout for any RPCs to the CSI driver. Default is 1 minute.")
|
||||
|
||||
leaderElection = flag.Bool("leader-election", false, "Enables leader election.")
|
||||
leaderElectionNamespace = flag.String("leader-election-namespace", "", "The namespace where the leader election resource exists. Defaults to the pod namespace if not set.")
|
||||
)
|
||||
|
||||
var (
|
||||
version = "unknown"
|
||||
leaderElectionLockName = "external-snapshotter-leader-election"
|
||||
)
|
||||
|
||||
func main() {
|
||||
klog.InitFlags(nil)
|
||||
flag.Set("logtostderr", "true")
|
||||
flag.Parse()
|
||||
|
||||
if *showVersion {
|
||||
fmt.Println(os.Args[0], version)
|
||||
os.Exit(0)
|
||||
}
|
||||
klog.Infof("Version: %s", version)
|
||||
|
||||
if *connectionTimeout != 0 {
|
||||
klog.Warning("--connection-timeout is deprecated and will have no effect")
|
||||
}
|
||||
|
||||
if *snapshotterName != "" {
|
||||
klog.Warning("--snapshotter is deprecated and will have no effect")
|
||||
}
|
||||
|
||||
// Create the client config. Use kubeconfig if given, otherwise assume in-cluster.
|
||||
config, err := buildConfig(*kubeconfig)
|
||||
if err != nil {
|
||||
klog.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
kubeClient, err := kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
klog.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
snapClient, err := clientset.NewForConfig(config)
|
||||
if err != nil {
|
||||
klog.Errorf("Error building snapshot clientset: %s", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
factory := informers.NewSharedInformerFactory(snapClient, *resyncPeriod)
|
||||
coreFactory := coreinformers.NewSharedInformerFactory(kubeClient, *resyncPeriod)
|
||||
|
||||
// Create CRD resource
|
||||
aeclientset, err := apiextensionsclient.NewForConfig(config)
|
||||
if err != nil {
|
||||
klog.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// initialize CRD resource if it does not exist
|
||||
err = CreateCRD(aeclientset)
|
||||
if err != nil {
|
||||
klog.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Add Snapshot types to the defualt Kubernetes so events can be logged for them
|
||||
snapshotscheme.AddToScheme(scheme.Scheme)
|
||||
|
||||
// Connect to CSI.
|
||||
csiConn, err := connection.Connect(*csiAddress)
|
||||
if err != nil {
|
||||
klog.Errorf("error connecting to CSI driver: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Pass a context with a timeout
|
||||
ctx, cancel := context.WithTimeout(context.Background(), *csiTimeout)
|
||||
defer cancel()
|
||||
|
||||
// Find driver name
|
||||
*snapshotterName, err = csirpc.GetDriverName(ctx, csiConn)
|
||||
if err != nil {
|
||||
klog.Errorf("error getting CSI driver name: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
klog.V(2).Infof("CSI driver name: %q", *snapshotterName)
|
||||
|
||||
// Check it's ready
|
||||
if err = csirpc.ProbeForever(csiConn, *csiTimeout); err != nil {
|
||||
klog.Errorf("error waiting for CSI driver to be ready: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Find out if the driver supports create/delete snapshot.
|
||||
supportsCreateSnapshot, err := supportsControllerCreateSnapshot(ctx, csiConn)
|
||||
if err != nil {
|
||||
klog.Errorf("error determining if driver supports create/delete snapshot operations: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if !supportsCreateSnapshot {
|
||||
klog.Errorf("CSI driver %s does not support ControllerCreateSnapshot", *snapshotterName)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if len(*snapshotNamePrefix) == 0 {
|
||||
klog.Error("Snapshot name prefix cannot be of length 0")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
klog.V(2).Infof("Start NewCSISnapshotController with snapshotter [%s] kubeconfig [%s] connectionTimeout [%+v] csiAddress [%s] createSnapshotContentRetryCount [%d] createSnapshotContentInterval [%+v] resyncPeriod [%+v] snapshotNamePrefix [%s] snapshotNameUUIDLength [%d]", *snapshotterName, *kubeconfig, *connectionTimeout, *csiAddress, createSnapshotContentRetryCount, *createSnapshotContentInterval, *resyncPeriod, *snapshotNamePrefix, snapshotNameUUIDLength)
|
||||
|
||||
snapShotter := snapshotter.NewSnapshotter(csiConn)
|
||||
ctrl := controller.NewCSISnapshotController(
|
||||
snapClient,
|
||||
kubeClient,
|
||||
*snapshotterName,
|
||||
factory.Snapshot().V1alpha1().VolumeSnapshots(),
|
||||
factory.Snapshot().V1alpha1().VolumeSnapshotContents(),
|
||||
factory.Snapshot().V1alpha1().VolumeSnapshotClasses(),
|
||||
coreFactory.Core().V1().PersistentVolumeClaims(),
|
||||
*createSnapshotContentRetryCount,
|
||||
*createSnapshotContentInterval,
|
||||
snapShotter,
|
||||
*csiTimeout,
|
||||
*resyncPeriod,
|
||||
*snapshotNamePrefix,
|
||||
*snapshotNameUUIDLength,
|
||||
)
|
||||
|
||||
run := func(context.Context) {
|
||||
// run...
|
||||
stopCh := make(chan struct{})
|
||||
factory.Start(stopCh)
|
||||
coreFactory.Start(stopCh)
|
||||
go ctrl.Run(threads, stopCh)
|
||||
|
||||
// ...until SIGINT
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt)
|
||||
<-c
|
||||
close(stopCh)
|
||||
}
|
||||
|
||||
if !*leaderElection {
|
||||
run(context.TODO())
|
||||
} else {
|
||||
le := leaderelection.NewLeaderElection(kubeClient, leaderElectionLockName, run)
|
||||
if *leaderElectionNamespace != "" {
|
||||
le.WithNamespace(*leaderElectionNamespace)
|
||||
}
|
||||
if err := le.Run(); err != nil {
|
||||
klog.Fatalf("failed to initialize leader election: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func buildConfig(kubeconfig string) (*rest.Config, error) {
|
||||
if kubeconfig != "" {
|
||||
return clientcmd.BuildConfigFromFlags("", kubeconfig)
|
||||
}
|
||||
return rest.InClusterConfig()
|
||||
}
|
||||
|
||||
func supportsControllerCreateSnapshot(ctx context.Context, conn *grpc.ClientConn) (bool, error) {
|
||||
capabilities, err := csirpc.GetControllerCapabilities(ctx, conn)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return capabilities[csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT], nil
|
||||
}
|
161
vendor/github.com/kubernetes-csi/external-snapshotter/cmd/csi-snapshotter/main_test.go
generated
vendored
Normal file
161
vendor/github.com/kubernetes-csi/external-snapshotter/cmd/csi-snapshotter/main_test.go
generated
vendored
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/kubernetes-csi/csi-lib-utils/connection"
|
||||
"github.com/kubernetes-csi/csi-test/driver"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func Test_supportsControllerCreateSnapshot(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
output *csi.ControllerGetCapabilitiesResponse
|
||||
injectError bool
|
||||
expectError bool
|
||||
expectResult bool
|
||||
}{
|
||||
{
|
||||
name: "success",
|
||||
output: &csi.ControllerGetCapabilitiesResponse{
|
||||
Capabilities: []*csi.ControllerServiceCapability{
|
||||
{
|
||||
Type: &csi.ControllerServiceCapability_Rpc{
|
||||
Rpc: &csi.ControllerServiceCapability_RPC{
|
||||
Type: csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: &csi.ControllerServiceCapability_Rpc{
|
||||
Rpc: &csi.ControllerServiceCapability_RPC{
|
||||
Type: csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectError: false,
|
||||
expectResult: true,
|
||||
},
|
||||
{
|
||||
name: "gRPC error",
|
||||
output: nil,
|
||||
injectError: true,
|
||||
expectError: true,
|
||||
expectResult: false,
|
||||
},
|
||||
{
|
||||
name: "no create snapshot",
|
||||
output: &csi.ControllerGetCapabilitiesResponse{
|
||||
Capabilities: []*csi.ControllerServiceCapability{
|
||||
{
|
||||
Type: &csi.ControllerServiceCapability_Rpc{
|
||||
Rpc: &csi.ControllerServiceCapability_RPC{
|
||||
Type: csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectError: false,
|
||||
expectResult: false,
|
||||
},
|
||||
{
|
||||
name: "empty capability",
|
||||
output: &csi.ControllerGetCapabilitiesResponse{
|
||||
Capabilities: []*csi.ControllerServiceCapability{
|
||||
{
|
||||
Type: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
expectError: false,
|
||||
expectResult: false,
|
||||
},
|
||||
{
|
||||
name: "no capabilities",
|
||||
output: &csi.ControllerGetCapabilitiesResponse{
|
||||
Capabilities: []*csi.ControllerServiceCapability{},
|
||||
},
|
||||
expectError: false,
|
||||
expectResult: false,
|
||||
},
|
||||
}
|
||||
|
||||
mockController, driver, _, controllerServer, csiConn, err := createMockServer(t)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer mockController.Finish()
|
||||
defer driver.Stop()
|
||||
defer csiConn.Close()
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
in := &csi.ControllerGetCapabilitiesRequest{}
|
||||
|
||||
out := test.output
|
||||
var injectedErr error
|
||||
if test.injectError {
|
||||
injectedErr = fmt.Errorf("mock error")
|
||||
}
|
||||
|
||||
// Setup expectation
|
||||
controllerServer.EXPECT().ControllerGetCapabilities(gomock.Any(), in).Return(out, injectedErr).Times(1)
|
||||
|
||||
ok, err := supportsControllerCreateSnapshot(context.Background(), csiConn)
|
||||
if test.expectError && err == nil {
|
||||
t.Errorf("test %q: Expected error, got none", test.name)
|
||||
}
|
||||
if !test.expectError && err != nil {
|
||||
t.Errorf("test %q: got error: %v", test.name, err)
|
||||
}
|
||||
if err == nil && test.expectResult != ok {
|
||||
t.Errorf("test fail expected result %t but got %t\n", test.expectResult, ok)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func createMockServer(t *testing.T) (*gomock.Controller, *driver.MockCSIDriver, *driver.MockIdentityServer, *driver.MockControllerServer, *grpc.ClientConn, error) {
|
||||
// Start the mock server
|
||||
mockController := gomock.NewController(t)
|
||||
identityServer := driver.NewMockIdentityServer(mockController)
|
||||
controllerServer := driver.NewMockControllerServer(mockController)
|
||||
drv := driver.NewMockCSIDriver(&driver.MockCSIDriverServers{
|
||||
Identity: identityServer,
|
||||
Controller: controllerServer,
|
||||
})
|
||||
drv.Start()
|
||||
|
||||
// Create a client connection to it
|
||||
addr := drv.Address()
|
||||
csiConn, err := connection.Connect(addr)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, nil, err
|
||||
}
|
||||
|
||||
return mockController, drv, identityServer, controllerServer, csiConn, nil
|
||||
}
|
3
vendor/github.com/kubernetes-csi/external-snapshotter/code-of-conduct.md
generated
vendored
Normal file
3
vendor/github.com/kubernetes-csi/external-snapshotter/code-of-conduct.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Kubernetes Community Code of Conduct
|
||||
|
||||
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)
|
2
vendor/github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/README.md
generated
vendored
Normal file
2
vendor/github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/README.md
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
rbac-external-provisioner.yaml was copied from https://github.com/kubernetes-csi/external-provisioner/blob/master/deploy/kubernetes/rbac.yaml
|
||||
and must be refreshed when updating the external-provisioner image in setup-csi-snapshotter.yaml
|
93
vendor/github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/rbac-external-provisioner.yaml
generated
vendored
Normal file
93
vendor/github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/rbac-external-provisioner.yaml
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
# This YAML file contains all RBAC objects that are necessary to run external
|
||||
# CSI provisioner.
|
||||
#
|
||||
# In production, each CSI driver deployment has to be customized:
|
||||
# - to avoid conflicts, use non-default namespace and different names
|
||||
# for non-namespaced entities like the ClusterRole
|
||||
# - decide whether the deployment replicates the external CSI
|
||||
# provisioner, in which case leadership election must be enabled;
|
||||
# this influences the RBAC setup, see below
|
||||
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: csi-provisioner
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: external-provisioner-runner
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch", "create", "delete"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["storageclasses"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["list", "watch", "create", "update", "patch"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshots"]
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshotcontents"]
|
||||
verbs: ["get", "list"]
|
||||
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: csi-provisioner-role
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: csi-provisioner
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: external-provisioner-runner
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
|
||||
---
|
||||
# Provisioner must be able to work with endpoints and leases in current namespace
|
||||
# if (and only if) leadership election is enabled
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
name: external-provisioner-cfg
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["endpoints"]
|
||||
verbs: ["get", "watch", "list", "delete", "update", "create"]
|
||||
- apiGroups: ["coordination.k8s.io"]
|
||||
resources: ["leases"]
|
||||
verbs: ["get", "watch", "list", "delete", "update", "create"]
|
||||
|
||||
---
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: csi-provisioner-role-cfg
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: csi-provisioner
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: external-provisioner-cfg
|
||||
apiGroup: rbac.authorization.k8s.io
|
92
vendor/github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/rbac.yaml
generated
vendored
Normal file
92
vendor/github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/rbac.yaml
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
# Together with the RBAC file for external-provisioner, this YAML file
|
||||
# contains all RBAC objects that are necessary to run external CSI
|
||||
# snapshotter.
|
||||
#
|
||||
# In production, each CSI driver deployment has to be customized:
|
||||
# - to avoid conflicts, use non-default namespace and different names
|
||||
# for non-namespaced entities like the ClusterRole
|
||||
# - optionally rename the non-namespaced ClusterRole if there
|
||||
# are conflicts with other deployments
|
||||
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: csi-snapshotter
|
||||
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
# rename if there are conflicts
|
||||
name: external-snapshotter-runner
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
- apiGroups: ["storage.k8s.io"]
|
||||
resources: ["storageclasses"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["list", "watch", "create", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
verbs: ["get", "list"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshotclasses"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshotcontents"]
|
||||
verbs: ["create", "get", "list", "watch", "update", "delete"]
|
||||
- apiGroups: ["snapshot.storage.k8s.io"]
|
||||
resources: ["volumesnapshots"]
|
||||
verbs: ["get", "list", "watch", "update"]
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["create", "list", "watch", "delete"]
|
||||
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: csi-snapshotter-role
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: csi-snapshotter
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
# change the name also here if the ClusterRole gets renamed
|
||||
name: external-snapshotter-runner
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
|
||||
---
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
namespace: default # TODO: replace with the namespace you want for your sidecar
|
||||
name: external-snapshotter-leaderelection
|
||||
rules:
|
||||
- apiGroups: ["coordination.k8s.io"]
|
||||
resources: ["leases"]
|
||||
verbs: ["get", "watch", "list", "delete", "update", "create"]
|
||||
|
||||
---
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: external-snapshotter-leaderelection
|
||||
namespace: default # TODO: replace with the namespace you want for your sidecar
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: csi-snapshotter
|
||||
namespace: default # TODO: replace with the namespace you want for your sidecar
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: external-snapshotter-leaderelection
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
|
122
vendor/github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/setup-csi-snapshotter.yaml
generated
vendored
Normal file
122
vendor/github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/setup-csi-snapshotter.yaml
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
# This YAML file shows how to deploy the CSI snapshotter together
|
||||
# with the hostpath CSI driver. It depends on the RBAC rules
|
||||
# from rbac.yaml and rbac-external-provisioner.yaml.
|
||||
#
|
||||
# Because external-snapshotter and external-provisioner get
|
||||
# deployed in the same pod, we have to merge the permissions
|
||||
# for the provisioner into the service account. This is not
|
||||
# necessary when deploying separately.
|
||||
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: csi-snapshotter-provisioner-role
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: csi-snapshotter # from rbac.yaml
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: external-provisioner-runner # from rbac-external-provisioner.yaml
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
|
||||
---
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: csi-snapshotter-provisioner-role-cfg
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: csi-snapshotter # from rbac.yaml
|
||||
# replace with non-default namespace name
|
||||
namespace: default
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: external-provisioner-cfg # from rbac-external-provisioner.yaml
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: csi-snapshotter
|
||||
labels:
|
||||
app: csi-snapshotter
|
||||
spec:
|
||||
selector:
|
||||
app: csi-snapshotter
|
||||
ports:
|
||||
- name: dummy
|
||||
port: 12345
|
||||
|
||||
---
|
||||
kind: StatefulSet
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: csi-snapshotter
|
||||
spec:
|
||||
serviceName: "csi-snapshotter"
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: csi-snapshotter
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: csi-snapshotter
|
||||
spec:
|
||||
serviceAccount: csi-snapshotter
|
||||
containers:
|
||||
- name: csi-provisioner
|
||||
image: quay.io/k8scsi/csi-provisioner:v1.0.1
|
||||
args:
|
||||
- "--provisioner=csi-hostpath"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--connection-timeout=15s"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /csi/csi.sock
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: csi-snapshotter
|
||||
image: quay.io/k8scsi/csi-snapshotter:v1.0.1
|
||||
args:
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--connection-timeout=15s"
|
||||
- "--leader-election=false"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /csi/csi.sock
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
- name: hostpath
|
||||
image: quay.io/k8scsi/hostpathplugin:v1.0.1
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
- "--nodeid=$(KUBE_NODE_NAME)"
|
||||
env:
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix:///csi/csi.sock
|
||||
- name: KUBE_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: spec.nodeName
|
||||
imagePullPolicy: Always
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /csi
|
||||
volumes:
|
||||
- name: socket-dir
|
||||
emptyDir:
|
11
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/pvc.yaml
generated
vendored
Normal file
11
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/pvc.yaml
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hpvc
|
||||
spec:
|
||||
storageClassName: csi-hostpath-sc
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
15
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/restore.yaml
generated
vendored
Normal file
15
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/restore.yaml
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hpvc-restore
|
||||
spec:
|
||||
storageClassName: csi-hostpath-sc
|
||||
dataSource:
|
||||
name: new-snapshot-demo
|
||||
kind: VolumeSnapshot
|
||||
apiGroup: snapshot.storage.k8s.io
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
9
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/snapshot.yaml
generated
vendored
Normal file
9
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/snapshot.yaml
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
apiVersion: snapshot.storage.k8s.io/v1alpha1
|
||||
kind: VolumeSnapshot
|
||||
metadata:
|
||||
name: new-snapshot-demo
|
||||
spec:
|
||||
snapshotClassName: csi-hostpath-snapclass
|
||||
source:
|
||||
name: hpvc
|
||||
kind: PersistentVolumeClaim
|
5
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/snapshotclass.yaml
generated
vendored
Normal file
5
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/snapshotclass.yaml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: snapshot.storage.k8s.io/v1alpha1
|
||||
kind: VolumeSnapshotClass
|
||||
metadata:
|
||||
name: csi-hostpath-snapclass
|
||||
snapshotter: csi-hostpath
|
7
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/storageclass.yaml
generated
vendored
Normal file
7
vendor/github.com/kubernetes-csi/external-snapshotter/examples/kubernetes/storageclass.yaml
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: csi-hostpath-sc
|
||||
provisioner: csi-hostpath
|
||||
reclaimPolicy: Delete
|
||||
volumeBindingMode: Immediate
|
15
vendor/github.com/kubernetes-csi/external-snapshotter/hack/boilerplate.go.txt
generated
vendored
Normal file
15
vendor/github.com/kubernetes-csi/external-snapshotter/hack/boilerplate.go.txt
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Copyright YEAR 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.
|
||||
*/
|
36
vendor/github.com/kubernetes-csi/external-snapshotter/hack/update-generated-code.sh
generated
vendored
Executable file
36
vendor/github.com/kubernetes-csi/external-snapshotter/hack/update-generated-code.sh
generated
vendored
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 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
|
||||
|
||||
SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
|
||||
#cd $ROOT
|
||||
#SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
|
||||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
|
||||
|
||||
# generate the code with:
|
||||
# --output-base because this script should also be able to run inside the vendor dir of
|
||||
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
|
||||
# instead of the $GOPATH directly. For normal projects this can be dropped.
|
||||
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
|
||||
github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis \
|
||||
volumesnapshot:v1alpha1 \
|
||||
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
|
||||
|
||||
# To use your own boilerplate text use:
|
||||
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
|
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1/doc.go
generated
vendored
Normal file
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2018 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.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +groupName=snapshot.storage.k8s.io
|
||||
|
||||
package v1alpha1
|
58
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1/register.go
generated
vendored
Normal file
58
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1/register.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2018 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package.
|
||||
const GroupName = "snapshot.storage.k8s.io"
|
||||
|
||||
var (
|
||||
// SchemeBuilder is the new scheme builder
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
// AddToScheme adds to scheme
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
// SchemeGroupVersion is the group version used to register these objects.
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
)
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
func init() {
|
||||
// We only register manually written functions here. The registration of the
|
||||
// generated functions takes place in the generated files. The separation
|
||||
// makes the code compile even when the generated files are missing.
|
||||
SchemeBuilder.Register(addKnownTypes)
|
||||
}
|
||||
|
||||
// addKnownTypes adds the set of types defined in this package to the supplied scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&VolumeSnapshotClass{},
|
||||
&VolumeSnapshotClassList{},
|
||||
&VolumeSnapshot{},
|
||||
&VolumeSnapshotList{},
|
||||
&VolumeSnapshotContent{},
|
||||
&VolumeSnapshotContentList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
256
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1/types.go
generated
vendored
Normal file
256
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1/types.go
generated
vendored
Normal file
@ -0,0 +1,256 @@
|
||||
/*
|
||||
Copyright 2018 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
core_v1 "k8s.io/api/core/v1"
|
||||
storage "k8s.io/api/storage/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
// VolumeSnapshotContentResourcePlural is "volumesnapshotcontents"
|
||||
VolumeSnapshotContentResourcePlural = "volumesnapshotcontents"
|
||||
// VolumeSnapshotResourcePlural is "volumesnapshots"
|
||||
VolumeSnapshotResourcePlural = "volumesnapshots"
|
||||
// VolumeSnapshotClassResourcePlural is "volumesnapshotclasses"
|
||||
VolumeSnapshotClassResourcePlural = "volumesnapshotclasses"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshot is a user's request for taking a snapshot. Upon successful creation of the actual
|
||||
// snapshot by the volume provider it is bound to the corresponding VolumeSnapshotContent.
|
||||
// Only the VolumeSnapshot object is accessible to the user in the namespace.
|
||||
type VolumeSnapshot struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec defines the desired characteristics of a snapshot requested by a user.
|
||||
Spec VolumeSnapshotSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Status represents the latest observed state of the snapshot
|
||||
// +optional
|
||||
Status VolumeSnapshotStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshotList is a list of VolumeSnapshot objects
|
||||
type VolumeSnapshotList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is the list of VolumeSnapshots
|
||||
Items []VolumeSnapshot `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotSpec describes the common attributes of a volume snapshot
|
||||
type VolumeSnapshotSpec struct {
|
||||
// Source has the information about where the snapshot is created from.
|
||||
// In Alpha version, only PersistentVolumeClaim is supported as the source.
|
||||
// If not specified, user can create VolumeSnapshotContent and bind it with VolumeSnapshot manually.
|
||||
// +optional
|
||||
Source *core_v1.TypedLocalObjectReference `json:"source" protobuf:"bytes,1,opt,name=source"`
|
||||
|
||||
// SnapshotContentName binds the VolumeSnapshot object with the VolumeSnapshotContent
|
||||
// +optional
|
||||
SnapshotContentName string `json:"snapshotContentName" protobuf:"bytes,2,opt,name=snapshotContentName"`
|
||||
|
||||
// Name of the VolumeSnapshotClass used by the VolumeSnapshot. If not specified, a default snapshot class will
|
||||
// be used if it is available.
|
||||
// +optional
|
||||
VolumeSnapshotClassName *string `json:"snapshotClassName" protobuf:"bytes,3,opt,name=snapshotClassName"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotStatus is the status of the VolumeSnapshot
|
||||
type VolumeSnapshotStatus struct {
|
||||
// CreationTime is the time the snapshot was successfully created. If it is set,
|
||||
// it means the snapshot was created; Otherwise the snapshot was not created.
|
||||
// +optional
|
||||
CreationTime *metav1.Time `json:"creationTime" protobuf:"bytes,1,opt,name=creationTime"`
|
||||
|
||||
// When restoring volume from the snapshot, the volume size should be equal to or
|
||||
// larger than the RestoreSize if it is specified. If RestoreSize is set to nil, it means
|
||||
// that the storage plugin does not have this information available.
|
||||
// +optional
|
||||
RestoreSize *resource.Quantity `json:"restoreSize" protobuf:"bytes,2,opt,name=restoreSize"`
|
||||
|
||||
// ReadyToUse is set to true only if the snapshot is ready to use (e.g., finish uploading if
|
||||
// there is an uploading phase) and also VolumeSnapshot and its VolumeSnapshotContent
|
||||
// bind correctly with each other. If any of the above condition is not true, ReadyToUse is
|
||||
// set to false
|
||||
// +optional
|
||||
ReadyToUse bool `json:"readyToUse" protobuf:"varint,3,opt,name=readyToUse"`
|
||||
|
||||
// The last error encountered during create snapshot operation, if any.
|
||||
// This field must only be set by the entity completing the create snapshot
|
||||
// operation, i.e. the external-snapshotter.
|
||||
// +optional
|
||||
Error *storage.VolumeError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeError"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshotClass describes the parameters used by storage system when
|
||||
// provisioning VolumeSnapshots from PVCs.
|
||||
// The name of a VolumeSnapshotClass object is significant, and is how users can request a particular class.
|
||||
type VolumeSnapshotClass struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Snapshotter is the driver expected to handle this VolumeSnapshotClass.
|
||||
Snapshotter string `json:"snapshotter" protobuf:"bytes,2,opt,name=snapshotter"`
|
||||
|
||||
// Parameters holds parameters for the snapshotter.
|
||||
// These values are opaque to the system and are passed directly
|
||||
// to the snapshotter.
|
||||
// +optional
|
||||
Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
|
||||
|
||||
// Optional: what happens to a snapshot content when released from its snapshot.
|
||||
// The default policy is Delete if not specified.
|
||||
// +optional
|
||||
DeletionPolicy *DeletionPolicy `json:"deletionPolicy,omitempty" protobuf:"bytes,4,opt,name=deletionPolicy"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshotClassList is a collection of snapshot classes.
|
||||
type VolumeSnapshotClassList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is the list of VolumeSnapshotClasses
|
||||
Items []VolumeSnapshotClass `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshotContent represents the actual "on-disk" snapshot object
|
||||
type VolumeSnapshotContent struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec represents the desired state of the snapshot content
|
||||
Spec VolumeSnapshotContentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshotContentList is a list of VolumeSnapshotContent objects
|
||||
type VolumeSnapshotContentList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is the list of VolumeSnapshotContents
|
||||
Items []VolumeSnapshotContent `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotContentSpec is the spec of the volume snapshot content
|
||||
type VolumeSnapshotContentSpec struct {
|
||||
// Source represents the location and type of the volume snapshot
|
||||
VolumeSnapshotSource `json:",inline" protobuf:"bytes,1,opt,name=volumeSnapshotSource"`
|
||||
|
||||
// VolumeSnapshotRef is part of bi-directional binding between VolumeSnapshot
|
||||
// and VolumeSnapshotContent. It becomes non-nil when bound.
|
||||
// +optional
|
||||
VolumeSnapshotRef *core_v1.ObjectReference `json:"volumeSnapshotRef" protobuf:"bytes,2,opt,name=volumeSnapshotRef"`
|
||||
|
||||
// PersistentVolumeRef represents the PersistentVolume that the snapshot has been
|
||||
// taken from. It becomes non-nil when VolumeSnapshot and VolumeSnapshotContent are bound.
|
||||
// +optional
|
||||
PersistentVolumeRef *core_v1.ObjectReference `json:"persistentVolumeRef" protobuf:"bytes,3,opt,name=persistentVolumeRef"`
|
||||
|
||||
// Name of the VolumeSnapshotClass used by the VolumeSnapshot. If not specified, a default snapshot class will
|
||||
// be used if it is available.
|
||||
// +optional
|
||||
VolumeSnapshotClassName *string `json:"snapshotClassName" protobuf:"bytes,4,opt,name=snapshotClassName"`
|
||||
|
||||
// Optional: what happens to a snapshot content when released from its snapshot. It will be set to Delete by default
|
||||
// if not specified
|
||||
// +optional
|
||||
DeletionPolicy *DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,5,opt,name=deletionPolicy"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotSource represents the actual location and type of the snapshot. Only one of its members may be specified.
|
||||
type VolumeSnapshotSource struct {
|
||||
// CSI (Container Storage Interface) represents storage that handled by an external CSI Volume Driver (Alpha feature).
|
||||
// +optional
|
||||
CSI *CSIVolumeSnapshotSource `json:"csiVolumeSnapshotSource,omitempty"`
|
||||
}
|
||||
|
||||
// CSIVolumeSnapshotSource represents the source from CSI volume snapshot
|
||||
type CSIVolumeSnapshotSource struct {
|
||||
// Driver is the name of the driver to use for this snapshot.
|
||||
// This MUST be the same name returned by the CSI GetPluginName() call for
|
||||
// that driver.
|
||||
// Required.
|
||||
Driver string `json:"driver" protobuf:"bytes,1,opt,name=driver"`
|
||||
|
||||
// SnapshotHandle is the unique snapshot id returned by the CSI volume
|
||||
// plugin’s CreateSnapshot to refer to the snapshot on all subsequent calls.
|
||||
// Required.
|
||||
SnapshotHandle string `json:"snapshotHandle" protobuf:"bytes,2,opt,name=snapshotHandle"`
|
||||
|
||||
// Timestamp when the point-in-time snapshot is taken on the storage
|
||||
// system. This timestamp will be generated by the CSI volume driver after
|
||||
// the snapshot is cut. The format of this field should be a Unix nanoseconds
|
||||
// time encoded as an int64. On Unix, the command `date +%s%N` returns
|
||||
// the current time in nanoseconds since 1970-01-01 00:00:00 UTC.
|
||||
// This field is required in the CSI spec but optional here to support static binding.
|
||||
// +optional
|
||||
CreationTime *int64 `json:"creationTime,omitempty" protobuf:"varint,3,opt,name=creationTime"`
|
||||
|
||||
// When restoring volume from the snapshot, the volume size should be equal to or
|
||||
// larger than the RestoreSize if it is specified. If RestoreSize is set to nil, it means
|
||||
// that the storage plugin does not have this information available.
|
||||
// +optional
|
||||
RestoreSize *int64 `json:"restoreSize,omitempty" protobuf:"bytes,4,opt,name=restoreSize"`
|
||||
}
|
||||
|
||||
// DeletionPolicy describes a policy for end-of-life maintenance of volume snapshot contents
|
||||
type DeletionPolicy string
|
||||
|
||||
const (
|
||||
// VolumeSnapshotContentDelete means the snapshot content will be deleted from Kubernetes on release from its volume snapshot.
|
||||
VolumeSnapshotContentDelete DeletionPolicy = "Delete"
|
||||
|
||||
// VolumeSnapshotContentRetain means the snapshot will be left in its current state on release from its volume snapshot.
|
||||
// The default policy is Retain if not specified.
|
||||
VolumeSnapshotContentRetain DeletionPolicy = "Retain"
|
||||
)
|
359
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
359
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1/zz_generated.deepcopy.go
generated
vendored
Normal file
@ -0,0 +1,359 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
v1beta1 "k8s.io/api/storage/v1beta1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CSIVolumeSnapshotSource) DeepCopyInto(out *CSIVolumeSnapshotSource) {
|
||||
*out = *in
|
||||
if in.CreationTime != nil {
|
||||
in, out := &in.CreationTime, &out.CreationTime
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.RestoreSize != nil {
|
||||
in, out := &in.RestoreSize, &out.RestoreSize
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSIVolumeSnapshotSource.
|
||||
func (in *CSIVolumeSnapshotSource) DeepCopy() *CSIVolumeSnapshotSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CSIVolumeSnapshotSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshot) DeepCopyInto(out *VolumeSnapshot) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshot.
|
||||
func (in *VolumeSnapshot) DeepCopy() *VolumeSnapshot {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshot)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *VolumeSnapshot) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotClass) DeepCopyInto(out *VolumeSnapshotClass) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Parameters != nil {
|
||||
in, out := &in.Parameters, &out.Parameters
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.DeletionPolicy != nil {
|
||||
in, out := &in.DeletionPolicy, &out.DeletionPolicy
|
||||
*out = new(DeletionPolicy)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotClass.
|
||||
func (in *VolumeSnapshotClass) DeepCopy() *VolumeSnapshotClass {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotClass)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *VolumeSnapshotClass) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotClassList) DeepCopyInto(out *VolumeSnapshotClassList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]VolumeSnapshotClass, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotClassList.
|
||||
func (in *VolumeSnapshotClassList) DeepCopy() *VolumeSnapshotClassList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotClassList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *VolumeSnapshotClassList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotContent) DeepCopyInto(out *VolumeSnapshotContent) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContent.
|
||||
func (in *VolumeSnapshotContent) DeepCopy() *VolumeSnapshotContent {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotContent)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *VolumeSnapshotContent) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotContentList) DeepCopyInto(out *VolumeSnapshotContentList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]VolumeSnapshotContent, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentList.
|
||||
func (in *VolumeSnapshotContentList) DeepCopy() *VolumeSnapshotContentList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotContentList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *VolumeSnapshotContentList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotContentSpec) DeepCopyInto(out *VolumeSnapshotContentSpec) {
|
||||
*out = *in
|
||||
in.VolumeSnapshotSource.DeepCopyInto(&out.VolumeSnapshotSource)
|
||||
if in.VolumeSnapshotRef != nil {
|
||||
in, out := &in.VolumeSnapshotRef, &out.VolumeSnapshotRef
|
||||
*out = new(v1.ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.PersistentVolumeRef != nil {
|
||||
in, out := &in.PersistentVolumeRef, &out.PersistentVolumeRef
|
||||
*out = new(v1.ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.VolumeSnapshotClassName != nil {
|
||||
in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.DeletionPolicy != nil {
|
||||
in, out := &in.DeletionPolicy, &out.DeletionPolicy
|
||||
*out = new(DeletionPolicy)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentSpec.
|
||||
func (in *VolumeSnapshotContentSpec) DeepCopy() *VolumeSnapshotContentSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotContentSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotList) DeepCopyInto(out *VolumeSnapshotList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]VolumeSnapshot, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotList.
|
||||
func (in *VolumeSnapshotList) DeepCopy() *VolumeSnapshotList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *VolumeSnapshotList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotSource) DeepCopyInto(out *VolumeSnapshotSource) {
|
||||
*out = *in
|
||||
if in.CSI != nil {
|
||||
in, out := &in.CSI, &out.CSI
|
||||
*out = new(CSIVolumeSnapshotSource)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotSource.
|
||||
func (in *VolumeSnapshotSource) DeepCopy() *VolumeSnapshotSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotSpec) DeepCopyInto(out *VolumeSnapshotSpec) {
|
||||
*out = *in
|
||||
if in.Source != nil {
|
||||
in, out := &in.Source, &out.Source
|
||||
*out = new(v1.TypedLocalObjectReference)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.VolumeSnapshotClassName != nil {
|
||||
in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotSpec.
|
||||
func (in *VolumeSnapshotSpec) DeepCopy() *VolumeSnapshotSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotStatus) DeepCopyInto(out *VolumeSnapshotStatus) {
|
||||
*out = *in
|
||||
if in.CreationTime != nil {
|
||||
in, out := &in.CreationTime, &out.CreationTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.RestoreSize != nil {
|
||||
in, out := &in.RestoreSize, &out.RestoreSize
|
||||
x := (*in).DeepCopy()
|
||||
*out = &x
|
||||
}
|
||||
if in.Error != nil {
|
||||
in, out := &in.Error, &out.Error
|
||||
*out = new(v1beta1.VolumeError)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotStatus.
|
||||
func (in *VolumeSnapshotStatus) DeepCopy() *VolumeSnapshotStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
90
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/clientset.go
generated
vendored
Normal file
90
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/clientset.go
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package versioned
|
||||
|
||||
import (
|
||||
snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
// version included in a Clientset.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
snapshotV1alpha1 *snapshotv1alpha1.SnapshotV1alpha1Client
|
||||
}
|
||||
|
||||
// SnapshotV1alpha1 retrieves the SnapshotV1alpha1Client
|
||||
func (c *Clientset) SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface {
|
||||
return c.snapshotV1alpha1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.DiscoveryClient
|
||||
}
|
||||
|
||||
// NewForConfig creates a new Clientset for the given config.
|
||||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
configShallowCopy := *c
|
||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||
}
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.snapshotV1alpha1, err = snapshotv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &cs, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new Clientset for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
var cs Clientset
|
||||
cs.snapshotV1alpha1 = snapshotv1alpha1.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
}
|
||||
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.snapshotV1alpha1 = snapshotv1alpha1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
}
|
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/doc.go
generated
vendored
Normal file
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated clientset.
|
||||
package versioned
|
77
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/fake/clientset_generated.go
generated
vendored
Normal file
77
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/fake/clientset_generated.go
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
clientset "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned"
|
||||
snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1"
|
||||
fakesnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/fake"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||
"k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
cs := &Clientset{}
|
||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, watch, nil
|
||||
})
|
||||
|
||||
return cs
|
||||
}
|
||||
|
||||
// Clientset implements clientset.Interface. Meant to be embedded into a
|
||||
// struct to get a default implementation. This makes faking out just the method
|
||||
// you want to test easier.
|
||||
type Clientset struct {
|
||||
testing.Fake
|
||||
discovery *fakediscovery.FakeDiscovery
|
||||
}
|
||||
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
return c.discovery
|
||||
}
|
||||
|
||||
var _ clientset.Interface = &Clientset{}
|
||||
|
||||
// SnapshotV1alpha1 retrieves the SnapshotV1alpha1Client
|
||||
func (c *Clientset) SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface {
|
||||
return &fakesnapshotv1alpha1.FakeSnapshotV1alpha1{Fake: &c.Fake}
|
||||
}
|
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/fake/doc.go
generated
vendored
Normal file
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/fake/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated fake clientset.
|
||||
package fake
|
56
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/fake/register.go
generated
vendored
Normal file
56
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/fake/register.go
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
snapshotv1alpha1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
// of clientsets, like in:
|
||||
//
|
||||
// import (
|
||||
// "k8s.io/client-go/kubernetes"
|
||||
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
||||
// )
|
||||
//
|
||||
// kclientset, _ := kubernetes.NewForConfig(c)
|
||||
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
||||
//
|
||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||
// correctly.
|
||||
var AddToScheme = localSchemeBuilder.AddToScheme
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
|
||||
utilruntime.Must(AddToScheme(scheme))
|
||||
}
|
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/scheme/doc.go
generated
vendored
Normal file
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/scheme/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package contains the scheme of the automatically generated clientset.
|
||||
package scheme
|
56
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/scheme/register.go
generated
vendored
Normal file
56
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/scheme/register.go
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package scheme
|
||||
|
||||
import (
|
||||
snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
snapshotv1alpha1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
// of clientsets, like in:
|
||||
//
|
||||
// import (
|
||||
// "k8s.io/client-go/kubernetes"
|
||||
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
||||
// )
|
||||
//
|
||||
// kclientset, _ := kubernetes.NewForConfig(c)
|
||||
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
||||
//
|
||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||
// correctly.
|
||||
var AddToScheme = localSchemeBuilder.AddToScheme
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
|
||||
utilruntime.Must(AddToScheme(Scheme))
|
||||
}
|
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/doc.go
generated
vendored
Normal file
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1alpha1
|
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/fake/doc.go
generated
vendored
Normal file
20
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/fake/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
@ -0,0 +1,140 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshots implements VolumeSnapshotInterface
|
||||
type FakeVolumeSnapshots struct {
|
||||
Fake *FakeSnapshotV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var volumesnapshotsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumesnapshots"}
|
||||
|
||||
var volumesnapshotsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeSnapshot"}
|
||||
|
||||
// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshots) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(volumesnapshotsResource, c.ns, name), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors.
|
||||
func (c *FakeVolumeSnapshots) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(volumesnapshotsResource, volumesnapshotsKind, c.ns, opts), &v1alpha1.VolumeSnapshotList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.VolumeSnapshotList{ListMeta: obj.(*v1alpha1.VolumeSnapshotList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.VolumeSnapshotList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshots.
|
||||
func (c *FakeVolumeSnapshots) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(volumesnapshotsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshots) Create(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshots) Update(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeVolumeSnapshots) UpdateStatus(volumeSnapshot *v1alpha1.VolumeSnapshot) (*v1alpha1.VolumeSnapshot, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(volumesnapshotsResource, "status", c.ns, volumeSnapshot), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshots) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(volumesnapshotsResource, c.ns, name), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshots) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(volumesnapshotsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.VolumeSnapshotList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshot.
|
||||
func (c *FakeVolumeSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(volumesnapshotsResource, c.ns, name, pt, data, subresources...), &v1alpha1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshot), err
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeSnapshotV1alpha1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1alpha1) VolumeSnapshots(namespace string) v1alpha1.VolumeSnapshotInterface {
|
||||
return &FakeVolumeSnapshots{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1alpha1) VolumeSnapshotClasses() v1alpha1.VolumeSnapshotClassInterface {
|
||||
return &FakeVolumeSnapshotClasses{c}
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1alpha1) VolumeSnapshotContents() v1alpha1.VolumeSnapshotContentInterface {
|
||||
return &FakeVolumeSnapshotContents{c}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeSnapshotV1alpha1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshotClasses implements VolumeSnapshotClassInterface
|
||||
type FakeVolumeSnapshotClasses struct {
|
||||
Fake *FakeSnapshotV1alpha1
|
||||
}
|
||||
|
||||
var volumesnapshotclassesResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumesnapshotclasses"}
|
||||
|
||||
var volumesnapshotclassesKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeSnapshotClass"}
|
||||
|
||||
// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(volumesnapshotclassesResource, name), &v1alpha1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors.
|
||||
func (c *FakeVolumeSnapshotClasses) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotClassList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(volumesnapshotclassesResource, volumesnapshotclassesKind, opts), &v1alpha1.VolumeSnapshotClassList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.VolumeSnapshotClassList{ListMeta: obj.(*v1alpha1.VolumeSnapshotClassList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.VolumeSnapshotClassList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses.
|
||||
func (c *FakeVolumeSnapshotClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(volumesnapshotclassesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Create(volumeSnapshotClass *v1alpha1.VolumeSnapshotClass) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(volumesnapshotclassesResource, volumeSnapshotClass), &v1alpha1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Update(volumeSnapshotClass *v1alpha1.VolumeSnapshotClass) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(volumesnapshotclassesResource, volumeSnapshotClass), &v1alpha1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshotClasses) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(volumesnapshotclassesResource, name), &v1alpha1.VolumeSnapshotClass{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshotClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(volumesnapshotclassesResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.VolumeSnapshotClassList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotClass.
|
||||
func (c *FakeVolumeSnapshotClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotclassesResource, name, pt, data, subresources...), &v1alpha1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotClass), err
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshotContents implements VolumeSnapshotContentInterface
|
||||
type FakeVolumeSnapshotContents struct {
|
||||
Fake *FakeSnapshotV1alpha1
|
||||
}
|
||||
|
||||
var volumesnapshotcontentsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumesnapshotcontents"}
|
||||
|
||||
var volumesnapshotcontentsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeSnapshotContent"}
|
||||
|
||||
// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(volumesnapshotcontentsResource, name), &v1alpha1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors.
|
||||
func (c *FakeVolumeSnapshotContents) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotContentList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(volumesnapshotcontentsResource, volumesnapshotcontentsKind, opts), &v1alpha1.VolumeSnapshotContentList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.VolumeSnapshotContentList{ListMeta: obj.(*v1alpha1.VolumeSnapshotContentList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.VolumeSnapshotContentList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotContents.
|
||||
func (c *FakeVolumeSnapshotContents) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(volumesnapshotcontentsResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Create(volumeSnapshotContent *v1alpha1.VolumeSnapshotContent) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &v1alpha1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Update(volumeSnapshotContent *v1alpha1.VolumeSnapshotContent) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &v1alpha1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshotContents) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(volumesnapshotcontentsResource, name), &v1alpha1.VolumeSnapshotContent{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshotContents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(volumesnapshotcontentsResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.VolumeSnapshotContentList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotContent.
|
||||
func (c *FakeVolumeSnapshotContents) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotcontentsResource, name, pt, data, subresources...), &v1alpha1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.VolumeSnapshotContent), err
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
type VolumeSnapshotExpansion interface{}
|
||||
|
||||
type VolumeSnapshotClassExpansion interface{}
|
||||
|
||||
type VolumeSnapshotContentExpansion interface{}
|
191
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/volumesnapshot.go
generated
vendored
Normal file
191
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/volumesnapshot.go
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
scheme "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// VolumeSnapshotsGetter has a method to return a VolumeSnapshotInterface.
|
||||
// A group's client should implement this interface.
|
||||
type VolumeSnapshotsGetter interface {
|
||||
VolumeSnapshots(namespace string) VolumeSnapshotInterface
|
||||
}
|
||||
|
||||
// VolumeSnapshotInterface has methods to work with VolumeSnapshot resources.
|
||||
type VolumeSnapshotInterface interface {
|
||||
Create(*v1alpha1.VolumeSnapshot) (*v1alpha1.VolumeSnapshot, error)
|
||||
Update(*v1alpha1.VolumeSnapshot) (*v1alpha1.VolumeSnapshot, error)
|
||||
UpdateStatus(*v1alpha1.VolumeSnapshot) (*v1alpha1.VolumeSnapshot, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.VolumeSnapshot, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.VolumeSnapshotList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshot, err error)
|
||||
VolumeSnapshotExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshots implements VolumeSnapshotInterface
|
||||
type volumeSnapshots struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newVolumeSnapshots returns a VolumeSnapshots
|
||||
func newVolumeSnapshots(c *SnapshotV1alpha1Client, namespace string) *volumeSnapshots {
|
||||
return &volumeSnapshots{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any.
|
||||
func (c *volumeSnapshots) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors.
|
||||
func (c *volumeSnapshots) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.VolumeSnapshotList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshots.
|
||||
func (c *volumeSnapshots) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
||||
func (c *volumeSnapshots) Create(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Body(volumeSnapshot).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
||||
func (c *volumeSnapshots) Update(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(volumeSnapshot.Name).
|
||||
Body(volumeSnapshot).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *volumeSnapshots) UpdateStatus(volumeSnapshot *v1alpha1.VolumeSnapshot) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(volumeSnapshot.Name).
|
||||
SubResource("status").
|
||||
Body(volumeSnapshot).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshots) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshots) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOptions.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshot.
|
||||
func (c *volumeSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshot, err error) {
|
||||
result = &v1alpha1.VolumeSnapshot{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
100
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/volumesnapshot_client.go
generated
vendored
Normal file
100
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/volumesnapshot_client.go
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
"github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/scheme"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type SnapshotV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
VolumeSnapshotsGetter
|
||||
VolumeSnapshotClassesGetter
|
||||
VolumeSnapshotContentsGetter
|
||||
}
|
||||
|
||||
// SnapshotV1alpha1Client is used to interact with features provided by the snapshot.storage.k8s.io group.
|
||||
type SnapshotV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *SnapshotV1alpha1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface {
|
||||
return newVolumeSnapshots(c, namespace)
|
||||
}
|
||||
|
||||
func (c *SnapshotV1alpha1Client) VolumeSnapshotClasses() VolumeSnapshotClassInterface {
|
||||
return newVolumeSnapshotClasses(c)
|
||||
}
|
||||
|
||||
func (c *SnapshotV1alpha1Client) VolumeSnapshotContents() VolumeSnapshotContentInterface {
|
||||
return newVolumeSnapshotContents(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new SnapshotV1alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*SnapshotV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SnapshotV1alpha1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new SnapshotV1alpha1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *SnapshotV1alpha1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new SnapshotV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *SnapshotV1alpha1Client {
|
||||
return &SnapshotV1alpha1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1alpha1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *SnapshotV1alpha1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
164
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/volumesnapshotclass.go
generated
vendored
Normal file
164
vendor/github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/typed/volumesnapshot/v1alpha1/volumesnapshotclass.go
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
v1alpha1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
|
||||
scheme "github.com/kubernetes-csi/external-snapshotter/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// VolumeSnapshotClassesGetter has a method to return a VolumeSnapshotClassInterface.
|
||||
// A group's client should implement this interface.
|
||||
type VolumeSnapshotClassesGetter interface {
|
||||
VolumeSnapshotClasses() VolumeSnapshotClassInterface
|
||||
}
|
||||
|
||||
// VolumeSnapshotClassInterface has methods to work with VolumeSnapshotClass resources.
|
||||
type VolumeSnapshotClassInterface interface {
|
||||
Create(*v1alpha1.VolumeSnapshotClass) (*v1alpha1.VolumeSnapshotClass, error)
|
||||
Update(*v1alpha1.VolumeSnapshotClass) (*v1alpha1.VolumeSnapshotClass, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.VolumeSnapshotClass, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.VolumeSnapshotClassList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotClass, err error)
|
||||
VolumeSnapshotClassExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotClasses implements VolumeSnapshotClassInterface
|
||||
type volumeSnapshotClasses struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newVolumeSnapshotClasses returns a VolumeSnapshotClasses
|
||||
func newVolumeSnapshotClasses(c *SnapshotV1alpha1Client) *volumeSnapshotClasses {
|
||||
return &volumeSnapshotClasses{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any.
|
||||
func (c *volumeSnapshotClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotClass{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors.
|
||||
func (c *volumeSnapshotClasses) List(opts v1.ListOptions) (result *v1alpha1.VolumeSnapshotClassList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.VolumeSnapshotClassList{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses.
|
||||
func (c *volumeSnapshotClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *volumeSnapshotClasses) Create(volumeSnapshotClass *v1alpha1.VolumeSnapshotClass) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotClass{}
|
||||
err = c.client.Post().
|
||||
Resource("volumesnapshotclasses").
|
||||
Body(volumeSnapshotClass).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *volumeSnapshotClasses) Update(volumeSnapshotClass *v1alpha1.VolumeSnapshotClass) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotClass{}
|
||||
err = c.client.Put().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(volumeSnapshotClass.Name).
|
||||
Body(volumeSnapshotClass).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshotClasses) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshotClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOptions.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotClass.
|
||||
func (c *volumeSnapshotClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VolumeSnapshotClass, err error) {
|
||||
result = &v1alpha1.VolumeSnapshotClass{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("volumesnapshotclasses").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user