feat: report each node-sysctls scope's stored map
`scheduler-k3s:node-sysctls:report` renders each scope's resolved set, so a profile's entry carries every globally-set sysctl underneath its own and there is no way to read back the map the profile itself stores. Since `node-sysctls:set --replace --profile` and `node-sysctls:clear --profile` write only that map, a tool converging a profile against a declared map sees permanent drift. The new `--stored` flag reports the map each scope owns, and `--global` and `--profile` narrow the report to a single scope. The default output is unchanged.
This commit is contained in:
7 files changed
+344
-28
No files matched your search
@@ -38,7 +38,7 @@ Additional commands:`
|
||||
scheduler-k3s:node-sysctls:clear [--global|--profile PROFILE], Clear all node-level kernel sysctls for unprofiled nodes or a single node profile
|
||||
scheduler-k3s:node-sysctls:set <sysctl> (<value>) [--global|--profile PROFILE], Set or clear a node-level kernel sysctl for unprofiled nodes or a single node profile
|
||||
scheduler-k3s:node-sysctls:set --replace <sysctl=value> [<sysctl=value> ...] [--global|--profile PROFILE], Replace the entire node-level kernel sysctl map for unprofiled nodes or a single node profile
|
||||
scheduler-k3s:node-sysctls:report [--format stdout|json], Displays the node-level kernel sysctls applied to each scope
|
||||
scheduler-k3s:node-sysctls:report [--format stdout|json] [--stored] [--global|--profile PROFILE], Displays the node-level kernel sysctls for each scope
|
||||
scheduler-k3s:preview <app> [--context N] [--show-secrets] [--show-secrets-decoded], Displays a diff between the current and next deployment for an app
|
||||
scheduler-k3s:profiles:add <profile> [--role ROLE] [--insecure-allow-unknown-hosts] [--taint-scheduling] [--kubelet-args KUBELET_ARGS], Adds a node profile to the k3s cluster
|
||||
scheduler-k3s:profiles:list [--format json|stdout], Lists all node profiles in the k3s cluster
|
||||
|
||||
@@ -257,8 +257,21 @@ func main() {
|
||||
case "node-sysctls:report":
|
||||
args := flag.NewFlagSet("scheduler-k3s:node-sysctls:report", flag.ExitOnError)
|
||||
format := args.String("format", "stdout", "format: [ stdout | json ]")
|
||||
global := args.Bool("global", false, "--global: report only on all nodes without a node profile")
|
||||
profileName := args.String("profile", "", "--profile: report only on a node profile instead of every scope")
|
||||
stored := args.Bool("stored", false, "--stored: report the sysctls each scope stores itself rather than the resolved set it applies")
|
||||
args.Parse(os.Args[2:])
|
||||
err = scheduler_k3s.CommandNodeSysctlsReport(*format)
|
||||
if *global && *profileName != "" {
|
||||
err = fmt.Errorf("Only one of --global and --profile may be specified")
|
||||
break
|
||||
}
|
||||
|
||||
err = scheduler_k3s.CommandNodeSysctlsReport(scheduler_k3s.NodeSysctlsReportInput{
|
||||
Format: *format,
|
||||
Global: *global,
|
||||
ProfileName: *profileName,
|
||||
Stored: *stored,
|
||||
})
|
||||
case "preview":
|
||||
args := flag.NewFlagSet("scheduler-k3s:preview", flag.ExitOnError)
|
||||
context := args.Int("context", 3, "--context: number of unchanged lines of context around each change (-1 for full output)")
|
||||
|
||||
Reference in new issue
Block a user