Skip to content

Commit

Permalink
Add kubernetes enable-firewall flag on create (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
optik-aper authored Feb 26, 2024
1 parent eccfc2d commit 30dfcfd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ func NewCmdKubernetes(base *cli.Base) *cobra.Command { //nolint:funlen,gocyclo
return fmt.Errorf("error parsing flag 'high-avail' for kubernetes cluster create : %v", errHi)
}

fw, errFw := cmd.Flags().GetBool("enable-firewall")
if errHi != nil {
return fmt.Errorf("error parsing flag 'enable-firewall' for kubernetes cluster create : %v", errFw)
}

nps, errFm := formatNodePools(nodepools)
if errFm != nil {
return fmt.Errorf("error in node pool formating : %v", errFm)
Expand All @@ -346,6 +351,7 @@ func NewCmdKubernetes(base *cli.Base) *cobra.Command { //nolint:funlen,gocyclo
NodePools: nps,
Version: version,
HAControlPlanes: ha,
EnableFirewall: fw,
}

k8, err := o.create()
Expand Down Expand Up @@ -385,6 +391,13 @@ func NewCmdKubernetes(base *cli.Base) *cobra.Command { //nolint:funlen,gocyclo
highly available, control planes`,
)

create.Flags().BoolP(
"enable-firewall",
"f",
false,
`(optional, default false) whether a firewall group should be created for the cluster`,
)

create.Flags().StringArrayP(
"node-pools",
"n",
Expand Down
2 changes: 2 additions & 0 deletions cmd/kubernetes/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (c *ClustersPrinter) Data() [][]string {
[]string{"IP", c.Clusters[i].IP},
[]string{"ENDPOINT", c.Clusters[i].Endpoint},
[]string{"HIGH AVAIL", strconv.FormatBool(c.Clusters[i].HAControlPlanes)},
[]string{"FIREWALL GROUP ID", c.Clusters[i].FirewallGroupID},
[]string{"VERSION", c.Clusters[i].Version},
[]string{"REGION", c.Clusters[i].Region},
[]string{"STATUS", c.Clusters[i].Status},
Expand Down Expand Up @@ -197,6 +198,7 @@ func (c *ClusterPrinter) Data() [][]string {
[]string{"IP", c.Cluster.IP},
[]string{"ENDPOINT", c.Cluster.Endpoint},
[]string{"HIGH AVAIL", strconv.FormatBool(c.Cluster.HAControlPlanes)},
[]string{"FIREWALL GROUP ID", c.Cluster.FirewallGroupID},
[]string{"VERSION", c.Cluster.Version},
[]string{"REGION", c.Cluster.Region},
[]string{"STATUS", c.Cluster.Status},
Expand Down

0 comments on commit 30dfcfd

Please sign in to comment.