mirror of https://github.com/k3s-io/k3s
Always create volumes in the active k8s zone
parent
ffadd5533a
commit
6a4153fc0a
|
@ -75,6 +75,10 @@ func main() {
|
|||
|
||||
if *provider == "aws" {
|
||||
awsConfig := "[Global]\n"
|
||||
if *gceZone == "" {
|
||||
glog.Error("gce_zone must be specified for AWS")
|
||||
os.Exit(1)
|
||||
}
|
||||
awsConfig += fmt.Sprintf("Zone=%s\n", *gceZone)
|
||||
|
||||
var err error
|
||||
|
|
|
@ -64,7 +64,6 @@ type AWSMetadata interface {
|
|||
|
||||
type VolumeOptions struct {
|
||||
CapacityMB int
|
||||
Zone string
|
||||
}
|
||||
|
||||
// Volumes is an interface for managing cloud-provisioned volumes
|
||||
|
@ -241,9 +240,9 @@ func newAWSCloud(config io.Reader, authFunc AuthFunc, instanceId string, metadat
|
|||
ec2 := &goamzEC2{ec2: ec2.New(auth, region)}
|
||||
|
||||
awsCloud := &AWSCloud{
|
||||
ec2: ec2,
|
||||
cfg: cfg,
|
||||
region: region,
|
||||
ec2: ec2,
|
||||
cfg: cfg,
|
||||
region: region,
|
||||
availabilityZone: zone,
|
||||
}
|
||||
|
||||
|
@ -894,7 +893,7 @@ func (aws *AWSCloud) DetachDisk(instanceName string, diskName string) error {
|
|||
// Implements Volumes.CreateVolume
|
||||
func (aws *AWSCloud) CreateVolume(volumeOptions *VolumeOptions) (string, error) {
|
||||
request := &ec2.CreateVolume{}
|
||||
request.AvailZone = volumeOptions.Zone
|
||||
request.AvailZone = aws.availabilityZone
|
||||
request.Size = (int64(volumeOptions.CapacityMB) + 1023) / 1024
|
||||
response, err := aws.ec2.CreateVolume(request)
|
||||
if err != nil {
|
||||
|
|
|
@ -193,7 +193,6 @@ func createPD() (string, error) {
|
|||
}
|
||||
volumeOptions := &aws_cloud.VolumeOptions{}
|
||||
volumeOptions.CapacityMB = 10 * 1024
|
||||
volumeOptions.Zone = testContext.cloudConfig.Zone
|
||||
return volumes.CreateVolume(volumeOptions)
|
||||
} else {
|
||||
return "", fmt.Errorf("Unsupported provider type")
|
||||
|
|
Loading…
Reference in New Issue