diff --git a/pkg/kubeapiserver/authorizer/config.go b/pkg/kubeapiserver/authorizer/config.go index b61a830b4a8..30661bc14fc 100644 --- a/pkg/kubeapiserver/authorizer/config.go +++ b/pkg/kubeapiserver/authorizer/config.go @@ -82,7 +82,7 @@ func (config AuthorizationConfig) New() (authorizer.Authorizer, authorizer.RuleR graph, config.InformerFactory.Core().InternalVersion().Pods(), config.InformerFactory.Core().InternalVersion().PersistentVolumes(), - config.VersionedInformerFactory.Storage().V1alpha1().VolumeAttachments(), + config.VersionedInformerFactory.Storage().V1beta1().VolumeAttachments(), ) nodeAuthorizer := node.NewAuthorizer(graph, nodeidentifier.NewDefaultNodeIdentifier(), bootstrappolicy.NodeRules()) authorizers = append(authorizers, nodeAuthorizer) diff --git a/pkg/master/BUILD b/pkg/master/BUILD index fadfc10b42b..6a95deab7b8 100644 --- a/pkg/master/BUILD +++ b/pkg/master/BUILD @@ -132,6 +132,7 @@ go_test( "//pkg/apis/core:go_default_library", "//pkg/apis/extensions:go_default_library", "//pkg/apis/rbac:go_default_library", + "//pkg/apis/storage:go_default_library", "//pkg/client/clientset_generated/internalclientset/fake:go_default_library", "//pkg/generated/openapi:go_default_library", "//pkg/kubelet/client:go_default_library", diff --git a/pkg/master/master_test.go b/pkg/master/master_test.go index 45700d11e71..a745791f9c9 100644 --- a/pkg/master/master_test.go +++ b/pkg/master/master_test.go @@ -53,6 +53,7 @@ import ( api "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/rbac" + "k8s.io/kubernetes/pkg/apis/storage" kubeletclient "k8s.io/kubernetes/pkg/kubelet/client" "k8s.io/kubernetes/pkg/master/reconcilers" certificatesrest "k8s.io/kubernetes/pkg/registry/certificates/rest" @@ -83,6 +84,8 @@ func setUp(t *testing.T) (*etcdtesting.EtcdTestServer, Config, informers.SharedI resourceEncoding.SetVersionEncoding(batch.GroupName, *testapi.Batch.GroupVersion(), schema.GroupVersion{Group: batch.GroupName, Version: runtime.APIVersionInternal}) // FIXME (soltysh): this GroupVersionResource override should be configurable resourceEncoding.SetResourceEncoding(schema.GroupResource{Group: "batch", Resource: "cronjobs"}, schema.GroupVersion{Group: batch.GroupName, Version: "v1beta1"}, schema.GroupVersion{Group: batch.GroupName, Version: runtime.APIVersionInternal}) + resourceEncoding.SetResourceEncoding(schema.GroupResource{Group: "storage.k8s.io", Resource: "volumeattachments"}, schema.GroupVersion{Group: storage.GroupName, Version: "v1beta1"}, schema.GroupVersion{Group: storage.GroupName, Version: runtime.APIVersionInternal}) + resourceEncoding.SetVersionEncoding(apps.GroupName, *testapi.Apps.GroupVersion(), schema.GroupVersion{Group: apps.GroupName, Version: runtime.APIVersionInternal}) resourceEncoding.SetVersionEncoding(extensions.GroupName, *testapi.Extensions.GroupVersion(), schema.GroupVersion{Group: extensions.GroupName, Version: runtime.APIVersionInternal}) resourceEncoding.SetVersionEncoding(rbac.GroupName, *testapi.Rbac.GroupVersion(), schema.GroupVersion{Group: rbac.GroupName, Version: runtime.APIVersionInternal}) diff --git a/pkg/volume/csi/BUILD b/pkg/volume/csi/BUILD index f1bd2c1e7be..3d2b81746a0 100644 --- a/pkg/volume/csi/BUILD +++ b/pkg/volume/csi/BUILD @@ -20,7 +20,7 @@ go_library( "//vendor/golang.org/x/net/context:go_default_library", "//vendor/google.golang.org/grpc:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", - "//vendor/k8s.io/api/storage/v1alpha1:go_default_library", + "//vendor/k8s.io/api/storage/v1beta1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", @@ -46,7 +46,7 @@ go_test( "//vendor/golang.org/x/net/context:go_default_library", "//vendor/google.golang.org/grpc:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", - "//vendor/k8s.io/api/storage/v1alpha1:go_default_library", + "//vendor/k8s.io/api/storage/v1beta1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/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 2c0b577b8f0..c20564b79a2 100644 --- a/pkg/volume/csi/csi_attacher.go +++ b/pkg/volume/csi/csi_attacher.go @@ -26,7 +26,7 @@ import ( "github.com/golang/glog" "k8s.io/api/core/v1" - storage "k8s.io/api/storage/v1alpha1" + storage "k8s.io/api/storage/v1beta1" apierrs "k8s.io/apimachinery/pkg/api/errors" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -73,7 +73,7 @@ func (c *csiAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) (string Status: storage.VolumeAttachmentStatus{Attached: false}, } - _, err = c.k8s.StorageV1alpha1().VolumeAttachments().Create(attachment) + _, err = c.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) alreadyExist := false if err != nil { if !apierrs.IsAlreadyExists(err) { @@ -128,7 +128,7 @@ func (c *csiAttacher) waitForVolumeAttachment(volumeHandle, attachID string, tim select { case <-ticker.C: glog.V(4).Info(log("probing VolumeAttachment [id=%v]", attachID)) - attach, err := c.k8s.StorageV1alpha1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attach, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { glog.Error(log("attacher.WaitForAttach failed (will continue to try): %v", err)) continue @@ -173,7 +173,7 @@ func (c *csiAttacher) VolumesAreAttached(specs []*volume.Spec, nodeName types.No attachID := getAttachmentName(source.VolumeHandle, source.Driver, string(nodeName)) glog.V(4).Info(log("probing attachment status for VolumeAttachment %v", attachID)) - attach, err := c.k8s.StorageV1alpha1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attach, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { glog.Error(log("attacher.VolumesAreAttached failed for attach.ID=%v: %v", attachID, err)) continue @@ -212,7 +212,7 @@ func (c *csiAttacher) Detach(volumeName string, nodeName types.NodeName) error { driverName := parts[0] volID := parts[1] attachID := getAttachmentName(volID, driverName, string(nodeName)) - if err := c.k8s.StorageV1alpha1().VolumeAttachments().Delete(attachID, nil); err != nil { + if err := c.k8s.StorageV1beta1().VolumeAttachments().Delete(attachID, nil); err != nil { glog.Error(log("detacher.Detach failed to delete VolumeAttachment [%s]: %v", attachID, err)) return err } @@ -236,7 +236,7 @@ func (c *csiAttacher) waitForVolumeDetachment(volumeHandle, attachID string) err select { case <-ticker.C: glog.V(4).Info(log("probing VolumeAttachment [id=%v]", attachID)) - attach, err := c.k8s.StorageV1alpha1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attach, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { if apierrs.IsNotFound(err) { //object deleted or never existed, done diff --git a/pkg/volume/csi/csi_attacher_test.go b/pkg/volume/csi/csi_attacher_test.go index 308b646d4ce..b2ed1c35527 100644 --- a/pkg/volume/csi/csi_attacher_test.go +++ b/pkg/volume/csi/csi_attacher_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - storage "k8s.io/api/storage/v1alpha1" + storage "k8s.io/api/storage/v1beta1" apierrs "k8s.io/apimachinery/pkg/api/errors" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -129,7 +129,7 @@ func TestAttacherAttach(t *testing.T) { // wait for attachment to be saved var attach *storage.VolumeAttachment for i := 0; i < 100; i++ { - attach, err = csiAttacher.k8s.StorageV1alpha1().VolumeAttachments().Get(tc.attachID, meta.GetOptions{}) + attach, err = csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Get(tc.attachID, meta.GetOptions{}) if err != nil { if apierrs.IsNotFound(err) { <-ticker.C @@ -146,7 +146,7 @@ func TestAttacherAttach(t *testing.T) { t.Error("attachment not found") } attach.Status.Attached = true - _, err = csiAttacher.k8s.StorageV1alpha1().VolumeAttachments().Update(attach) + _, err = csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Update(attach) if err != nil { t.Error(err) } @@ -188,7 +188,7 @@ func TestAttacherWaitForVolumeAttachment(t *testing.T) { csiAttacher.waitSleepTime = tc.sleepTime go func() { - _, err := csiAttacher.k8s.StorageV1alpha1().VolumeAttachments().Create(attachment) + _, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to attach: %v", err) } @@ -239,7 +239,7 @@ func TestAttacherVolumesAreAttached(t *testing.T) { attachID := getAttachmentName(volName, testDriver, nodeName) attachment := makeTestAttachment(attachID, nodeName, pv.GetName()) attachment.Status.Attached = stat - _, err := csiAttacher.k8s.StorageV1alpha1().VolumeAttachments().Create(attachment) + _, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to attach: %v", err) } @@ -292,7 +292,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.StorageV1alpha1().VolumeAttachments().Create(attachment) + _, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to attach: %v", err) } @@ -307,7 +307,7 @@ func TestAttacherDetach(t *testing.T) { if !tc.shouldFail && err != nil { t.Fatalf("unexpected err: %v", err) } - attach, err := csiAttacher.k8s.StorageV1alpha1().VolumeAttachments().Get(tc.attachID, meta.GetOptions{}) + attach, err := csiAttacher.k8s.StorageV1beta1().VolumeAttachments().Get(tc.attachID, meta.GetOptions{}) if err != nil { if !apierrs.IsNotFound(err) { t.Fatalf("unexpected err: %v", err) diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index 62954369b65..7874b86ebd9 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -138,7 +138,7 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error { // search for attachment by VolumeAttachment.Spec.Source.PersistentVolumeName if c.volumeInfo == nil { - attachment, err := c.k8s.StorageV1alpha1().VolumeAttachments().Get(attachID, meta.GetOptions{}) + attachment, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{}) if err != nil { glog.Error(log("mounter.SetupAt failed while getting volume attachment [id=%v]: %v", attachID, err)) return err diff --git a/pkg/volume/csi/csi_mounter_test.go b/pkg/volume/csi/csi_mounter_test.go index 3fa14198f0c..b95c1630a25 100644 --- a/pkg/volume/csi/csi_mounter_test.go +++ b/pkg/volume/csi/csi_mounter_test.go @@ -26,7 +26,7 @@ import ( "testing" api "k8s.io/api/core/v1" - storage "k8s.io/api/storage/v1alpha1" + storage "k8s.io/api/storage/v1beta1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" fakeclient "k8s.io/client-go/kubernetes/fake" @@ -135,7 +135,7 @@ func TestMounterSetUp(t *testing.T) { DetachError: nil, }, } - _, err = csiMounter.k8s.StorageV1alpha1().VolumeAttachments().Create(attachment) + _, err = csiMounter.k8s.StorageV1beta1().VolumeAttachments().Create(attachment) if err != nil { t.Fatalf("failed to setup VolumeAttachment: %v", err) } diff --git a/plugin/pkg/auth/authorizer/node/BUILD b/plugin/pkg/auth/authorizer/node/BUILD index 330d2cb22a8..06438e7b702 100644 --- a/plugin/pkg/auth/authorizer/node/BUILD +++ b/plugin/pkg/auth/authorizer/node/BUILD @@ -16,7 +16,7 @@ go_test( "//pkg/auth/nodeidentifier:go_default_library", "//pkg/features:go_default_library", "//plugin/pkg/auth/authorizer/rbac/bootstrappolicy:go_default_library", - "//vendor/k8s.io/api/storage/v1alpha1:go_default_library", + "//vendor/k8s.io/api/storage/v1beta1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apiserver/pkg/authentication/user:go_default_library", "//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library", @@ -46,11 +46,11 @@ go_library( "//third_party/forked/gonum/graph/simple:go_default_library", "//third_party/forked/gonum/graph/traverse:go_default_library", "//vendor/github.com/golang/glog:go_default_library", - "//vendor/k8s.io/api/storage/v1alpha1:go_default_library", + "//vendor/k8s.io/api/storage/v1beta1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library", "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library", - "//vendor/k8s.io/client-go/informers/storage/v1alpha1:go_default_library", + "//vendor/k8s.io/client-go/informers/storage/v1beta1:go_default_library", "//vendor/k8s.io/client-go/tools/cache:go_default_library", ], ) diff --git a/plugin/pkg/auth/authorizer/node/graph_populator.go b/plugin/pkg/auth/authorizer/node/graph_populator.go index ec448835e5f..8c1c36a2d24 100644 --- a/plugin/pkg/auth/authorizer/node/graph_populator.go +++ b/plugin/pkg/auth/authorizer/node/graph_populator.go @@ -19,9 +19,9 @@ package node import ( "github.com/golang/glog" - storagev1alpha1 "k8s.io/api/storage/v1alpha1" + storagev1beta1 "k8s.io/api/storage/v1beta1" utilfeature "k8s.io/apiserver/pkg/util/feature" - storageinformers "k8s.io/client-go/informers/storage/v1alpha1" + storageinformers "k8s.io/client-go/informers/storage/v1beta1" "k8s.io/client-go/tools/cache" api "k8s.io/kubernetes/pkg/apis/core" coreinformers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/core/internalversion" @@ -129,10 +129,10 @@ func (g *graphPopulator) addVolumeAttachment(obj interface{}) { } func (g *graphPopulator) updateVolumeAttachment(oldObj, obj interface{}) { - attachment := obj.(*storagev1alpha1.VolumeAttachment) + attachment := obj.(*storagev1beta1.VolumeAttachment) if oldObj != nil { // skip add if node name is identical - oldAttachment := oldObj.(*storagev1alpha1.VolumeAttachment) + oldAttachment := oldObj.(*storagev1beta1.VolumeAttachment) if oldAttachment.Spec.NodeName == attachment.Spec.NodeName { return } diff --git a/plugin/pkg/auth/authorizer/node/node_authorizer_test.go b/plugin/pkg/auth/authorizer/node/node_authorizer_test.go index 407affd028b..669e41f0206 100644 --- a/plugin/pkg/auth/authorizer/node/node_authorizer_test.go +++ b/plugin/pkg/auth/authorizer/node/node_authorizer_test.go @@ -24,7 +24,7 @@ import ( "os" - storagev1alpha1 "k8s.io/api/storage/v1alpha1" + storagev1beta1 "k8s.io/api/storage/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authorization/authorizer" @@ -429,7 +429,7 @@ func BenchmarkAuthorization(b *testing.B) { } } -func populate(graph *Graph, pods []*api.Pod, pvs []*api.PersistentVolume, attachments []*storagev1alpha1.VolumeAttachment) { +func populate(graph *Graph, pods []*api.Pod, pvs []*api.PersistentVolume, attachments []*storagev1beta1.VolumeAttachment) { p := &graphPopulator{} p.graph = graph for _, pod := range pods { @@ -447,10 +447,10 @@ func populate(graph *Graph, pods []*api.Pod, pvs []*api.PersistentVolume, attach // 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) ([]*api.Pod, []*api.PersistentVolume, []*storagev1alpha1.VolumeAttachment) { +func generate(opts sampleDataOpts) ([]*api.Pod, []*api.PersistentVolume, []*storagev1beta1.VolumeAttachment) { pods := make([]*api.Pod, 0, opts.nodes*opts.podsPerNode) pvs := make([]*api.PersistentVolume, 0, (opts.nodes*opts.podsPerNode*opts.uniquePVCsPerPod)+(opts.sharedPVCsPerPod*opts.namespaces)) - attachments := make([]*storagev1alpha1.VolumeAttachment, 0, opts.nodes*opts.attachmentsPerNode) + attachments := make([]*storagev1beta1.VolumeAttachment, 0, opts.nodes*opts.attachmentsPerNode) for n := 0; n < opts.nodes; n++ { nodeName := fmt.Sprintf("node%d", n) @@ -508,7 +508,7 @@ func generate(opts sampleDataOpts) ([]*api.Pod, []*api.PersistentVolume, []*stor pods = append(pods, pod) } for a := 0; a < opts.attachmentsPerNode; a++ { - attachment := &storagev1alpha1.VolumeAttachment{} + attachment := &storagev1beta1.VolumeAttachment{} attachment.Name = fmt.Sprintf("attachment%d-%s", a, nodeName) attachment.Spec.NodeName = nodeName attachments = append(attachments, attachment) diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml index 208a4cddb55..f8fcaacb51d 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml @@ -1033,6 +1033,12 @@ items: - get - list - watch + - apiGroups: + - storage.k8s.io + resources: + - volumeattachments + verbs: + - get - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml index 0af7efbfa3e..24dbee8df39 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml @@ -48,6 +48,16 @@ items: - create - patch - update + - apiGroups: + - storage.k8s.io + resources: + - volumeattachments + verbs: + - create + - delete + - get + - list + - watch - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/test/integration/auth/BUILD b/test/integration/auth/BUILD index be9a3396f83..09fc4a6d630 100644 --- a/test/integration/auth/BUILD +++ b/test/integration/auth/BUILD @@ -51,7 +51,7 @@ go_test( "//test/integration/framework:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/api/authentication/v1beta1:go_default_library", - "//vendor/k8s.io/api/storage/v1alpha1:go_default_library", + "//vendor/k8s.io/api/storage/v1beta1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -69,7 +69,6 @@ go_test( "//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library", "//vendor/k8s.io/apiserver/pkg/authorization/authorizerfactory:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library", - "//vendor/k8s.io/apiserver/pkg/server/storage:go_default_library", "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library", "//vendor/k8s.io/apiserver/pkg/util/feature/testing:go_default_library", "//vendor/k8s.io/apiserver/plugin/pkg/authenticator/token/tokentest:go_default_library", diff --git a/test/integration/auth/node_test.go b/test/integration/auth/node_test.go index f9db0e50444..7698ff1be4f 100644 --- a/test/integration/auth/node_test.go +++ b/test/integration/auth/node_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - storagev1alpha1 "k8s.io/api/storage/v1alpha1" + storagev1beta1 "k8s.io/api/storage/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -32,7 +32,6 @@ import ( "k8s.io/apiserver/pkg/authentication/request/bearertoken" "k8s.io/apiserver/pkg/authentication/token/tokenfile" "k8s.io/apiserver/pkg/authentication/user" - serverstorage "k8s.io/apiserver/pkg/server/storage" utilfeature "k8s.io/apiserver/pkg/util/feature" utilfeaturetesting "k8s.io/apiserver/pkg/util/feature/testing" versionedinformers "k8s.io/client-go/informers" @@ -106,9 +105,6 @@ func TestNodeAuthorizer(t *testing.T) { masterConfig.GenericConfig.Authorizer = nodeRBACAuthorizer masterConfig.GenericConfig.AdmissionControl = nodeRestrictionAdmission - // enable testing volume attachments - masterConfig.ExtraConfig.APIResourceConfigSource.(*serverstorage.ResourceConfig).EnableVersions(storagev1alpha1.SchemeGroupVersion) - _, _, closeFn := framework.RunAMasterUsingServer(masterConfig, apiServer, h) defer closeFn() @@ -140,11 +136,11 @@ func TestNodeAuthorizer(t *testing.T) { t.Fatal(err) } pvName := "mypv" - if _, err := superuserClientExternal.StorageV1alpha1().VolumeAttachments().Create(&storagev1alpha1.VolumeAttachment{ + if _, err := superuserClientExternal.StorageV1beta1().VolumeAttachments().Create(&storagev1beta1.VolumeAttachment{ ObjectMeta: metav1.ObjectMeta{Name: "myattachment"}, - Spec: storagev1alpha1.VolumeAttachmentSpec{ + Spec: storagev1beta1.VolumeAttachmentSpec{ Attacher: "foo", - Source: storagev1alpha1.VolumeAttachmentSource{PersistentVolumeName: &pvName}, + Source: storagev1beta1.VolumeAttachmentSource{PersistentVolumeName: &pvName}, NodeName: "node2", }, }); err != nil { @@ -204,7 +200,7 @@ func TestNodeAuthorizer(t *testing.T) { } getVolumeAttachment := func(client externalclientset.Interface) func() error { return func() error { - _, err := client.StorageV1alpha1().VolumeAttachments().Get("myattachment", metav1.GetOptions{}) + _, err := client.StorageV1beta1().VolumeAttachments().Get("myattachment", metav1.GetOptions{}) return err } } diff --git a/test/integration/etcd/etcd_storage_path_test.go b/test/integration/etcd/etcd_storage_path_test.go index 480cbfd8483..505cfc0bf89 100644 --- a/test/integration/etcd/etcd_storage_path_test.go +++ b/test/integration/etcd/etcd_storage_path_test.go @@ -298,6 +298,7 @@ var etcdStorageData = map[schema.GroupVersionResource]struct { 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"), }, // -- diff --git a/test/integration/framework/master_utils.go b/test/integration/framework/master_utils.go index 27c9ef5cc2f..807c902c9e9 100644 --- a/test/integration/framework/master_utils.go +++ b/test/integration/framework/master_utils.go @@ -236,9 +236,9 @@ func NewMasterConfig() *master.Config { // we need to set both for the whole group and for cronjobs, separately resourceEncoding.SetVersionEncoding(batch.GroupName, *testapi.Batch.GroupVersion(), schema.GroupVersion{Group: batch.GroupName, Version: runtime.APIVersionInternal}) resourceEncoding.SetResourceEncoding(schema.GroupResource{Group: batch.GroupName, Resource: "cronjobs"}, schema.GroupVersion{Group: batch.GroupName, Version: "v1beta1"}, schema.GroupVersion{Group: batch.GroupName, Version: runtime.APIVersionInternal}) - // volumeattachments only exist in storage.k8s.io/v1alpha1 + // we also need to set both for the storage group and for volumeattachments, separately resourceEncoding.SetVersionEncoding(storage.GroupName, *testapi.Storage.GroupVersion(), schema.GroupVersion{Group: storage.GroupName, Version: runtime.APIVersionInternal}) - resourceEncoding.SetResourceEncoding(schema.GroupResource{Group: storage.GroupName, Resource: "volumeattachments"}, schema.GroupVersion{Group: storage.GroupName, Version: "v1alpha1"}, schema.GroupVersion{Group: storage.GroupName, Version: runtime.APIVersionInternal}) + resourceEncoding.SetResourceEncoding(schema.GroupResource{Group: storage.GroupName, Resource: "volumeattachments"}, schema.GroupVersion{Group: storage.GroupName, Version: "v1beta1"}, schema.GroupVersion{Group: storage.GroupName, Version: runtime.APIVersionInternal}) storageFactory := serverstorage.NewDefaultStorageFactory(etcdOptions.StorageConfig, runtime.ContentTypeJSON, ns, resourceEncoding, master.DefaultAPIResourceConfigSource(), nil) storageFactory.SetSerializer(