Added the --ssh-access flag to specify the sshAccess on cluster creation from the cli

This commit is contained in:
Bradley 2017-07-20 21:46:15 +01:00
parent 5938e4f8dd
commit f7979692b1
1 changed files with 10 additions and 2 deletions

View File

@ -72,6 +72,7 @@ type CreateClusterOptions struct {
NetworkCIDR string
DNSZone string
AdminAccess []string
SSHAccess []string
Networking string
NodeSecurityGroups []string
MasterSecurityGroups []string
@ -250,7 +251,8 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
cmd.Flags().StringVar(&options.DNSZone, "dns-zone", options.DNSZone, "DNS hosted zone to use (defaults to longest matching zone)")
cmd.Flags().StringVar(&options.OutDir, "out", options.OutDir, "Path to write any local output")
cmd.Flags().StringSliceVar(&options.AdminAccess, "admin-access", options.AdminAccess, "Restrict access to admin endpoints (SSH, HTTPS) to this CIDR. If not set, access will not be restricted by IP.")
cmd.Flags().StringSliceVar(&options.AdminAccess, "admin-access", options.AdminAccess, "Restrict API access to this CIDR. If not set, access will not be restricted by IP.")
cmd.Flags().StringSliceVar(&options.SSHAccess, "ssh-access", options.SSHAccess, "Restrict SSH access to this CIDR. If not set, access will not be restricted by IP.")
// TODO: Can we deprecate this flag - it is awkward?
cmd.Flags().BoolVar(&associatePublicIP, "associate-public-ip", false, "Specify --associate-public-ip=[true|false] to enable/disable association of public IP for master ASG and nodes. Default is 'true'.")
@ -843,7 +845,13 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e
}
if len(c.AdminAccess) != 0 {
cluster.Spec.SSHAccess = c.AdminAccess
if len(c.SSHAccess) != 0 {
glog.Infof("SSHAccess set to: %s", c.SSHAccess)
cluster.Spec.SSHAccess = c.SSHAccess
} else {
glog.Infof("SSHAccess set to: %s", c.SSHAccess)
cluster.Spec.SSHAccess = c.AdminAccess
}
cluster.Spec.KubernetesAPIAccess = c.AdminAccess
}