mirror of https://github.com/kubernetes/kops.git
move --no-associate-public-ip to instance group
This commit is contained in:
parent
0c96f5dd1d
commit
fad3d3a4f4
|
@ -15,25 +15,25 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateClusterCmd struct {
|
type CreateClusterCmd struct {
|
||||||
Yes bool
|
Yes bool
|
||||||
Target string
|
Target string
|
||||||
Models string
|
Models string
|
||||||
Cloud string
|
Cloud string
|
||||||
Zones string
|
Zones string
|
||||||
MasterZones string
|
MasterZones string
|
||||||
NodeSize string
|
NodeSize string
|
||||||
MasterSize string
|
MasterSize string
|
||||||
NodeCount int
|
NodeCount int
|
||||||
Project string
|
Project string
|
||||||
KubernetesVersion string
|
KubernetesVersion string
|
||||||
OutDir string
|
OutDir string
|
||||||
Image string
|
Image string
|
||||||
SSHPublicKey string
|
SSHPublicKey string
|
||||||
VPCID string
|
VPCID string
|
||||||
NetworkCIDR string
|
NetworkCIDR string
|
||||||
DNSZone string
|
DNSZone string
|
||||||
AdminAccess string
|
AdminAccess string
|
||||||
NoPublicIP bool
|
NoAssociatePublicIP bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var createCluster CreateClusterCmd
|
var createCluster CreateClusterCmd
|
||||||
|
@ -82,7 +82,7 @@ func init() {
|
||||||
cmd.Flags().StringVar(&createCluster.OutDir, "out", "", "Path to write any local output")
|
cmd.Flags().StringVar(&createCluster.OutDir, "out", "", "Path to write any local output")
|
||||||
cmd.Flags().StringVar(&createCluster.AdminAccess, "admin-access", "", "Restrict access to admin endpoints (SSH, HTTPS) to this CIDR. If not set, access will not be restricted by IP.")
|
cmd.Flags().StringVar(&createCluster.AdminAccess, "admin-access", "", "Restrict access to admin endpoints (SSH, HTTPS) to this CIDR. If not set, access will not be restricted by IP.")
|
||||||
|
|
||||||
cmd.Flags().BoolVar(&createCluster.NoPublicIP, "no-public-ip", false, "Specify --no-public-ip to disable association of public IP for master ASG and nodes.")
|
cmd.Flags().BoolVar(&createCluster.NoAssociatePublicIP, "no-associate-public-ip", false, "Specify --no-associate-public-ip to disable association of public IP for master ASG and nodes.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CreateClusterCmd) Run(args []string) error {
|
func (c *CreateClusterCmd) Run(args []string) error {
|
||||||
|
@ -243,6 +243,10 @@ func (c *CreateClusterCmd) Run(args []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, group := range instanceGroups {
|
||||||
|
group.Spec.AssociatePublicIP = fi.Bool(!c.NoAssociatePublicIP)
|
||||||
|
}
|
||||||
|
|
||||||
if c.NodeCount != 0 {
|
if c.NodeCount != 0 {
|
||||||
for _, group := range nodes {
|
for _, group := range nodes {
|
||||||
group.Spec.MinSize = fi.Int(c.NodeCount)
|
group.Spec.MinSize = fi.Int(c.NodeCount)
|
||||||
|
@ -357,12 +361,6 @@ func (c *CreateClusterCmd) Run(args []string) error {
|
||||||
fmt.Println("Previewing changes that will be made:\n")
|
fmt.Println("Previewing changes that will be made:\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.NoPublicIP {
|
|
||||||
fullCluster.Spec.AssociatePublicIP = fi.Bool(false);
|
|
||||||
} else {
|
|
||||||
fullCluster.Spec.AssociatePublicIP = fi.Bool(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
applyCmd := &cloudup.ApplyClusterCmd{
|
applyCmd := &cloudup.ApplyClusterCmd{
|
||||||
Cluster: fullCluster,
|
Cluster: fullCluster,
|
||||||
InstanceGroups: fullInstanceGroups,
|
InstanceGroups: fullInstanceGroups,
|
||||||
|
|
|
@ -8,7 +8,7 @@ launchConfiguration/{{ $m.Name }}.masters.{{ ClusterName }}:
|
||||||
iamInstanceProfile: iamInstanceProfile/masters.{{ ClusterName }}
|
iamInstanceProfile: iamInstanceProfile/masters.{{ ClusterName }}
|
||||||
imageId: {{ $m.Spec.Image }}
|
imageId: {{ $m.Spec.Image }}
|
||||||
instanceType: {{ $m.Spec.MachineType }}
|
instanceType: {{ $m.Spec.MachineType }}
|
||||||
associatePublicIP: {{ AssociatePublicIP }}
|
associatePublicIP: {{ $m.Spec.AssociatePublicIP }}
|
||||||
userData: resources/nodeup.sh _kubernetes_master
|
userData: resources/nodeup.sh _kubernetes_master
|
||||||
rootVolumeSize: {{ or $m.Spec.RootVolumeSize "20" }}
|
rootVolumeSize: {{ or $m.Spec.RootVolumeSize "20" }}
|
||||||
rootVolumeType: {{ or $m.Spec.RootVolumeType "gp2" }}
|
rootVolumeType: {{ or $m.Spec.RootVolumeType "gp2" }}
|
||||||
|
|
|
@ -52,7 +52,7 @@ launchConfiguration/{{ $nodeset.Name }}.{{ ClusterName }}:
|
||||||
iamInstanceProfile: iamInstanceProfile/nodes.{{ ClusterName }}
|
iamInstanceProfile: iamInstanceProfile/nodes.{{ ClusterName }}
|
||||||
imageId: {{ $nodeset.Spec.Image }}
|
imageId: {{ $nodeset.Spec.Image }}
|
||||||
instanceType: {{ $nodeset.Spec.MachineType }}
|
instanceType: {{ $nodeset.Spec.MachineType }}
|
||||||
associatePublicIP: {{ AssociatePublicIP }}
|
associatePublicIP: {{ $nodeset.Spec.AssociatePublicIP }}
|
||||||
userData: resources/nodeup.sh _kubernetes_pool
|
userData: resources/nodeup.sh _kubernetes_pool
|
||||||
rootVolumeSize: {{ or $nodeset.Spec.RootVolumeSize "20" }}
|
rootVolumeSize: {{ or $nodeset.Spec.RootVolumeSize "20" }}
|
||||||
rootVolumeType: {{ or $nodeset.Spec.RootVolumeType "gp2" }}
|
rootVolumeType: {{ or $nodeset.Spec.RootVolumeType "gp2" }}
|
||||||
|
|
|
@ -103,8 +103,6 @@ type ClusterSpec struct {
|
||||||
// * enable debugging handlers on the master, so kubectl logs works
|
// * enable debugging handlers on the master, so kubectl logs works
|
||||||
IsolateMasters *bool `json:"isolateMasters,omitempty"`
|
IsolateMasters *bool `json:"isolateMasters,omitempty"`
|
||||||
|
|
||||||
AssociatePublicIP *bool `json:"associatePublicIp,omitempty"`
|
|
||||||
|
|
||||||
//NetworkProvider string `json:",omitempty"`
|
//NetworkProvider string `json:",omitempty"`
|
||||||
//
|
//
|
||||||
//HairpinMode string `json:",omitempty"`
|
//HairpinMode string `json:",omitempty"`
|
||||||
|
|
|
@ -44,6 +44,8 @@ type InstanceGroupSpec struct {
|
||||||
|
|
||||||
// MaxPrice indicates this is a spot-pricing group, with the specified value as our max-price bid
|
// MaxPrice indicates this is a spot-pricing group, with the specified value as our max-price bid
|
||||||
MaxPrice *string `json:"maxPrice,omitempty"`
|
MaxPrice *string `json:"maxPrice,omitempty"`
|
||||||
|
|
||||||
|
AssociatePublicIP *bool `json:"associatePublicIp,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PerformAssignmentsInstanceGroups populates InstanceGroups with default values
|
// PerformAssignmentsInstanceGroups populates InstanceGroups with default values
|
||||||
|
|
|
@ -230,9 +230,7 @@ func (c *ApplyClusterCmd) Run() error {
|
||||||
|
|
||||||
// Autoscaling
|
// Autoscaling
|
||||||
"autoscalingGroup": &awstasks.AutoscalingGroup{},
|
"autoscalingGroup": &awstasks.AutoscalingGroup{},
|
||||||
"launchConfiguration": &awstasks.LaunchConfiguration{
|
"launchConfiguration": &awstasks.LaunchConfiguration{},
|
||||||
AssociatePublicIP: c.Cluster.Spec.AssociatePublicIP,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Route53
|
// Route53
|
||||||
"dnsName": &awstasks.DNSName{},
|
"dnsName": &awstasks.DNSName{},
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
"k8s.io/kops/upup/pkg/fi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TemplateFunctions struct {
|
type TemplateFunctions struct {
|
||||||
|
@ -79,9 +78,6 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap) {
|
||||||
dest["IAMPrefix"] = tf.IAMPrefix
|
dest["IAMPrefix"] = tf.IAMPrefix
|
||||||
dest["IAMServiceEC2"] = tf.IAMServiceEC2
|
dest["IAMServiceEC2"] = tf.IAMServiceEC2
|
||||||
|
|
||||||
dest["AssociatePublicIP"] = func() bool {
|
|
||||||
return fi.BoolValue(tf.cluster.Spec.AssociatePublicIP)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tf *TemplateFunctions) EtcdClusterMemberTags(etcd *api.EtcdClusterSpec, m *api.EtcdMemberSpec) map[string]string {
|
func (tf *TemplateFunctions) EtcdClusterMemberTags(etcd *api.EtcdClusterSpec, m *api.EtcdMemberSpec) map[string]string {
|
||||||
|
|
Loading…
Reference in New Issue