Update VolumeSnapshot CRD version to v1beta

preserveUnknownField set to false, comments updates, adding pull request annotation
more comment updates
VolumeSnapshot comments
rename to VolumeSnapshotClassName
adding license
This commit is contained in:
Xing Yang
2019-07-11 12:32:07 -07:00
committed by xiangqian
parent 6fa4d49620
commit 0c1faac468
78 changed files with 1778 additions and 14457 deletions

View File

@@ -20,8 +20,12 @@ import (
"fmt"
"strings"
crdv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
"k8s.io/api/core/v1"
"os"
"strconv"
"time"
crdv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
@@ -30,9 +34,6 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/slice"
"os"
"strconv"
"time"
)
var (
@@ -87,7 +88,7 @@ func snapshotKey(vs *crdv1.VolumeSnapshot) string {
return fmt.Sprintf("%s/%s", vs.Namespace, vs.Name)
}
func snapshotRefKey(vsref *v1.ObjectReference) string {
func snapshotRefKey(vsref v1.ObjectReference) string {
return fmt.Sprintf("%s/%s", vsref.Namespace, vsref.Name)
}
@@ -152,8 +153,8 @@ func storeObjectUpdate(store cache.Store, obj interface{}, className string) (bo
func GetSnapshotContentNameForSnapshot(snapshot *crdv1.VolumeSnapshot) string {
// If VolumeSnapshot object has SnapshotContentName, use it directly.
// This might be the case for static provisioning.
if len(snapshot.Spec.SnapshotContentName) > 0 {
return snapshot.Spec.SnapshotContentName
if snapshot.Spec.Source.VolumeSnapshotContentName != nil {
return *snapshot.Spec.Source.VolumeSnapshotContentName
}
// Construct SnapshotContentName for dynamic provisioning.
return "snapcontent-" + string(snapshot.UID)