kubectl/pkg/cmd
Tim Hockin 02042ef887 Add KYAML support to kubectl
KYAML is a strict subset of YAML, which is sort of halfway between YAML
and JSON.  It has the following properties:
* Does not depend on whitespace (easier to text-patch and template).
* Always quotes value strings (no ambiguity aroud things like "no").
* Allows quoted keys, but does not require them, and only quotes them if
  they are not obviously safe (e.g. "no" would always be quoted).
* Always uses {} for structs and maps (no more obscure errors about
  mapping values).
* Always uses [] for lists (no more trying to figure out if a dash
  changes the meaning).
* When printing, it includes a header which makes it clear this is YAML
  and not ill-formed JSON.
* Allows trailing commas
* Allows comments,
* Tries to economize on vertical space by "cuddling" some kinds of
  brackets together.
* Retains comments.

Examples:

A struct:

```yaml
metadata: {
  creationTimestamp: "2024-12-11T00:10:11Z",
  labels: {
    app: "hostnames",
  },
  name: "hostnames",
  namespace: "default",
  resourceVersion: "15231643",
  uid: "f64dbcba-9c58-40b0-bbe7-70495efb5202",
}
```

A list of primitves:

```yaml
ipFamilies: [
  "IPv4",
  "IPv6",
]
```

A list of structs:

```yaml
ports: [{
  port: 80,
  protocol: "TCP",
  targetPort: 80,
}, {
  port: 443,
  protocol: "TCP",
  targetPort: 443,
}]
```

A multi-document stream:

```yaml
---
{
  foo: "bar",
}
---
{
  qux: "zrb",
}
```

Kubernetes-commit: 2cb955d8ccae30167b9610bfe51c2f86e83a1958
2025-07-14 09:24:18 -07:00
..
annotate Use canonical json-patch v4 import 2024-02-16 13:57:24 +01:00
apiresources JSON & YAML output for kubectl api-resources (#132604) 2025-07-24 15:35:50 +00:00
apply Bump k8s.io/kube-openapi to latest SHA (f3f2b991d03b) 2025-07-10 09:21:52 -04:00
attach Add warning message for attach 2024-09-06 02:31:14 +00:00
auth Drop null creationTimestamp from test fixtures 2025-03-24 09:37:26 -04:00
autoscale feature(kubectl): support mem-percent,cpu-value,cpu-average-value,mem-value,mem-average-value flag to kubectl autoscale 2024-12-24 10:01:25 +08:00
certificates Update CLI help text for grammar and consistency 2023-06-12 15:55:59 -04:00
clusterinfo Drop go-colortext and its usage 2024-11-01 09:55:42 -04:00
completion Update CLI help text for grammar and consistency 2023-06-12 15:55:59 -04:00
config Deprecate kubeconfig's preference field in favor of kuberc 2025-05-13 13:39:13 +02:00
cp Increase kubectl cp command timeout to 30 seconds 2025-03-28 12:39:01 +03:00
create Drop null creationTimestamp from test fixtures 2025-03-24 09:37:26 -04:00
debug feat: kubectl debug: add label for debugger pod 2025-05-15 17:32:06 +07:00
delete show namespace on delete (#126619) 2025-06-24 02:15:09 +00:00
describe Use generic sets rather than deprecated sets.String 2024-11-21 13:22:39 +03:00
diff Set LANGUAGE env variable in TestDiffProgram for consistent locale behavior 2025-03-21 17:28:41 +00:00
drain Use generic sets rather than deprecated sets.String 2024-11-21 13:22:39 +03:00
edit switch to latest sigs.k8s.io/yaml v1.5.0 (run update-gofmt.sh as well) 2025-06-25 08:03:06 -04:00
events Use generic sets rather than deprecated sets.String 2024-11-21 13:22:39 +03:00
exec kubectl: expose context parameter in DefaultRemoteExecutor 2025-03-12 15:51:13 +01:00
explain Revert shorthand for kubectl explain --output 2025-05-26 12:16:24 +09:00
expose Drop null creationTimestamp from test fixtures 2025-03-24 09:37:26 -04:00
get Improve ignore-not-found behavior (#132542) 2025-07-03 01:53:24 +00:00
help Move pkg/kubectl/cmd/{command} to staging 2019-08-01 11:01:40 -07:00
kustomize Migrate genericclioptions.IOStreams usage to genericiooptions 2023-04-05 14:07:46 +03:00
label Use canonical json-patch v4 import 2024-02-16 13:57:24 +01:00
logs Wire context to logs command and add interrupt handler (#127503) 2024-10-22 21:49:06 +03:00
options replace deprecated setoutput 2022-04-05 14:04:22 +08:00
patch kubectl: drop dependency on github.com/pkg/errors 2025-05-26 10:44:46 +02:00
plugin correcting link to krew install 2024-05-27 16:52:19 +05:30
portforward Use generic sets rather than deprecated sets.String 2024-11-21 13:22:39 +03:00
proxy Migrate genericclioptions.IOStreams usage to genericiooptions 2023-04-05 14:07:46 +03:00
replace Replace PollImmediate with PollUntilContextTimeout (#128147) 2024-11-07 16:57:29 +02:00
rollout Unhandled panic crash on rollout_history printer.PrintObj (#130503) 2025-04-24 00:01:14 +03:30
run Drop null creationTimestamp from test fixtures 2025-03-24 09:37:26 -04:00
scale bug(kubectl): return resource builder error in scale cmd 2024-10-14 18:25:13 +08:00
set remove import doc comments 2024-12-02 14:43:58 +01:00
taint Use generic sets rather than deprecated sets.String 2024-11-21 13:22:39 +03:00
testing Add feature toggle for OpenAPI V3 apply in kubectl 2023-10-27 01:23:19 -04:00
top Enhance help text for the 'top' command 2025-06-26 16:53:50 -07:00
util Add KYAML support to kubectl 2025-07-14 09:24:18 -07:00
version Update kubectl kustomize to kyaml/v0.20.1, cmd/config/v0.20.1, api/v0.20.1, kustomize/v5.7.1 2025-07-23 22:30:05 +09:00
wait client-go, kubectl: Replace deprecated ErrWaitTimeout with recommended method (#132718) 2025-07-24 19:32:01 +00:00
alpha.go Migrate genericclioptions.IOStreams usage to genericiooptions 2023-04-05 14:07:46 +03:00
cmd.go Swap KUBECTL_COMMAND_HEADERS to use the proper feature gate mechanism 2025-05-08 14:09:17 +02:00
cmd_test.go Swap KUBECTL_COMMAND_HEADERS to use the proper feature gate mechanism 2025-05-08 14:09:17 +02:00
profiling.go Add Close() for profile 2021-12-15 21:03:34 +08:00
skiplookerr_go118.go Adjust for os/exec changes in 1.19 2022-07-22 17:42:11 -04:00
skiplookerr_go119.go Adjust for os/exec changes in 1.19 2022-07-22 17:42:11 -04:00