Issue tracker and mirror of kubectl code
Go to file
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
.github Update kubectl GitHub support issue template 2021-08-17 11:59:20 -06:00
docs Fix broken link to testgrid 2023-08-14 13:53:49 +05:30
images Adds kubectl logo images 2019-06-21 11:34:42 -07:00
pkg Add KYAML support to kubectl 2025-07-14 09:24:18 -07:00
testdata ci: redis removal for e2e test dependency simplicity 2025-07-02 09:15:43 +08:00
CONTRIBUTING.md Adds staging directory for kubectl code 2019-05-29 23:31:23 -07:00
LICENSE Adds staging directory for kubectl code 2019-05-29 23:31:23 -07:00
OWNERS Update sig-cli OWNERS 2022-02-14 10:51:52 -07:00
README.md update go domain name 2022-09-15 19:01:51 +08:00
SECURITY_CONTACTS Update security contacts for sig-cli owned repos 2025-05-27 16:51:51 +02:00
code-of-conduct.md Adds staging directory for kubectl code 2019-05-29 23:31:23 -07:00
doc.go remove import doc comments 2024-12-02 14:43:58 +01:00
go.mod Merge pull request #131549 from carlory/KEP-3751-GA 2025-07-25 03:41:47 +00:00
go.sum Merge pull request #131549 from carlory/KEP-3751-GA 2025-07-25 03:41:47 +00:00

README.md

Kubectl

kubectl logo

Build Status GoDoc

The k8s.io/kubectl repo is used to track issues for the kubectl cli distributed with k8s.io/kubernetes. It also contains packages intended for use by client programs. E.g. these packages are vendored into k8s.io/kubernetes for use in the kubectl cli client. That client will eventually move here too.

Contribution Requirements

  • Full unit-test coverage.

  • Go tools compliant (go get, go test, etc.). It needs to be vendorable somewhere else.

  • No dependence on k8s.io/kubernetes. Dependence on other repositories is fine.

  • Code must be usefully commented. Not only for developers on the project, but also for external users of these packages.

  • When reviewing PRs, you are encouraged to use Golang's code review comments page.

  • Packages in this repository should aspire to implement sensible, small interfaces and import a limited set of dependencies.

Community, discussion, contribution, and support

See this document for how to reach the maintainers of this project.

Code of conduct

Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.