Merge pull request #113 from justinsb/upup_polish_6

upup: more polish
This commit is contained in:
Justin Santa Barbara 2016-06-15 14:04:38 -04:00 committed by GitHub
commit 1a7f157fcb
5 changed files with 46 additions and 14 deletions

View File

@ -53,16 +53,16 @@ spec:
containerPort: {{ .ClientPort }}
hostPort: {{ .ClientPort }}
volumeMounts:
- mountPath: /var/etcd
name: varetcd
- mountPath: /var/etcd/{{ .DataDirName }}
name: varetcddata
readOnly: false
- mountPath: /var/log/etcd.log
name: varlogetcd
readOnly: false
volumes:
- name: varetcd
- name: varetcddata
hostPath:
path: /mnt/master-pd/var/{{ .DataDirName }}
path: /mnt/master-pd/var/etcd/{{ .DataDirName }}
- name: varlogetcd
hostPath:
path: {{ .LogFile }}

View File

@ -67,7 +67,11 @@ func (e *InternetGateway) Find(c *fi.Context) (*InternetGateway, error) {
actual.VPC = &VPC{ID: attachment.VpcId}
}
e.ID = actual.ID
// Prevent spurious comparison failures
actual.Shared = e.Shared
if e.ID == nil {
e.ID = actual.ID
}
return actual, nil
}

View File

@ -124,6 +124,10 @@ func subnetSlicesEqualIgnoreOrder(l, r []*Subnet) bool {
}
var rIDs []string
for _, s := range r {
if s.ID == nil {
glog.V(4).Infof("Subnet ID not set; returning not-equal: %v", s)
return false
}
rIDs = append(rIDs, *s.ID)
}
return utils.StringSlicesEqualIgnoreOrder(lIDs, rIDs)

View File

@ -59,7 +59,6 @@ func (e *VPC) Find(c *fi.Context) (*VPC, error) {
}
glog.V(4).Infof("found matching VPC %v", actual)
e.ID = actual.ID
if actual.ID != nil {
request := &ec2.DescribeVpcAttributeInput{VpcId: actual.ID, Attribute: aws.String(ec2.VpcAttributeNameEnableDnsSupport)}
@ -79,6 +78,12 @@ func (e *VPC) Find(c *fi.Context) (*VPC, error) {
actual.EnableDNSHostnames = response.EnableDnsHostnames.Value
}
// Prevent spurious comparison failures
actual.Shared = e.Shared
if e.ID == nil {
e.ID = actual.ID
}
return actual, nil
}

View File

@ -222,15 +222,32 @@ func (z *ZoneConfig) performAssignments(c *CloudConfig) error {
func (z *ZoneConfig) assignCIDR(c *CloudConfig) (string, error) {
// TODO: We probably could query for the existing subnets & allocate appropriately
// for now we'll require users to set CIDRs themselves
index := -1
for i, z := range c.NodeZones {
if z.Name == z.Name {
index = i
break
}
lastCharMap := make(map[byte]bool)
for _, nodeZone := range c.NodeZones {
lastChar := nodeZone.Name[len(nodeZone.Name)-1]
lastCharMap[lastChar] = true
}
if index == -1 {
return "", fmt.Errorf("zone not configured: %q", z.Name)
index := -1
if len(lastCharMap) == len(c.NodeZones) {
// Last char of zones are unique (GCE, AWS)
// At least on AWS, we also want 'a' to be 1, so that we don't collide with the lowest range,
// because kube-up uses that range
index = int(z.Name[len(z.Name)-1])
} else {
glog.Warningf("Last char of zone names not unique")
for i, nodeZone := range c.NodeZones {
if nodeZone.Name == z.Name {
index = i
break
}
}
if index == -1 {
return "", fmt.Errorf("zone not configured: %q", z.Name)
}
}
_, cidr, err := net.ParseCIDR(c.NetworkCIDR)
@ -241,6 +258,8 @@ func (z *ZoneConfig) assignCIDR(c *CloudConfig) (string, error) {
// We assume a maximum of 8 subnets per network
// TODO: Does this make sense on GCE?
// TODO: Should we limit this to say 1000 IPs per subnet? (any reason to?)
index = index % 8
networkLength += 3
ip4 := cidr.IP.To4()