feat: add --context flag to scheduler-k3s:preview
Users can override the default 3-line surrounding context per change. Pass `--context -1` to render the full resource around every change, matching upstream `helm diff upgrade` behavior.
This commit is contained in:
4 files changed
+16
-5
No files matched your search
@@ -17,7 +17,7 @@ scheduler-k3s:ensure-charts # Ensures the k3s charts are
|
|||||||
scheduler-k3s:initialize # Initializes a cluster
|
scheduler-k3s:initialize # Initializes a cluster
|
||||||
scheduler-k3s:labels:set <app|--global> <property> (<value>) [--process-type PROCESS_TYPE] <--resource-type RESOURCE_TYPE> # Set or clear a label for a given app/process-type/resource-type combination
|
scheduler-k3s:labels:set <app|--global> <property> (<value>) [--process-type PROCESS_TYPE] <--resource-type RESOURCE_TYPE> # Set or clear a label for a given app/process-type/resource-type combination
|
||||||
scheduler-k3s:labels:report [<app>|--global] [--format stdout|json] [--process-type PROCESS_TYPE] [--resource-type RESOURCE_TYPE] # Displays a scheduler-k3s labels report for one or more apps
|
scheduler-k3s:labels:report [<app>|--global] [--format stdout|json] [--process-type PROCESS_TYPE] [--resource-type RESOURCE_TYPE] # Displays a scheduler-k3s labels report for one or more apps
|
||||||
scheduler-k3s:preview <app> [--show-secrets] [--show-secrets-decoded] # Displays a diff between the current and next deployment for an app
|
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: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
|
scheduler-k3s:profiles:list [--format json|stdout] # Lists all node profiles in the k3s cluster
|
||||||
scheduler-k3s:profiles:remove <profile> # Removes a node profile from the k3s cluster
|
scheduler-k3s:profiles:remove <profile> # Removes a node profile from the k3s cluster
|
||||||
@@ -247,6 +247,13 @@ dokku scheduler-k3s:preview node-js-app
|
|||||||
|
|
||||||
A clean redeploy with no property changes produces no output. After modifying a property that affects the main app chart (for example `dokku resource:limit --memory 256m node-js-app`), the command shows the unified diff for each changed resource. For an app that has never been deployed, the entire proposed manifest is rendered as added lines.
|
A clean redeploy with no property changes produces no output. After modifying a property that affects the main app chart (for example `dokku resource:limit --memory 256m node-js-app`), the command shows the unified diff for each changed resource. For an app that has never been deployed, the entire proposed manifest is rendered as added lines.
|
||||||
|
|
||||||
|
By default each change is shown with 3 lines of surrounding context, git-diff style. The `--context` flag overrides this; pass `-1` to render the full resource around every change:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
dokku scheduler-k3s:preview node-js-app --context 0
|
||||||
|
dokku scheduler-k3s:preview node-js-app --context -1
|
||||||
|
```
|
||||||
|
|
||||||
By default any `kind: Secret` resources have their `data` values redacted so secret bytes never appear in terminal scrollback or CI logs. Two flags adjust this behavior:
|
By default any `kind: Secret` resources have their `data` values redacted so secret bytes never appear in terminal scrollback or CI logs. Two flags adjust this behavior:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ import (
|
|||||||
// in the live Helm release for an app and the manifests that the next deploy
|
// in the live Helm release for an app and the manifests that the next deploy
|
||||||
// would roll out. Only the main app helm release is compared; the auxiliary
|
// would roll out. Only the main app helm release is compared; the auxiliary
|
||||||
// config-secret, image-pull-secret, and TLS-secret releases are out of scope.
|
// config-secret, image-pull-secret, and TLS-secret releases are out of scope.
|
||||||
func CommandPreview(appName string, showSecrets bool, showSecretsDecoded bool) error {
|
//
|
||||||
|
// diffContext controls the number of unchanged lines shown around each change;
|
||||||
|
// pass -1 to print the full resource.
|
||||||
|
func CommandPreview(appName string, diffContext int, showSecrets bool, showSecretsDecoded bool) error {
|
||||||
if err := common.VerifyAppName(appName); err != nil {
|
if err := common.VerifyAppName(appName); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -80,7 +83,7 @@ func CommandPreview(appName string, showSecrets bool, showSecretsDecoded bool) e
|
|||||||
|
|
||||||
options := &helmdiff.Options{
|
options := &helmdiff.Options{
|
||||||
OutputFormat: "diff",
|
OutputFormat: "diff",
|
||||||
OutputContext: 3,
|
OutputContext: diffContext,
|
||||||
ShowSecrets: showSecrets,
|
ShowSecrets: showSecrets,
|
||||||
ShowSecretsDecoded: showSecretsDecoded,
|
ShowSecretsDecoded: showSecretsDecoded,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Additional commands:`
|
|||||||
scheduler-k3s:initialize [--server-ip SERVER_IP] [--taint-scheduling], Initializes a cluster
|
scheduler-k3s:initialize [--server-ip SERVER_IP] [--taint-scheduling], Initializes a cluster
|
||||||
scheduler-k3s:labels:set <app|--global> <property> (<value>) [--process-type PROCESS_TYPE] <--resource-type RESOURCE_TYPE>, Set or clear a label for a given app/process-type/resource-type combination
|
scheduler-k3s:labels:set <app|--global> <property> (<value>) [--process-type PROCESS_TYPE] <--resource-type RESOURCE_TYPE>, Set or clear a label for a given app/process-type/resource-type combination
|
||||||
scheduler-k3s:labels:report [<app>|--global] [--format stdout|json] [--process-type PROCESS_TYPE] [--resource-type RESOURCE_TYPE], Displays a scheduler-k3s labels report for one or more apps
|
scheduler-k3s:labels:report [<app>|--global] [--format stdout|json] [--process-type PROCESS_TYPE] [--resource-type RESOURCE_TYPE], Displays a scheduler-k3s labels report for one or more apps
|
||||||
scheduler-k3s:preview <app> [--show-secrets] [--show-secrets-decoded], Displays a diff between the current and next deployment for an app
|
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: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
|
scheduler-k3s:profiles:list [--format json|stdout], Lists all node profiles in the k3s cluster
|
||||||
scheduler-k3s:profiles:remove <profile>, Removes a node profile from the k3s cluster
|
scheduler-k3s:profiles:remove <profile>, Removes a node profile from the k3s cluster
|
||||||
|
|||||||
@@ -160,11 +160,12 @@ func main() {
|
|||||||
err = scheduler_k3s.CommandLabelsReport(appName, *format, *processType, *resourceType, infoFlag)
|
err = scheduler_k3s.CommandLabelsReport(appName, *format, *processType, *resourceType, infoFlag)
|
||||||
case "preview":
|
case "preview":
|
||||||
args := flag.NewFlagSet("scheduler-k3s:preview", flag.ExitOnError)
|
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)")
|
||||||
showSecrets := args.Bool("show-secrets", false, "--show-secrets: do not redact secret values in the output")
|
showSecrets := args.Bool("show-secrets", false, "--show-secrets: do not redact secret values in the output")
|
||||||
showSecretsDecoded := args.Bool("show-secrets-decoded", false, "--show-secrets-decoded: render secret values base64-decoded")
|
showSecretsDecoded := args.Bool("show-secrets-decoded", false, "--show-secrets-decoded: render secret values base64-decoded")
|
||||||
args.Parse(os.Args[2:])
|
args.Parse(os.Args[2:])
|
||||||
appName := args.Arg(0)
|
appName := args.Arg(0)
|
||||||
err = scheduler_k3s.CommandPreview(appName, *showSecrets, *showSecretsDecoded)
|
err = scheduler_k3s.CommandPreview(appName, *context, *showSecrets, *showSecretsDecoded)
|
||||||
case "profiles:add":
|
case "profiles:add":
|
||||||
args := flag.NewFlagSet("scheduler-k3s:profiles:add", flag.ExitOnError)
|
args := flag.NewFlagSet("scheduler-k3s:profiles:add", flag.ExitOnError)
|
||||||
role := args.String("role", "worker", "role: [ server | worker ]")
|
role := args.String("role", "worker", "role: [ server | worker ]")
|
||||||
|
|||||||
Reference in new issue
Block a user