Skip to content

Commit 080706d

Browse files
authored
feat(k8s): add k8s in available namespace (#746)
1 parent 012978d commit 080706d

14 files changed

Lines changed: 310 additions & 0 deletions

cmd/scw/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
configNamespace "github.com/scaleway/scaleway-cli/internal/namespaces/config"
1212
initNamespace "github.com/scaleway/scaleway-cli/internal/namespaces/init"
1313
"github.com/scaleway/scaleway-cli/internal/namespaces/instance/v1"
14+
k8s "github.com/scaleway/scaleway-cli/internal/namespaces/k8s/v1beta4"
1415
"github.com/scaleway/scaleway-cli/internal/namespaces/marketplace/v1"
1516
versionNamespace "github.com/scaleway/scaleway-cli/internal/namespaces/version"
1617
"github.com/scaleway/scaleway-cli/internal/sentry"
@@ -38,6 +39,7 @@ func getCommands() *core.Commands {
3839
// NB: Merge order impacts scw usage sort.
3940
commands := core.NewCommands()
4041
commands.Merge(instance.GetCommands())
42+
commands.Merge(k8s.GetCommands())
4143
commands.Merge(marketplace.GetCommands())
4244
commands.Merge(initNamespace.GetCommands())
4345
commands.Merge(configNamespace.GetCommands())
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
This method allows to create a new Kubernetes cluster on an account.
2+
3+
USAGE:
4+
scw [global-flags] k8s cluster create [flags] [arg=value ...]
5+
6+
ARGS:
7+
name The name of the cluster
8+
[description] The description of the cluster
9+
[tags.{index}] The tags associated with the cluster
10+
version The Kubernetes version of the cluster
11+
cni The Container Network Interface (CNI) plugin that will run in the cluster (unknown_cni | cilium | calico | weave | flannel)
12+
[enable-dashboard] The enablement of the Kubernetes Dashboard in the cluster
13+
[ingress] The Ingress Controller that will run in the cluster (unknown_ingress | none | nginx | traefik)
14+
default-pool-config.node-type The node type is the type of Scaleway Instance wanted for the pool
15+
[default-pool-config.placement-group-id] The placement group ID in which all the nodes of the pool will be created
16+
[default-pool-config.autoscaling] The enablement of the autoscaling feature for the pool
17+
default-pool-config.size The size (number of nodes) of the pool
18+
[default-pool-config.min-size] The minimun size of the pool
19+
[default-pool-config.max-size] The maximum size of the pool
20+
[default-pool-config.container-runtime] The container runtime for the nodes of the pool (unknown_runtime | docker | containerd | crio)
21+
[default-pool-config.autohealing] The enablement of the autohealing feature for the pool
22+
[default-pool-config.tags.{index}] The tags associated with the pool
23+
[autoscaler-config.scale-down-disabled] Disable the cluster autoscaler
24+
[autoscaler-config.scale-down-delay-after-add] How long after scale up that scale down evaluation resumes
25+
[autoscaler-config.estimator] Type of resource estimator to be used in scale up (unknown_estimator | binpacking | oldbinpacking)
26+
[autoscaler-config.expander] Type of node group expander to be used in scale up (unknown_expander | random | most_pods | least_waste | priority)
27+
[autoscaler-config.ignore-daemonsets-utilization] Ignore DaemonSet pods when calculating resource utilization for scaling down
28+
[autoscaler-config.balance-similar-node-groups] Detect similar node groups and balance the number of nodes between them
29+
[autoscaler-config.expendable-pods-priority-cutoff] Pods with priority below cutoff will be expendable
30+
[auto-upgrade.enable] Whether or not auto upgrade is enabled for the cluster
31+
[auto-upgrade.maintenance-window.start-hour] The start hour of the 2-hour maintenance window
32+
[auto-upgrade.maintenance-window.day] The day of the week for the maintenance window (any | monday | tuesday | wednesday | thursday | friday | saturday | sunday)
33+
[feature-gates.{index}] List of feature gates to enable
34+
[admission-plugins.{index}] List of admission plugins to enable
35+
[organization-id] Organization ID to use. If none is passed will use default organization ID from the config
36+
[region] Region to target. If none is passed will use default region from the config (fr-par)
37+
38+
FLAGS:
39+
-h, --help help for create
40+
41+
GLOBAL FLAGS:
42+
-D, --debug Enable debug mode
43+
-o, --output string Output format: json or human
44+
-p, --profile string The config profile to use
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This method allows to delete a specific cluster and all its associated pools and nodes. Note that this method will not delete any Load Balancers or Block Volumes that are associated with the cluster.
2+
3+
USAGE:
4+
scw [global-flags] k8s cluster delete [flags] [arg=value ...]
5+
6+
ARGS:
7+
cluster-id The ID of the cluster to delete
8+
[region] Region to target. If none is passed will use default region from the config (fr-par)
9+
10+
FLAGS:
11+
-h, --help help for delete
12+
13+
GLOBAL FLAGS:
14+
-D, --debug Enable debug mode
15+
-o, --output string Output format: json or human
16+
-p, --profile string The config profile to use
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This method allows to get details about a specific Kubernetes cluster.
2+
3+
USAGE:
4+
scw [global-flags] k8s cluster get [flags] [arg=value ...]
5+
6+
EXAMPLES:
7+
Get the cluster with id 11111111-1111-1111-111111111111
8+
scw k8s cluster get
9+
10+
ARGS:
11+
cluster-id The ID of the requested cluster
12+
[region] Region to target. If none is passed will use default region from the config (fr-par)
13+
14+
FLAGS:
15+
-h, --help help for get
16+
17+
GLOBAL FLAGS:
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human
20+
-p, --profile string The config profile to use
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This method allows to list the versions that a specific Kubernetes cluster is allowed to upgrade to. Note that it will be every patch version greater than the actual one as well a one minor version ahead of the actual one. Upgrades skipping a minor version will not work.
2+
3+
USAGE:
4+
scw [global-flags] k8s cluster list-available-versions [flags] [arg=value ...]
5+
6+
ARGS:
7+
cluster-id The ID of the cluster which the available Kuberentes versions will be listed from
8+
[region] Region to target. If none is passed will use default region from the config (fr-par)
9+
10+
FLAGS:
11+
-h, --help help for list-available-versions
12+
13+
GLOBAL FLAGS:
14+
-D, --debug Enable debug mode
15+
-o, --output string Output format: json or human
16+
-p, --profile string The config profile to use
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
This method allows to list all the existing Kubernetes clusters in an account.
2+
3+
USAGE:
4+
scw [global-flags] k8s cluster list [flags] [arg=value ...]
5+
6+
EXAMPLES:
7+
List all the clusters on your default region
8+
scw k8s cluster list
9+
10+
List the ready clusters on your default region
11+
scw k8s cluster list status=ready
12+
13+
List the clusters that match the given name on fr-par ('cluster1' will return 'cluster100' and 'cluster1' but not 'foo')
14+
scw k8s cluster list region=fr-par name=cluster1
15+
16+
ARGS:
17+
[order-by] The sort order of the returned clusters (created_at_asc | created_at_desc | updated_at_asc | updated_at_desc | name_asc | name_desc | status_asc | status_desc | version_asc | version_desc)
18+
[name] The name on which to filter the returned clusters
19+
[status] The status on which to filter the returned clusters (unknown | creating | ready | deleting | deleted | updating | warning | error | locked)
20+
[organization-id] The organization ID on which to filter the returned clusters
21+
[region] Region to target. If none is passed will use default region from the config (fr-par)
22+
23+
FLAGS:
24+
-h, --help help for list
25+
26+
GLOBAL FLAGS:
27+
-D, --debug Enable debug mode
28+
-o, --output string Output format: json or human
29+
-p, --profile string The config profile to use
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This method allows to reset the admin token for a specific Kubernetes cluster. This will invalidate the old admin token (which will not be usable after) and create a new one. Note that the redownload of the kubeconfig will be necessary to keep interacting with the cluster (if the old admin token was used).
2+
3+
USAGE:
4+
scw [global-flags] k8s cluster reset-admin-token [flags] [arg=value ...]
5+
6+
ARGS:
7+
cluster-id The ID of the cluster of which the admin token will be renewed
8+
[region] Region to target. If none is passed will use default region from the config (fr-par)
9+
10+
FLAGS:
11+
-h, --help help for reset-admin-token
12+
13+
GLOBAL FLAGS:
14+
-D, --debug Enable debug mode
15+
-o, --output string Output format: json or human
16+
-p, --profile string The config profile to use
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
This method allows to update a specific Kubernetes cluster. Note that this method is not made to upgrade a Kubernetes cluster.
2+
3+
USAGE:
4+
scw [global-flags] k8s cluster update [flags] [arg=value ...]
5+
6+
EXAMPLES:
7+
Enable dashboard on cluster 11111111-1111-1111-111111111111
8+
scw k8s cluster update
9+
10+
Add TTLAfterFinished Feature gates on cluster 11111111-1111-1111-111111111111
11+
scw k8s cluster update
12+
13+
ARGS:
14+
cluster-id The ID of the cluster to update
15+
[name] The new name of the cluster
16+
[description] The new description of the cluster
17+
[tags] The new tags associated with the cluster
18+
[autoscaler-config.scale-down-disabled] Disable the cluster autoscaler
19+
[autoscaler-config.scale-down-delay-after-add] How long after scale up that scale down evaluation resumes
20+
[autoscaler-config.estimator] Type of resource estimator to be used in scale up (unknown_estimator | binpacking | oldbinpacking)
21+
[autoscaler-config.expander] Type of node group expander to be used in scale up (unknown_expander | random | most_pods | least_waste | priority)
22+
[autoscaler-config.ignore-daemonsets-utilization] Ignore DaemonSet pods when calculating resource utilization for scaling down
23+
[autoscaler-config.balance-similar-node-groups] Detect similar node groups and balance the number of nodes between them
24+
[autoscaler-config.expendable-pods-priority-cutoff] Pods with priority below cutoff will be expendable
25+
[enable-dashboard] The new value of the Kubernetes Dashboard enablement
26+
[ingress] The new Ingress Controller for the cluster (unknown_ingress | none | nginx | traefik)
27+
[auto-upgrade.enable] Whether or not auto upgrade is enabled for the cluster
28+
[auto-upgrade.maintenance-window.start-hour] The start hour of the 2-hour maintenance window
29+
[auto-upgrade.maintenance-window.day] The day of the week for the maintenance window (any | monday | tuesday | wednesday | thursday | friday | saturday | sunday)
30+
[feature-gates] List of feature gates to enable
31+
[admission-plugins] List of admission plugins to enable
32+
[region] Region to target. If none is passed will use default region from the config (fr-par)
33+
34+
FLAGS:
35+
-h, --help help for update
36+
37+
GLOBAL FLAGS:
38+
-D, --debug Enable debug mode
39+
-o, --output string Output format: json or human
40+
-p, --profile string The config profile to use
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
This method allows to upgrade a specific Kubernetes cluster and/or its associated pools to a specific and supported Kubernetes version.
2+
3+
USAGE:
4+
scw [global-flags] k8s cluster upgrade [flags] [arg=value ...]
5+
6+
ARGS:
7+
cluster-id The ID of the cluster to upgrade
8+
[version] The new Kubernetes version of the cluster
9+
[upgrade-pools] The enablement of the pools upgrade
10+
[region] Region to target. If none is passed will use default region from the config (fr-par)
11+
12+
FLAGS:
13+
-h, --help help for upgrade
14+
15+
GLOBAL FLAGS:
16+
-D, --debug Enable debug mode
17+
-o, --output string Output format: json or human
18+
-p, --profile string The config profile to use
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
A cluster is a fully managed Kubernetes cluster.
2+
3+
It is composed of different pools, each pool containing the same kind of nodes.
4+
5+
USAGE:
6+
scw [global-flags] k8s cluster <command> [flags]
7+
8+
AVAILABLE COMMANDS:
9+
list List all the clusters
10+
create Create a new cluster
11+
get Get a cluster
12+
update Update a cluster
13+
delete Delete a cluster
14+
upgrade Upgrade a cluster
15+
list-available-versions List available versions for a cluster
16+
reset-admin-token Reset the admin token of a cluster
17+
18+
FLAGS:
19+
-h, --help help for cluster
20+
21+
GLOBAL FLAGS:
22+
-D, --debug Enable debug mode
23+
-o, --output string Output format: json or human
24+
-p, --profile string The config profile to use
25+
26+
Use "scw k8s cluster [command] --help" for more information about a command.

0 commit comments

Comments
 (0)