mirror of https://github.com/kubernetes/kops.git
Ensure GCE disk name does not start with a number
As this could not have worked before, we don't have to worry about compatability with existing users.
This commit is contained in:
parent
752c7bd96d
commit
ec4a916f62
|
|
@ -194,7 +194,11 @@ func (b *MasterVolumeBuilder) addGCEVolume(c *fi.ModelBuilderContext, name strin
|
|||
tags[gce.GceLabelNameRolePrefix+"master"] = "master" // Can't start with a number
|
||||
tags[gce.GceLabelNameEtcdClusterPrefix+etcd.Name] = gce.EncodeGCELabel(clusterSpec)
|
||||
|
||||
// GCE disk names must match the following regular expression: '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?'
|
||||
name = strings.Replace(name, ".", "-", -1)
|
||||
if strings.IndexByte("0123456789-", name[0]) != -1 {
|
||||
name = "d" + name
|
||||
}
|
||||
|
||||
t := &gcetasks.Disk{
|
||||
Name: s(name),
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@ spec:
|
|||
etcdClusters:
|
||||
- etcdMembers:
|
||||
- instanceGroup: master-us-test1-a
|
||||
name: a
|
||||
name: "1"
|
||||
- instanceGroup: master-us-test1-b
|
||||
name: b
|
||||
name: "2"
|
||||
- instanceGroup: master-us-test1-c
|
||||
name: c
|
||||
name: "3"
|
||||
name: main
|
||||
- etcdMembers:
|
||||
- instanceGroup: master-us-test1-a
|
||||
name: a
|
||||
name: "1"
|
||||
- instanceGroup: master-us-test1-b
|
||||
name: b
|
||||
name: "2"
|
||||
- instanceGroup: master-us-test1-c
|
||||
name: c
|
||||
name: "3"
|
||||
name: events
|
||||
iam:
|
||||
legacy: false
|
||||
|
|
|
|||
|
|
@ -15,43 +15,43 @@ provider "google" {
|
|||
region = "us-test1"
|
||||
}
|
||||
|
||||
resource "google_compute_disk" "a-etcd-events-ha-gce-example-com" {
|
||||
name = "a-etcd-events-ha-gce-example-com"
|
||||
resource "google_compute_disk" "d1-etcd-events-ha-gce-example-com" {
|
||||
name = "d1-etcd-events-ha-gce-example-com"
|
||||
type = "pd-ssd"
|
||||
size = 20
|
||||
zone = "us-test1-a"
|
||||
}
|
||||
|
||||
resource "google_compute_disk" "a-etcd-main-ha-gce-example-com" {
|
||||
name = "a-etcd-main-ha-gce-example-com"
|
||||
resource "google_compute_disk" "d1-etcd-main-ha-gce-example-com" {
|
||||
name = "d1-etcd-main-ha-gce-example-com"
|
||||
type = "pd-ssd"
|
||||
size = 20
|
||||
zone = "us-test1-a"
|
||||
}
|
||||
|
||||
resource "google_compute_disk" "b-etcd-events-ha-gce-example-com" {
|
||||
name = "b-etcd-events-ha-gce-example-com"
|
||||
resource "google_compute_disk" "d2-etcd-events-ha-gce-example-com" {
|
||||
name = "d2-etcd-events-ha-gce-example-com"
|
||||
type = "pd-ssd"
|
||||
size = 20
|
||||
zone = "us-test1-b"
|
||||
}
|
||||
|
||||
resource "google_compute_disk" "b-etcd-main-ha-gce-example-com" {
|
||||
name = "b-etcd-main-ha-gce-example-com"
|
||||
resource "google_compute_disk" "d2-etcd-main-ha-gce-example-com" {
|
||||
name = "d2-etcd-main-ha-gce-example-com"
|
||||
type = "pd-ssd"
|
||||
size = 20
|
||||
zone = "us-test1-b"
|
||||
}
|
||||
|
||||
resource "google_compute_disk" "c-etcd-events-ha-gce-example-com" {
|
||||
name = "c-etcd-events-ha-gce-example-com"
|
||||
resource "google_compute_disk" "d3-etcd-events-ha-gce-example-com" {
|
||||
name = "d3-etcd-events-ha-gce-example-com"
|
||||
type = "pd-ssd"
|
||||
size = 20
|
||||
zone = "us-test1-c"
|
||||
}
|
||||
|
||||
resource "google_compute_disk" "c-etcd-main-ha-gce-example-com" {
|
||||
name = "c-etcd-main-ha-gce-example-com"
|
||||
resource "google_compute_disk" "d3-etcd-main-ha-gce-example-com" {
|
||||
name = "d3-etcd-main-ha-gce-example-com"
|
||||
type = "pd-ssd"
|
||||
size = 20
|
||||
zone = "us-test1-c"
|
||||
|
|
|
|||
Loading…
Reference in New Issue