Skip to content

Commit

Permalink
sks: flag for CSI addon (#572)
Browse files Browse the repository at this point in the history
We add the flag `--exoscale-csi` to the `exo compute sks create`
command. If set, a cluster with the CSI addon will be created. Unlike
the `CCM` and `metrics-server` addons which have to be explicitly
disabled with a `--no-...` flag, the CSI addon has to be explicitly
enabled because for some users may not need it.
  • Loading branch information
sauterp authored Apr 2, 2024
1 parent 84ef254 commit 897fead
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features
- sks: flag for CSI addon #572

### Improvements
- Instance reset password: remove wrong "rm" alias #583

### Deprecations
Expand Down
27 changes: 14 additions & 13 deletions cmd/sks_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var (
defaultSKSClusterCNI = "calico"
defaultSKSClusterServiceLevel = "pro"
sksClusterAddonExoscaleCCM = "exoscale-cloud-controller"
sksClusterAddonExoscaleCSI = "exoscale-container-storage-interface"
sksClusterAddonMetricsServer = "metrics-server"
)

Expand All @@ -37,6 +38,7 @@ type sksCreateCmd struct {
NoCNI bool `cli-usage:"do not deploy a default Container Network Interface plugin in the cluster control plane"`
NoExoscaleCCM bool `cli-usage:"do not deploy the Exoscale Cloud Controller Manager in the cluster control plane"`
NoMetricsServer bool `cli-usage:"do not deploy the Kubernetes Metrics Server in the cluster control plane"`
ExoscaleCSI bool `cli-usage:"deploy the Exoscale Container Storage Interface on worker nodes"`
NodepoolAntiAffinityGroups []string `cli-flag:"nodepool-anti-affinity-group" cli-usage:"default Nodepool Anti-Affinity Group NAME|ID (can be specified multiple times)"`
NodepoolDeployTarget string `cli-usage:"default Nodepool Deploy Target NAME|ID"`
NodepoolDescription string `cli-usage:"default Nodepool description"`
Expand Down Expand Up @@ -110,24 +112,23 @@ func (c *sksCreateCmd) cmdRun(_ *cobra.Command, _ []string) error { //nolint:goc
cluster.CNI = nil
}

addOns := map[string]struct{}{
sksClusterAddonExoscaleCCM: {},
sksClusterAddonMetricsServer: {},
}
cluster.AddOns = func() (v *[]string) {
if c.NoExoscaleCCM {
delete(addOns, sksClusterAddonExoscaleCCM)
addOns := make([]string, 0)

if !c.NoExoscaleCCM {
addOns = append(addOns, sksClusterAddonExoscaleCCM)
}

if !c.NoMetricsServer {
addOns = append(addOns, sksClusterAddonMetricsServer)
}
if c.NoMetricsServer {
delete(addOns, sksClusterAddonMetricsServer)

if c.ExoscaleCSI {
addOns = append(addOns, sksClusterAddonExoscaleCSI)
}

if len(addOns) > 0 {
list := make([]string, 0)
for k := range addOns {
list = append(list, k)
}
v = &list
v = &addOns
}
return
}()
Expand Down

0 comments on commit 897fead

Please sign in to comment.