Merge pull request #57604 from ianchakeres/lv-prov-config

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Update local-volume e2e test for new provisioner config format

**What this PR does / why we need it**: 

The local-volume bootstrapper/provisioner configuration format changed in
https://github.com/kubernetes-incubator/external-storage/pull/352

This PR updates the provisioner config, so that the existing e2e test continues to function.

**Which issue(s) this PR fixes** : 
Fixes https://github.com/kubernetes/kubernetes/issues/57664

**Special notes for your reviewer**:
The image tag for the provisioner and bootstrapper have been changed to v2.0.0.

**Release note**:
```NONE

```
This commit is contained in:
Kubernetes Submit Queue 2017-12-27 13:13:15 -08:00 committed by GitHub
commit 99d3e21eb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View File

@ -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",

View File

@ -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)