From 3087a10b7b3e7d46a9480b9d166757e1a4dd3d1c Mon Sep 17 00:00:00 2001 From: Ian Chakeres Date: Sat, 23 Dec 2017 20:06:34 -0800 Subject: [PATCH] Updated local-volume boostrapper/provisioner e2e test for new config format The local-volume bootstrapper/provisioner configuration format changed in https://github.com/kubernetes-incubator/external-storage/pull/352 This format is exposed in v2.0.0 of the provisioner and boostratpper images. This PR updates the e2e test config, so that the existing tests continue to work. --- test/e2e/storage/BUILD | 1 + test/e2e/storage/persistent_volumes-local.go | 30 ++++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/test/e2e/storage/BUILD b/test/e2e/storage/BUILD index f7c76328535..1aa80260956 100644 --- a/test/e2e/storage/BUILD +++ b/test/e2e/storage/BUILD @@ -40,6 +40,7 @@ go_library( "//vendor/github.com/aws/aws-sdk-go/aws:go_default_library", "//vendor/github.com/aws/aws-sdk-go/aws/session:go_default_library", "//vendor/github.com/aws/aws-sdk-go/service/ec2:go_default_library", + "//vendor/github.com/ghodss/yaml:go_default_library", "//vendor/github.com/onsi/ginkgo:go_default_library", "//vendor/github.com/onsi/gomega:go_default_library", "//vendor/google.golang.org/api/googleapi:go_default_library", diff --git a/test/e2e/storage/persistent_volumes-local.go b/test/e2e/storage/persistent_volumes-local.go index 4c09ed26099..70c4fcbb1cb 100644 --- a/test/e2e/storage/persistent_volumes-local.go +++ b/test/e2e/storage/persistent_volumes-local.go @@ -17,7 +17,6 @@ limitations under the License. package storage import ( - "encoding/json" "fmt" "math/rand" "path" @@ -26,6 +25,7 @@ import ( "strings" "time" + "github.com/ghodss/yaml" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -118,8 +118,8 @@ const ( // volumeConfigName is the configmap passed to bootstrapper and provisioner volumeConfigName = "local-volume-config" // bootstrapper and provisioner images used for e2e tests - bootstrapperImageName = "quay.io/external_storage/local-volume-provisioner-bootstrap:v1.0.1" - provisionerImageName = "quay.io/external_storage/local-volume-provisioner:v1.0.1" + bootstrapperImageName = "quay.io/external_storage/local-volume-provisioner-bootstrap:v2.0.0" + provisionerImageName = "quay.io/external_storage/local-volume-provisioner:v2.0.0" // provisioner daemonSetName name, must match the one defined in bootstrapper daemonSetName = "local-volume-provisioner" // provisioner node/pv cluster role binding, must match the one defined in bootstrapper @@ -959,12 +959,24 @@ func deleteClusterRoleBinding(config *localTestConfig) { } func createVolumeConfigMap(config *localTestConfig) { - mountConfig := struct { - HostDir string `json:"hostDir"` - }{ - HostDir: path.Join(hostBase, discoveryDir), + // MountConfig and ProvisionerConfiguration from + // https://github.com/kubernetes-incubator/external-storage/blob/master/local-volume/provisioner/pkg/common/common.go + type MountConfig struct { + // The hostpath directory + HostDir string `json:"hostDir" yaml:"hostDir"` } - data, err := json.Marshal(&mountConfig) + type ProvisionerConfiguration struct { + // StorageClassConfig defines configuration of Provisioner's storage classes + StorageClassConfig map[string]MountConfig `json:"storageClassMap" yaml:"storageClassMap"` + } + var provisionerConfig ProvisionerConfiguration + provisionerConfig.StorageClassConfig = map[string]MountConfig{ + config.scName: { + HostDir: path.Join(hostBase, discoveryDir), + }, + } + + data, err := yaml.Marshal(&provisionerConfig.StorageClassConfig) Expect(err).NotTo(HaveOccurred()) configMap := v1.ConfigMap{ @@ -977,7 +989,7 @@ func createVolumeConfigMap(config *localTestConfig) { Namespace: config.ns, }, Data: map[string]string{ - config.scName: string(data), + "storageClassMap": string(data), }, } _, err = config.client.CoreV1().ConfigMaps(config.ns).Create(&configMap)