Skip to content

Commit

Permalink
Switch to volumesnapshot v1 in client
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Kalenyuk <[email protected]>
  • Loading branch information
akalenyu committed Apr 12, 2022
1 parent 3d4675e commit 7c7a8b4
Show file tree
Hide file tree
Showing 35 changed files with 224 additions and 1,356 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kubernetes-csi/external-snapshotter/v2 v2.1.1 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,6 @@ github.com/kubernetes-csi/csi-lib-utils v0.7.0/go.mod h1:bze+2G9+cmoHxN6+WyG1qT4
github.com/kubernetes-csi/csi-test v2.0.0+incompatible/go.mod h1:YxJ4UiuPWIhMBkxUKY5c267DyA0uDZ/MtAimhx/2TA0=
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 h1:nHHjmvjitIiyPlUHk/ofpgvBcNcawJLtf4PYHORLjAA=
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0/go.mod h1:YBCo4DoEeDndqvAn6eeu0vWM7QdXmHEeI9cFWplmBys=
github.com/kubernetes-csi/external-snapshotter/v2 v2.1.1 h1:t5bmB3Y8nCaLA4aFrIpX0zjHEF/HUkJp6f5rm7BsVzM=
github.com/kubernetes-csi/external-snapshotter/v2 v2.1.1/go.mod h1:dV5oB3U62KBdlf9ADWkMmjGd3USauqQtwIm2OZb5mqI=
github.com/kylelemons/godebug v0.0.0-20160406211939-eadb3ce320cb/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
Expand Down
4 changes: 2 additions & 2 deletions hack/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ client-gen --clientset-name versioned \
--go-header-file ${KUBEVIRT_DIR}/hack/boilerplate/boilerplate.go.txt

client-gen --clientset-name versioned \
--input-base github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis \
--input volumesnapshot/v1beta1 \
--input-base github.com/kubernetes-csi/external-snapshotter/client/v4/apis \
--input volumesnapshot/v1 \
--output-base ${KUBEVIRT_DIR}/staging/src \
--output-package ${CLIENT_GEN_BASE}/external-snapshotter/clientset \
--go-header-file ${KUBEVIRT_DIR}/hack/boilerplate/boilerplate.go.txt
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/virtinformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1078,14 +1078,14 @@ func (f *kubeInformerFactory) Pod() cache.SharedIndexInformer {

// VolumeSnapshotInformer returns an informer for VolumeSnapshots
func VolumeSnapshotInformer(clientSet kubecli.KubevirtClient, resyncPeriod time.Duration) cache.SharedIndexInformer {
restClient := clientSet.KubernetesSnapshotClient().SnapshotV1beta1().RESTClient()
restClient := clientSet.KubernetesSnapshotClient().SnapshotV1().RESTClient()
lw := cache.NewListWatchFromClient(restClient, "volumesnapshots", k8sv1.NamespaceAll, fields.Everything())
return cache.NewSharedIndexInformer(lw, &vsv1.VolumeSnapshot{}, resyncPeriod, cache.Indexers{})
}

// VolumeSnapshotClassInformer returns an informer for VolumeSnapshotClasses
func VolumeSnapshotClassInformer(clientSet kubecli.KubevirtClient, resyncPeriod time.Duration) cache.SharedIndexInformer {
restClient := clientSet.KubernetesSnapshotClient().SnapshotV1beta1().RESTClient()
restClient := clientSet.KubernetesSnapshotClient().SnapshotV1().RESTClient()
lw := cache.NewListWatchFromClient(restClient, "volumesnapshotclasses", k8sv1.NamespaceAll, fields.Everything())
return cache.NewSharedIndexInformer(lw, &vsv1.VolumeSnapshotClass{}, resyncPeriod, cache.Indexers{})
}
2 changes: 1 addition & 1 deletion pkg/virt-controller/watch/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func (ctrl *VMSnapshotController) createVolumeSnapshot(
},
}

volumeSnapshot, err := ctrl.Client.KubernetesSnapshotClient().SnapshotV1beta1().
volumeSnapshot, err := ctrl.Client.KubernetesSnapshotClient().SnapshotV1().
VolumeSnapshots(content.Namespace).
Create(context.Background(), snapshot, metav1.CreateOptions{})
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go_library(
importpath = "kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned",
visibility = ["//visibility:public"],
deps = [
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1beta1:go_default_library",
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1:go_default_library",
"//vendor/k8s.io/client-go/discovery:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/util/flowcontrol:go_default_library",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned:go_default_library",
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1beta1:go_default_library",
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1beta1/fake:go_default_library",
"//vendor/github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1:go_default_library",
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1:go_default_library",
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1/fake:go_default_library",
"//vendor/github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go_library(
importpath = "kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/scheme",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1:go_default_library",
"//vendor/github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ go_library(
"volumesnapshotclass.go",
"volumesnapshotcontent.go",
],
importpath = "kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1beta1",
importpath = "kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1",
visibility = ["//visibility:public"],
deps = [
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/scheme:go_default_library",
"//vendor/github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1:go_default_library",
"//vendor/github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ go_library(
"fake_volumesnapshotclass.go",
"fake_volumesnapshotcontent.go",
],
importpath = "kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1beta1/fake",
importpath = "kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1/fake",
visibility = ["//visibility:public"],
deps = [
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1beta1:go_default_library",
"//vendor/github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1:go_default_library",
"//staging/src/kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned/typed/volumesnapshot/v1:go_default_library",
"//vendor/github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
Expand Down
Loading

0 comments on commit 7c7a8b4

Please sign in to comment.