From 1430c2a13e156fc63a6687f0a22fa6a46e5742f3 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 20 Nov 2025 05:00:12 -0500 Subject: [PATCH] refactor: rename the scheduler-k3s:cluster-* commands to use a : instead of - for a delimiter This standardizes the commands with the other k3s commands that use a colon delimiter as well. --- docs/appendices/0.37.0-migration-guide.md | 3 ++ docs/deployment/schedulers/k3s.md | 32 +++++++++---------- plugins/scheduler-k3s/Makefile | 2 +- .../scheduler-k3s/src/commands/commands.go | 6 ++-- .../src/subcommands/subcommands.go | 12 +++---- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/docs/appendices/0.37.0-migration-guide.md b/docs/appendices/0.37.0-migration-guide.md index ac01fa70f..ddc44755a 100644 --- a/docs/appendices/0.37.0-migration-guide.md +++ b/docs/appendices/0.37.0-migration-guide.md @@ -3,6 +3,9 @@ ## Changes - The `app.json` file format is now parsed as JSONC and supports inline comments. +- The `scheduler-k3s:cluster-add` command is now `scheduler-k3s:cluster:add`. +- The `scheduler-k3s:cluster-list` command is now `scheduler-k3s:cluster:list`. +- The `scheduler-k3s:cluster-remove` command is now `scheduler-k3s:cluster:remove`. ## Removals diff --git a/docs/deployment/schedulers/k3s.md b/docs/deployment/schedulers/k3s.md index e0e96033d..2b23186ee 100644 --- a/docs/deployment/schedulers/k3s.md +++ b/docs/deployment/schedulers/k3s.md @@ -7,9 +7,9 @@ scheduler-k3s:annotations:set () [--process-type PROCESS_TYPE] <--resource-type RESOURCE_TYPE>, Set or clear an annotation for a given app/process-type/resource-type combination scheduler-k3s:autoscaling-auth:set [<--metadata key=value>...], Set or clear a scheduler-k3s autoscaling keda trigger authentication resource for an app scheduler-k3s:autoscaling-auth:report [--format stdout|json] [--include-metadata] # Displays a scheduler-k3s autoscaling auth report for an app -scheduler-k3s:cluster-add [ssh://user@host:port] # Adds a server node to a Dokku-managed cluster -scheduler-k3s:cluster-list # Lists all nodes in a Dokku-managed cluster -scheduler-k3s:cluster-remove [node-id] # Removes client node to a Dokku-managed cluster +scheduler-k3s:cluster:add [ssh://user@host:port] # Adds a server node to a Dokku-managed cluster +scheduler-k3s:cluster:list # Lists all nodes in a Dokku-managed cluster +scheduler-k3s:cluster:remove [node-id] # Removes client node to a Dokku-managed cluster scheduler-k3s:ensure-charts # Ensures the k3s charts are installed scheduler-k3s:initialize # Initializes a cluster scheduler-k3s:labels:set () [--process-type PROCESS_TYPE] <--resource-type RESOURCE_TYPE> # Set or clear a label for a given app/process-type/resource-type combination @@ -80,16 +80,16 @@ dokku scheduler-k3s:initialize --ingress-class traefik #### Adding a worker node -Nodes that run app workloads can be added via the `scheduler-k3s:cluster-add` command. This will ssh onto the specified server, install k3s, and join it to the current Dokku node in worker mode. Workers are typically used to run app workloads. +Nodes that run app workloads can be added via the `scheduler-k3s:cluster:add` command. This will ssh onto the specified server, install k3s, and join it to the current Dokku node in worker mode. Workers are typically used to run app workloads. ```shell -dokku scheduler-k3s:cluster-add ssh://root@worker-1.example.com +dokku scheduler-k3s:cluster:add ssh://root@worker-1.example.com ``` Per-node kubelet flags can be supplied by passing `--kubelet-args` with a comma-separated `key=value` list. This is useful for tuning scheduler capacity or enforcing cluster-wide defaults at the node level. ```shell -dokku scheduler-k3s:cluster-add \ +dokku scheduler-k3s:cluster:add \ --kubelet-args allowed-unsafe-sysctls=net.ipv6.conf.all.disable_ipv6 \ ssh://root@worker-1.example.com ``` @@ -97,7 +97,7 @@ dokku scheduler-k3s:cluster-add \ Multiple kubelet arguments can be specified in the same call by separating them with commas. The following example enables IPv4 forwarding while also increasing the pod density on the worker. ```shell -dokku scheduler-k3s:cluster-add \ +dokku scheduler-k3s:cluster:add \ --kubelet-args allowed-unsafe-sysctls=net.ipv6.conf.all.disable_ipv6,max-pods=150 \ ssh://root@worker-2.example.com ``` @@ -105,13 +105,13 @@ dokku scheduler-k3s:cluster-add \ If the server isn't in the `known_hosts` file, the connection will fail. This can be bypassed by setting the `--insecure-allow-unknown-hosts` flag: ```shell -dokku scheduler-k3s:cluster-add --insecure-allow-unknown-hosts ssh://root@worker-1.example.com +dokku scheduler-k3s:cluster:add --insecure-allow-unknown-hosts ssh://root@worker-1.example.com ``` By default, Dokku will attempt to auto-detect the IP address of the Dokku server for the remote server to connect to. In cases where the auto-detected IP address is incorrect, an override may be specified via the `--server-ip` flag: ```shell -dokku scheduler-k3s:cluster-add --server-ip 192.168.20.15 ssh://root@worker-1.example.com +dokku scheduler-k3s:cluster:add --server-ip 192.168.20.15 ssh://root@worker-1.example.com ``` #### Adding a server node @@ -121,28 +121,28 @@ dokku scheduler-k3s:cluster-add --server-ip 192.168.20.15 ssh://root@worker-1.ex Server nodes are typically used to replicate the cluster state, and it is recommended to have an odd number of nodes spread across several availability zones (datacenters in close proximity within a region). This allows for higher availability in the event of a cluster failure. Server nodes run control-plane services such as the traefik load balancer and the etcd backing store. -Server nodes can also be added with the `scheduler-k3s:cluster-add` command by specifying `--role server`. This will ssh onto the specified server, install k3s, and join it to the current Dokku node in server mode. +Server nodes can also be added with the `scheduler-k3s:cluster:add` command by specifying `--role server`. This will ssh onto the specified server, install k3s, and join it to the current Dokku node in server mode. ```shell -dokku scheduler-k3s:cluster-add --role server ssh://root@server-1.example.com +dokku scheduler-k3s:cluster:add --role server ssh://root@server-1.example.com ``` Server nodes allow any workloads to be scheduled on them by default, in addition to the control-plane, etcd, and the scheduler itself. To avoid app workloads being scheduled on your control-plane, use the `--taint-scheduling` flag: ```shell -dokku scheduler-k3s:cluster-add --role server --taint-scheduling ssh://root@server-1.example.com +dokku scheduler-k3s:cluster:add --role server --taint-scheduling ssh://root@server-1.example.com ``` If the server isn't in the `known_hosts` file, the connection will fail. This can be bypassed by setting the `--insecure-allow-unknown-hosts` flag: ```shell -dokku scheduler-k3s:cluster-add --role server --insecure-allow-unknown-hosts ssh://root@server-1.example.com +dokku scheduler-k3s:cluster:add --role server --insecure-allow-unknown-hosts ssh://root@server-1.example.com ``` By default, Dokku will attempt to auto-detect the IP address of the Dokku server for the remote server to connect to. In cases where the auto-detected IP address is incorrect, an override may be specified via the `--server-ip` flag: ```shell -dokku scheduler-k3s:cluster-add --role server --server-ip 192.168.20.15 ssh://root@server-1.example.com +dokku scheduler-k3s:cluster:add --role server --server-ip 192.168.20.15 ssh://root@server-1.example.com ``` #### Changing the network interface @@ -155,7 +155,7 @@ dokku scheduler-k3s:set --global network-interface eth1 ### Node Profiles -Node profiles capture repeatable `scheduler-k3s:cluster-add` options so you can join multiple nodes with identical settings. A profile name can be specified for the `scheduler-k3s:cluster-add` command via the `--profile ` flag. Any flags passed directly to `scheduler-k3s:cluster-add` override the stored values for that run. +Node profiles capture repeatable `scheduler-k3s:cluster:add` options so you can join multiple nodes with identical settings. A profile name can be specified for the `scheduler-k3s:cluster:add` command via the `--profile ` flag. Any flags passed directly to `scheduler-k3s:cluster:add` override the stored values for that run. #### Listing profiles @@ -183,7 +183,7 @@ dokku scheduler-k3s:profiles:add edge-workers \ --kubelet-args protect-kernel-defaults=true,eviction-hard=memory.available<200Mi ``` -Profile names must be alphanumeric, may include internal dashes, cannot start/end with a dash, and must be ≤32 characters. Other than the `--server-ip` flag, all flags used for `scheduler-k3s:cluster-add` are valid for the `scheduler-k3s:profiles:add` command. +Profile names must be alphanumeric, may include internal dashes, cannot start/end with a dash, and must be ≤32 characters. Other than the `--server-ip` flag, all flags used for `scheduler-k3s:cluster:add` are valid for the `scheduler-k3s:profiles:add` command. #### scheduler-k3s:profiles:remove diff --git a/plugins/scheduler-k3s/Makefile b/plugins/scheduler-k3s/Makefile index 8e40a41db..3c46a33ef 100644 --- a/plugins/scheduler-k3s/Makefile +++ b/plugins/scheduler-k3s/Makefile @@ -1,4 +1,4 @@ -SUBCOMMANDS = subcommands/annotations:set subcommands/autoscaling-auth:set subcommands/autoscaling-auth:report subcommands/cluster-add subcommands/cluster-list subcommands/cluster-remove subcommands/ensure-charts subcommands/initialize subcommands/labels:set subcommands/profiles:add subcommands/profiles:list subcommands/profiles:remove subcommands/report subcommands/set subcommands/show-kubeconfig subcommands/uninstall +SUBCOMMANDS = subcommands/annotations:set subcommands/autoscaling-auth:set subcommands/autoscaling-auth:report subcommands/cluster:add subcommands/cluster:list subcommands/cluster:remove subcommands/ensure-charts subcommands/initialize subcommands/labels:set subcommands/profiles:add subcommands/profiles:list subcommands/profiles:remove subcommands/report subcommands/set subcommands/show-kubeconfig subcommands/uninstall TRIGGERS = triggers/core-post-deploy triggers/core-post-extract triggers/install triggers/post-app-clone-setup triggers/post-app-rename-setup triggers/post-create triggers/post-delete triggers/report triggers/scheduler-app-status triggers/scheduler-deploy triggers/scheduler-enter triggers/scheduler-is-deployed triggers/scheduler-logs triggers/scheduler-proxy-config triggers/scheduler-proxy-logs triggers/scheduler-post-delete triggers/scheduler-run triggers/scheduler-run-list triggers/scheduler-stop triggers/scheduler-cron-write BUILD = commands subcommands triggers PLUGIN_NAME = scheduler-k3s diff --git a/plugins/scheduler-k3s/src/commands/commands.go b/plugins/scheduler-k3s/src/commands/commands.go index 6ae1ac040..e5b51b68d 100644 --- a/plugins/scheduler-k3s/src/commands/commands.go +++ b/plugins/scheduler-k3s/src/commands/commands.go @@ -19,9 +19,9 @@ Additional commands:` helpContent = ` scheduler-k3s:autoscaling-auth:set [<--metadata key=value>...], Set or clear a scheduler-k3s autoscaling keda trigger authentication resource for an app scheduler-k3s:annotations:set () [--process-type PROCESS_TYPE] <--resource-type RESOURCE_TYPE>, Set or clear an annotation for a given app/process-type/resource-type combination - scheduler-k3s:cluster-add [--profile PROFILE] [--role ROLE] [--insecure-allow-unknown-hosts] [--server-ip SERVER_IP] [--taint-scheduling] [--kubelet-args KUBELET_ARGS] , Adds a server node to a Dokku-managed cluster - scheduler-k3s:cluster-list [--format json|stdout], Lists all nodes in a Dokku-managed cluster - scheduler-k3s:cluster-remove [node-id], Removes client node to a Dokku-managed cluster + scheduler-k3s:cluster:add [--profile PROFILE] [--role ROLE] [--insecure-allow-unknown-hosts] [--server-ip SERVER_IP] [--taint-scheduling] [--kubelet-args KUBELET_ARGS] , Adds a server node to a Dokku-managed cluster + scheduler-k3s:cluster:list [--format json|stdout], Lists all nodes in a Dokku-managed cluster + scheduler-k3s:cluster:remove [node-id], Removes client node to a Dokku-managed cluster scheduler-k3s:ensure-charts, Ensures the k3s charts are installed scheduler-k3s:initialize [--server-ip SERVER_IP] [--taint-scheduling], Initializes a cluster scheduler-k3s:labels:set () [--process-type PROCESS_TYPE] <--resource-type RESOURCE_TYPE>, Set or clear a label for a given app/process-type/resource-type combination diff --git a/plugins/scheduler-k3s/src/subcommands/subcommands.go b/plugins/scheduler-k3s/src/subcommands/subcommands.go index d91bc9583..7a950f1ec 100644 --- a/plugins/scheduler-k3s/src/subcommands/subcommands.go +++ b/plugins/scheduler-k3s/src/subcommands/subcommands.go @@ -54,8 +54,8 @@ func main() { args.Parse(os.Args[2:]) appName := args.Arg(0) err = scheduler_k3s.CommandAutoscalingAuthReport(appName, *format, *global, *includeMetadata) - case "cluster-add": - args := flag.NewFlagSet("scheduler-k3s:cluster-add", flag.ExitOnError) + case "cluster:add": + args := flag.NewFlagSet("scheduler-k3s:cluster:add", flag.ExitOnError) allowUknownHosts := args.Bool("insecure-allow-unknown-hosts", false, "insecure-allow-unknown-hosts: allow unknown hosts") taintScheduling := args.Bool("taint-scheduling", false, "taint-scheduling: add a taint against scheduling app workloads") serverIP := args.String("server-ip", "", "server-ip: IP address of the dokku server node") @@ -65,13 +65,13 @@ func main() { args.Parse(os.Args[2:]) remoteHost := args.Arg(0) err = scheduler_k3s.CommandClusterAdd(*profileName, *role, remoteHost, *serverIP, *allowUknownHosts, *taintScheduling, *kubeletArgs) - case "cluster-list": - args := flag.NewFlagSet("scheduler-k3s:cluster-list", flag.ExitOnError) + case "cluster:list": + args := flag.NewFlagSet("scheduler-k3s:cluster:list", flag.ExitOnError) format := args.String("format", "stdout", "format: [ stdout | json ]") args.Parse(os.Args[2:]) err = scheduler_k3s.CommandClusterList(*format) - case "cluster-remove": - args := flag.NewFlagSet("scheduler-k3s:cluster-remove", flag.ExitOnError) + case "cluster:remove": + args := flag.NewFlagSet("scheduler-k3s:cluster:remove", flag.ExitOnError) args.Parse(os.Args[2:]) nodeName := args.Arg(0) err = scheduler_k3s.CommandClusterRemove(nodeName)