From 01933b02a3bbc8f1c597f20d74a19f2d9a4ca988 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Mon, 25 Feb 2019 19:25:49 -0500 Subject: [PATCH] replace usage of v1beta1 VolumeAttachments with v1 --- pkg/kubeapiserver/BUILD | 1 - pkg/kubeapiserver/authorizer/config.go | 2 +- .../default_storage_factory_builder.go | 2 -- pkg/volume/csi/BUILD | 4 ++-- pkg/volume/csi/csi_attacher.go | 16 +++++++-------- pkg/volume/csi/csi_attacher_test.go | 20 +++++++++---------- pkg/volume/csi/csi_block.go | 4 ++-- pkg/volume/csi/csi_block_test.go | 4 ++-- pkg/volume/csi/csi_mounter_test.go | 6 +++--- pkg/volume/csi/csi_plugin.go | 2 +- plugin/pkg/auth/authorizer/node/BUILD | 6 +++--- .../auth/authorizer/node/graph_populator.go | 10 +++++----- .../authorizer/node/node_authorizer_test.go | 10 +++++----- test/integration/auth/BUILD | 2 +- test/integration/auth/node_test.go | 10 +++++----- test/integration/etcd/data.go | 4 ++-- 16 files changed, 50 insertions(+), 53 deletions(-) diff --git a/pkg/kubeapiserver/BUILD b/pkg/kubeapiserver/BUILD index 4a9c0ea502..9b0ec00572 100644 --- a/pkg/kubeapiserver/BUILD +++ b/pkg/kubeapiserver/BUILD @@ -21,7 +21,6 @@ go_library( "//pkg/apis/extensions:go_default_library", "//pkg/apis/networking:go_default_library", "//pkg/apis/policy:go_default_library", - "//pkg/apis/storage:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//staging/src/k8s.io/apiserver/pkg/server/options:go_default_library", diff --git a/pkg/kubeapiserver/authorizer/config.go b/pkg/kubeapiserver/authorizer/config.go index 5a3d88aabb..8382be9c86 100644 --- a/pkg/kubeapiserver/authorizer/config.go +++ b/pkg/kubeapiserver/authorizer/config.go @@ -76,7 +76,7 @@ func (config Config) New() (authorizer.Authorizer, authorizer.RuleResolver, erro config.VersionedInformerFactory.Core().V1().Nodes(), config.VersionedInformerFactory.Core().V1().Pods(), config.VersionedInformerFactory.Core().V1().PersistentVolumes(), - config.VersionedInformerFactory.Storage().V1beta1().VolumeAttachments(), + config.VersionedInformerFactory.Storage().V1().VolumeAttachments(), ) nodeAuthorizer := node.NewAuthorizer(graph, nodeidentifier.NewDefaultNodeIdentifier(), bootstrappolicy.NodeRules()) authorizers = append(authorizers, nodeAuthorizer) diff --git a/pkg/kubeapiserver/default_storage_factory_builder.go b/pkg/kubeapiserver/default_storage_factory_builder.go index b92a53d7e2..a3dbefc5a0 100644 --- a/pkg/kubeapiserver/default_storage_factory_builder.go +++ b/pkg/kubeapiserver/default_storage_factory_builder.go @@ -34,7 +34,6 @@ import ( "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/networking" "k8s.io/kubernetes/pkg/apis/policy" - apisstorage "k8s.io/kubernetes/pkg/apis/storage" ) // SpecialDefaultResourcePrefixes are prefixes compiled into Kubernetes. @@ -54,7 +53,6 @@ func NewStorageFactoryConfig() *StorageFactoryConfig { DefaultResourceEncoding: serverstorage.NewDefaultResourceEncodingConfig(legacyscheme.Scheme), ResourceEncodingOverrides: []schema.GroupVersionResource{ batch.Resource("cronjobs").WithVersion("v1beta1"), - apisstorage.Resource("volumeattachments").WithVersion("v1beta1"), }, } } diff --git a/pkg/volume/csi/BUILD b/pkg/volume/csi/BUILD index a0dd1c8e6b..4d042bc65b 100644 --- a/pkg/volume/csi/BUILD +++ b/pkg/volume/csi/BUILD @@ -20,7 +20,7 @@ go_library( "//pkg/volume/csi/nodeinfomanager:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/storage/v1beta1:go_default_library", + "//staging/src/k8s.io/api/storage/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", @@ -57,7 +57,7 @@ go_test( "//pkg/volume/testing:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/storage/v1beta1:go_default_library", + "//staging/src/k8s.io/api/storage/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", diff --git a/pkg/volume/csi/csi_attacher.go b/pkg/volume/csi/csi_attacher.go index 68464eace8..328f595b19 100644 --- a/pkg/volume/csi/csi_attacher.go +++ b/pkg/volume/csi/csi_attacher.go @@ -30,7 +30,7 @@ import ( "k8s.io/klog" "k8s.io/api/core/v1" - storage "k8s.io/api/storage/v1beta1" + storage "k8s.io/api/storage/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -86,7 +86,7 @@ func (c *csiAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) (string }, } - _, err = c.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err = c.k8s.StorageV1().VolumeAttachments().Create(attachment) alreadyExist := false if err != nil { if !apierrs.IsAlreadyExists(err) { @@ -135,7 +135,7 @@ func (c *csiAttacher) waitForVolumeAttachment(volumeHandle, attachID string, tim func (c *csiAttacher) waitForVolumeAttachmentInternal(volumeHandle, attachID string, timer *time.Timer, timeout time.Duration) (string, error) { klog.V(4).Info(log("probing VolumeAttachment [id=%v]", attachID)) - attach, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attach, err := c.k8s.StorageV1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { klog.Error(log("attacher.WaitForAttach failed for volume [%s] (will continue to try): %v", volumeHandle, err)) return "", fmt.Errorf("volume %v has GET error for volume attachment %v: %v", volumeHandle, attachID, err) @@ -148,7 +148,7 @@ func (c *csiAttacher) waitForVolumeAttachmentInternal(volumeHandle, attachID str return attachID, nil } - watcher, err := c.k8s.StorageV1beta1().VolumeAttachments().Watch(meta.SingleObject(meta.ObjectMeta{Name: attachID, ResourceVersion: attach.ResourceVersion})) + watcher, err := c.k8s.StorageV1().VolumeAttachments().Watch(meta.SingleObject(meta.ObjectMeta{Name: attachID, ResourceVersion: attach.ResourceVersion})) if err != nil { return "", fmt.Errorf("watch error:%v for volume %v", err, volumeHandle) } @@ -238,7 +238,7 @@ func (c *csiAttacher) VolumesAreAttached(specs []*volume.Spec, nodeName types.No attachID := getAttachmentName(source.VolumeHandle, source.Driver, string(nodeName)) klog.V(4).Info(log("probing attachment status for VolumeAttachment %v", attachID)) - attach, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attach, err := c.k8s.StorageV1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { attached[spec] = false klog.Error(log("attacher.VolumesAreAttached failed for attach.ID=%v: %v", attachID, err)) @@ -417,7 +417,7 @@ func (c *csiAttacher) Detach(volumeName string, nodeName types.NodeName) error { attachID = getAttachmentName(volID, driverName, string(nodeName)) } - if err := c.k8s.StorageV1beta1().VolumeAttachments().Delete(attachID, nil); err != nil { + if err := c.k8s.StorageV1().VolumeAttachments().Delete(attachID, nil); err != nil { if apierrs.IsNotFound(err) { // object deleted or never existed, done klog.V(4).Info(log("VolumeAttachment object [%v] for volume [%v] not found, object deleted", attachID, volID)) @@ -443,7 +443,7 @@ func (c *csiAttacher) waitForVolumeDetachment(volumeHandle, attachID string) err func (c *csiAttacher) waitForVolumeDetachmentInternal(volumeHandle, attachID string, timer *time.Timer, timeout time.Duration) error { klog.V(4).Info(log("probing VolumeAttachment [id=%v]", attachID)) - attach, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attach, err := c.k8s.StorageV1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { if apierrs.IsNotFound(err) { //object deleted or never existed, done @@ -460,7 +460,7 @@ func (c *csiAttacher) waitForVolumeDetachmentInternal(volumeHandle, attachID str return errors.New(detachErr.Message) } - watcher, err := c.k8s.StorageV1beta1().VolumeAttachments().Watch(meta.SingleObject(meta.ObjectMeta{Name: attachID, ResourceVersion: attach.ResourceVersion})) + watcher, err := c.k8s.StorageV1().VolumeAttachments().Watch(meta.SingleObject(meta.ObjectMeta{Name: attachID, ResourceVersion: attach.ResourceVersion})) if err != nil { return fmt.Errorf("watch error:%v for volume %v", err, volumeHandle) } diff --git a/pkg/volume/csi/csi_attacher_test.go b/pkg/volume/csi/csi_attacher_test.go index 6715a53f9c..46c5b35a56 100644 --- a/pkg/volume/csi/csi_attacher_test.go +++ b/pkg/volume/csi/csi_attacher_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - storage "k8s.io/api/storage/v1beta1" + storage "k8s.io/api/storage/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -76,7 +76,7 @@ func markVolumeAttached(t *testing.T, client clientset.Interface, watch *watch.R defer ticker.Stop() // wait for attachment to be saved for i := 0; i < 100; i++ { - attach, err = client.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attach, err = client.StorageV1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { if apierrs.IsNotFound(err) { <-ticker.C @@ -95,7 +95,7 @@ func markVolumeAttached(t *testing.T, client clientset.Interface, watch *watch.R t.Logf("attachment not found for id:%v", attachID) } else { attach.Status = status - _, err := client.StorageV1beta1().VolumeAttachments().Update(attach) + _, err := client.StorageV1().VolumeAttachments().Update(attach) if err != nil { t.Error(err) } @@ -392,11 +392,11 @@ func TestAttacherWaitForAttach(t *testing.T) { if test.makeAttachment != nil { attachment := test.makeAttachment() - _, err = csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err = csiAttacher.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to create VolumeAttachment: %v", err) } - gotAttachment, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Get(attachment.Name, meta.GetOptions{}) + gotAttachment, err := csiAttacher.k8s.StorageV1().VolumeAttachments().Get(attachment.Name, meta.GetOptions{}) if err != nil { t.Fatalf("failed to get created VolumeAttachment: %v", err) } @@ -484,7 +484,7 @@ func TestAttacherWaitForVolumeAttachment(t *testing.T) { attachment := makeTestAttachment(attachID, nodeName, pvName) attachment.Status.Attached = tc.initAttached attachment.Status.AttachError = tc.initAttachErr - _, err = csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err = csiAttacher.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to attach: %v", err) } @@ -548,7 +548,7 @@ func TestAttacherVolumesAreAttached(t *testing.T) { attachID := getAttachmentName(volName, testDriver, nodeName) attachment := makeTestAttachment(attachID, nodeName, pv.GetName()) attachment.Status.Attached = stat - _, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err := csiAttacher.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to attach: %v", err) } @@ -621,7 +621,7 @@ func TestAttacherDetach(t *testing.T) { pv := makeTestPV("test-pv", 10, testDriver, tc.volID) spec := volume.NewSpecFromPersistentVolume(pv, pv.Spec.PersistentVolumeSource.CSI.ReadOnly) attachment := makeTestAttachment(tc.attachID, nodeName, "test-pv") - _, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err := csiAttacher.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to attach: %v", err) } @@ -639,7 +639,7 @@ func TestAttacherDetach(t *testing.T) { if !tc.shouldFail && err != nil { t.Fatalf("unexpected err: %v", err) } - attach, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Get(tc.attachID, meta.GetOptions{}) + attach, err := csiAttacher.k8s.StorageV1().VolumeAttachments().Get(tc.attachID, meta.GetOptions{}) if err != nil { if !apierrs.IsNotFound(err) { t.Fatalf("unexpected err: %v", err) @@ -787,7 +787,7 @@ func TestAttacherMountDevice(t *testing.T) { // Set up volume attachment attachment := makeTestAttachment(attachID, nodeName, pvName) - _, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err := csiAttacher.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to attach: %v", err) } diff --git a/pkg/volume/csi/csi_block.go b/pkg/volume/csi/csi_block.go index 1e4553ff4d..d8296c9eda 100644 --- a/pkg/volume/csi/csi_block.go +++ b/pkg/volume/csi/csi_block.go @@ -27,7 +27,7 @@ import ( "k8s.io/klog" "k8s.io/api/core/v1" - storage "k8s.io/api/storage/v1beta1" + storage "k8s.io/api/storage/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" @@ -227,7 +227,7 @@ func (m *csiBlockMapper) SetUpDevice() (string, error) { // Search for attachment by VolumeAttachment.Spec.Source.PersistentVolumeName nodeName := string(m.plugin.host.GetNodeName()) attachID := getAttachmentName(csiSource.VolumeHandle, csiSource.Driver, nodeName) - attachment, err := m.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attachment, err := m.k8s.StorageV1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { klog.Error(log("blockMapper.SetupDevice failed to get volume attachment [id=%v]: %v", attachID, err)) return "", err diff --git a/pkg/volume/csi/csi_block_test.go b/pkg/volume/csi/csi_block_test.go index 7bcd00e219..72d803621b 100644 --- a/pkg/volume/csi/csi_block_test.go +++ b/pkg/volume/csi/csi_block_test.go @@ -233,7 +233,7 @@ func TestBlockMapperSetupDevice(t *testing.T) { attachID := getAttachmentName(csiMapper.volumeID, string(csiMapper.driverName), string(nodeName)) attachment := makeTestAttachment(attachID, nodeName, pvName) attachment.Status.Attached = true - _, err = csiMapper.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err = csiMapper.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to setup VolumeAttachment: %v", err) } @@ -300,7 +300,7 @@ func TestBlockMapperMapDevice(t *testing.T) { attachID := getAttachmentName(csiMapper.volumeID, string(csiMapper.driverName), string(nodeName)) attachment := makeTestAttachment(attachID, nodeName, pvName) attachment.Status.Attached = true - _, err = csiMapper.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err = csiMapper.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to setup VolumeAttachment: %v", err) } diff --git a/pkg/volume/csi/csi_mounter_test.go b/pkg/volume/csi/csi_mounter_test.go index 938e5b7876..6301c1bdd7 100644 --- a/pkg/volume/csi/csi_mounter_test.go +++ b/pkg/volume/csi/csi_mounter_test.go @@ -28,7 +28,7 @@ import ( "reflect" api "k8s.io/api/core/v1" - storage "k8s.io/api/storage/v1beta1" + storage "k8s.io/api/storage/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" @@ -208,7 +208,7 @@ func MounterSetUpTests(t *testing.T, podInfoEnabled bool) { DetachError: nil, }, } - _, err = csiMounter.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err = csiMounter.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to setup VolumeAttachment: %v", err) } @@ -363,7 +363,7 @@ func TestMounterSetUpWithFSGroup(t *testing.T) { attachID := getAttachmentName(csiMounter.volumeID, string(csiMounter.driverName), string(plug.host.GetNodeName())) attachment := makeTestAttachment(attachID, "test-node", pvName) - _, err = csiMounter.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) + _, err = csiMounter.k8s.StorageV1().VolumeAttachments().Create(attachment) if err != nil { t.Errorf("failed to setup VolumeAttachment: %v", err) continue diff --git a/pkg/volume/csi/csi_plugin.go b/pkg/volume/csi/csi_plugin.go index 78e5d341d2..81814e5a43 100644 --- a/pkg/volume/csi/csi_plugin.go +++ b/pkg/volume/csi/csi_plugin.go @@ -638,7 +638,7 @@ func (p *csiPlugin) getPublishContext(client clientset.Interface, handle, driver attachID := getAttachmentName(handle, driver, nodeName) // search for attachment by VolumeAttachment.Spec.Source.PersistentVolumeName - attachment, err := client.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attachment, err := client.StorageV1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { return nil, err // This err already has enough context ("VolumeAttachment xyz not found") } diff --git a/plugin/pkg/auth/authorizer/node/BUILD b/plugin/pkg/auth/authorizer/node/BUILD index 5ae8b4a536..4e171b31a4 100644 --- a/plugin/pkg/auth/authorizer/node/BUILD +++ b/plugin/pkg/auth/authorizer/node/BUILD @@ -19,7 +19,7 @@ go_test( "//pkg/features:go_default_library", "//plugin/pkg/auth/authorizer/rbac/bootstrappolicy:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/storage/v1beta1:go_default_library", + "//staging/src/k8s.io/api/storage/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apiserver/pkg/authentication/user:go_default_library", @@ -49,12 +49,12 @@ go_library( "//plugin/pkg/auth/authorizer/rbac:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/rbac/v1:go_default_library", - "//staging/src/k8s.io/api/storage/v1beta1:go_default_library", + "//staging/src/k8s.io/api/storage/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//staging/src/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//staging/src/k8s.io/client-go/informers/core/v1:go_default_library", - "//staging/src/k8s.io/client-go/informers/storage/v1beta1:go_default_library", + "//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library", "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library", "//third_party/forked/gonum/graph:go_default_library", diff --git a/plugin/pkg/auth/authorizer/node/graph_populator.go b/plugin/pkg/auth/authorizer/node/graph_populator.go index f2cc1a5135..7e5976379e 100644 --- a/plugin/pkg/auth/authorizer/node/graph_populator.go +++ b/plugin/pkg/auth/authorizer/node/graph_populator.go @@ -21,10 +21,10 @@ import ( "k8s.io/klog" corev1 "k8s.io/api/core/v1" - storagev1beta1 "k8s.io/api/storage/v1beta1" + storagev1 "k8s.io/api/storage/v1" utilfeature "k8s.io/apiserver/pkg/util/feature" corev1informers "k8s.io/client-go/informers/core/v1" - storageinformers "k8s.io/client-go/informers/storage/v1beta1" + storageinformers "k8s.io/client-go/informers/storage/v1" "k8s.io/client-go/tools/cache" "k8s.io/kubernetes/pkg/features" ) @@ -195,10 +195,10 @@ func (g *graphPopulator) addVolumeAttachment(obj interface{}) { } func (g *graphPopulator) updateVolumeAttachment(oldObj, obj interface{}) { - attachment := obj.(*storagev1beta1.VolumeAttachment) + attachment := obj.(*storagev1.VolumeAttachment) if oldObj != nil { // skip add if node name is identical - oldAttachment := oldObj.(*storagev1beta1.VolumeAttachment) + oldAttachment := oldObj.(*storagev1.VolumeAttachment) if oldAttachment.Spec.NodeName == attachment.Spec.NodeName { return } @@ -210,7 +210,7 @@ func (g *graphPopulator) deleteVolumeAttachment(obj interface{}) { if tombstone, ok := obj.(cache.DeletedFinalStateUnknown); ok { obj = tombstone.Obj } - attachment, ok := obj.(*storagev1beta1.VolumeAttachment) + attachment, ok := obj.(*storagev1.VolumeAttachment) if !ok { klog.Infof("unexpected type %T", obj) return diff --git a/plugin/pkg/auth/authorizer/node/node_authorizer_test.go b/plugin/pkg/auth/authorizer/node/node_authorizer_test.go index d219e3c346..e7b318026d 100644 --- a/plugin/pkg/auth/authorizer/node/node_authorizer_test.go +++ b/plugin/pkg/auth/authorizer/node/node_authorizer_test.go @@ -27,7 +27,7 @@ import ( "os" corev1 "k8s.io/api/core/v1" - storagev1beta1 "k8s.io/api/storage/v1beta1" + storagev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apiserver/pkg/authentication/user" @@ -886,7 +886,7 @@ func BenchmarkAuthorization(b *testing.B) { } } -func populate(graph *Graph, nodes []*corev1.Node, pods []*corev1.Pod, pvs []*corev1.PersistentVolume, attachments []*storagev1beta1.VolumeAttachment) { +func populate(graph *Graph, nodes []*corev1.Node, pods []*corev1.Pod, pvs []*corev1.PersistentVolume, attachments []*storagev1.VolumeAttachment) { p := &graphPopulator{} p.graph = graph for _, node := range nodes { @@ -907,11 +907,11 @@ func populate(graph *Graph, nodes []*corev1.Node, pods []*corev1.Pod, pvs []*cor // the secret/configmap/pvc/node references in the pod and pv objects are named to indicate the connections between the objects. // for example, secret0-pod0-node0 is a secret referenced by pod0 which is bound to node0. // when populated into the graph, the node authorizer should allow node0 to access that secret, but not node1. -func generate(opts sampleDataOpts) ([]*corev1.Node, []*corev1.Pod, []*corev1.PersistentVolume, []*storagev1beta1.VolumeAttachment) { +func generate(opts sampleDataOpts) ([]*corev1.Node, []*corev1.Pod, []*corev1.PersistentVolume, []*storagev1.VolumeAttachment) { nodes := make([]*corev1.Node, 0, opts.nodes) pods := make([]*corev1.Pod, 0, opts.nodes*opts.podsPerNode) pvs := make([]*corev1.PersistentVolume, 0, (opts.nodes*opts.podsPerNode*opts.uniquePVCsPerPod)+(opts.sharedPVCsPerPod*opts.namespaces)) - attachments := make([]*storagev1beta1.VolumeAttachment, 0, opts.nodes*opts.attachmentsPerNode) + attachments := make([]*storagev1.VolumeAttachment, 0, opts.nodes*opts.attachmentsPerNode) for n := 0; n < opts.nodes; n++ { nodeName := fmt.Sprintf("node%d", n) @@ -970,7 +970,7 @@ func generate(opts sampleDataOpts) ([]*corev1.Node, []*corev1.Pod, []*corev1.Per pods = append(pods, pod) } for a := 0; a < opts.attachmentsPerNode; a++ { - attachment := &storagev1beta1.VolumeAttachment{} + attachment := &storagev1.VolumeAttachment{} attachment.Name = fmt.Sprintf("attachment%d-%s", a, nodeName) attachment.Spec.NodeName = nodeName attachments = append(attachments, attachment) diff --git a/test/integration/auth/BUILD b/test/integration/auth/BUILD index 0c99d7fd9e..31405070a5 100644 --- a/test/integration/auth/BUILD +++ b/test/integration/auth/BUILD @@ -51,7 +51,7 @@ go_test( "//staging/src/k8s.io/api/authentication/v1:go_default_library", "//staging/src/k8s.io/api/authentication/v1beta1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/storage/v1beta1:go_default_library", + "//staging/src/k8s.io/api/storage/v1:go_default_library", "//staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1:go_default_library", "//staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", diff --git a/test/integration/auth/node_test.go b/test/integration/auth/node_test.go index bbd4c7169b..868418c3ad 100644 --- a/test/integration/auth/node_test.go +++ b/test/integration/auth/node_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - storagev1beta1 "k8s.io/api/storage/v1beta1" + storagev1 "k8s.io/api/storage/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" @@ -126,11 +126,11 @@ func TestNodeAuthorizer(t *testing.T) { t.Fatal(err) } pvName := "mypv" - if _, err := superuserClientExternal.StorageV1beta1().VolumeAttachments().Create(&storagev1beta1.VolumeAttachment{ + if _, err := superuserClientExternal.StorageV1().VolumeAttachments().Create(&storagev1.VolumeAttachment{ ObjectMeta: metav1.ObjectMeta{Name: "myattachment"}, - Spec: storagev1beta1.VolumeAttachmentSpec{ + Spec: storagev1.VolumeAttachmentSpec{ Attacher: "foo", - Source: storagev1beta1.VolumeAttachmentSource{PersistentVolumeName: &pvName}, + Source: storagev1.VolumeAttachmentSource{PersistentVolumeName: &pvName}, NodeName: "node2", }, }); err != nil { @@ -203,7 +203,7 @@ func TestNodeAuthorizer(t *testing.T) { } getVolumeAttachment := func(client externalclientset.Interface) func() error { return func() error { - _, err := client.StorageV1beta1().VolumeAttachments().Get("myattachment", metav1.GetOptions{}) + _, err := client.StorageV1().VolumeAttachments().Get("myattachment", metav1.GetOptions{}) return err } } diff --git a/test/integration/etcd/data.go b/test/integration/etcd/data.go index e42ff3eac2..30f5247fa5 100644 --- a/test/integration/etcd/data.go +++ b/test/integration/etcd/data.go @@ -296,7 +296,7 @@ func GetEtcdStorageData() map[schema.GroupVersionResource]StorageData { gvr("storage.k8s.io", "v1alpha1", "volumeattachments"): { Stub: `{"metadata": {"name": "va1"}, "spec": {"attacher": "gce", "nodeName": "localhost", "source": {"persistentVolumeName": "pv1"}}}`, ExpectedEtcdPath: "/registry/volumeattachments/va1", - ExpectedGVK: gvkP("storage.k8s.io", "v1beta1", "VolumeAttachment"), + ExpectedGVK: gvkP("storage.k8s.io", "v1", "VolumeAttachment"), }, // -- @@ -304,6 +304,7 @@ func GetEtcdStorageData() map[schema.GroupVersionResource]StorageData { gvr("storage.k8s.io", "v1beta1", "volumeattachments"): { Stub: `{"metadata": {"name": "va2"}, "spec": {"attacher": "gce", "nodeName": "localhost", "source": {"persistentVolumeName": "pv2"}}}`, ExpectedEtcdPath: "/registry/volumeattachments/va2", + ExpectedGVK: gvkP("storage.k8s.io", "v1", "VolumeAttachment"), }, // -- @@ -311,7 +312,6 @@ func GetEtcdStorageData() map[schema.GroupVersionResource]StorageData { gvr("storage.k8s.io", "v1", "volumeattachments"): { Stub: `{"metadata": {"name": "va3"}, "spec": {"attacher": "gce", "nodeName": "localhost", "source": {"persistentVolumeName": "pv3"}}}`, ExpectedEtcdPath: "/registry/volumeattachments/va3", - ExpectedGVK: gvkP("storage.k8s.io", "v1beta1", "VolumeAttachment"), }, // --