{"id":13521600,"url":"https://github.com/itaysk/kubectl-neat","last_synced_at":"2025-05-14T23:00:22.141Z","repository":{"id":38709041,"uuid":"198226595","full_name":"itaysk/kubectl-neat","owner":"itaysk","description":"Clean up Kubernetes yaml and json output to make it readable","archived":false,"fork":false,"pushed_at":"2025-03-13T00:31:12.000Z","size":7604,"stargazers_count":1860,"open_issues_count":20,"forks_count":106,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-11T10:02:25.973Z","etag":null,"topics":["hacktoberfest","kubectl-plugin","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itaysk.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-07-22T13:14:51.000Z","updated_at":"2025-04-10T03:08:27.000Z","dependencies_parsed_at":"2024-01-13T22:23:32.864Z","dependency_job_id":"37346c64-7e46-45e0-a772-19335286b7e1","html_url":"https://github.com/itaysk/kubectl-neat","commit_stats":{"total_commits":80,"total_committers":14,"mean_commits":5.714285714285714,"dds":"0.19999999999999996","last_synced_commit":"b6e10595aa3f3e3f9ebd762253bbe8840612f938"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaysk%2Fkubectl-neat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaysk%2Fkubectl-neat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaysk%2Fkubectl-neat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaysk%2Fkubectl-neat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itaysk","download_url":"https://codeload.github.com/itaysk/kubectl-neat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243353,"owners_count":22038044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","kubectl-plugin","kubernetes"],"created_at":"2024-08-01T06:00:36.382Z","updated_at":"2025-05-14T23:00:22.084Z","avatar_url":"https://github.com/itaysk.png","language":"Go","funding_links":[],"categories":["Go","K8S-Tools","kubectl Plugins","Configuration Management"],"sub_categories":["Installing plugins via awesome-kubectl-plugins"],"readme":"# kubectl-neat\n\nRemove clutter from Kubernetes manifests to make them more readable.\n\n## Demo\n\nHere is a result of a `kubectl get pod -o yaml` for a simple Pod. The lines marked in red are considered redundant and will be removed from the output by kubectl-neat.\n\n![demo](./demo.png)\n\n## Why\n\nWhen you create a Kubernetes resource, let's say a Pod, Kubernetes adds a whole bunch of internal system information to the yaml or json that you originally authored. This includes:\n\n- Metadata such as creation timestamp, or some internal IDs\n- Fill in for missing attributes with default values\n- Additional system attributes created by admission controllers, such as service account token\n- Status information\n\nIf you try to `kubectl get` resources you have created, they will no longer look like what you originally authored, and will be unreadably verbose.   \n`kubectl-neat` cleans up that redundant information for you.\n\n## Installation\n\n```bash\nkubectl krew install neat\n```\n\nor just download the binary if you prefer.\n\nWhen used as a kubectl plugin the command is `kubectl neat`, and when used as a standalone executable it's `kubectl-neat`.\n\n## Usage\n\nThere are two modes of operation that specify where to get the input document from: a local file or from  Kubernetes.\n\n### Local - file or Stdin\n\nThis is the default mode if you run just `kubectl neat`. This command accepts an optional flag `-f/--file` which specifies the file to neat. It can be a path to a local file, or `-` to read the file from stdin. If omitted, it will default to `-`. The file must be a yaml or json file and a valid Kubernetes resource.\n\nThere's another optional optional flag, `-o/--output` which specifies the format for the output. If omitted it will default to the same format of the input (auto-detected).\n\nExamples:\n```bash\nkubectl get pod mypod -o yaml | kubectl neat\n\nkubectl get pod mypod -oyaml | kubectl neat -o json\n\nkubectl neat -f - \u003c./my-pod.json\n\nkubectl neat -f ./my-pod.json\n\nkubectl neat -f ./my-pod.json --output yaml\n```\n\n### Kubernetes - kubectl get wrapper\n\nThis mode is invoked by calling the `get` subcommand, i.e `kubectl neat get ...`. It is a convenience to run `kubectl get` and then `kubectl neat` the output in a single command. It accepts any argument that `kubectl get` accepts and passes those arguments as is to `kubectl get`. Since it executes `kubectl`, it need to be able to find it in the path.\n\nExamples:\n```bash\nkubectl neat get -- pod mypod -oyaml\nkubectl neat get -- svc -n default myservice --output json\n```\n\n# How it works\n\nBesides general tidying for status, metadata, and empty fields, kubectl-neat primarily looks for two types of things: default values inserted by Kubernetes' object model, and common mutating controllers.\n\n## Kubernetes object model defaults\n\nFor de-defaulting Kubernetes' object model, we invoke the same code that Kubernetes would have, and see what default values were assigned. If these observed values look like the ones we have in the incoming spec, we conclude they are default. If they weren't, and the user manually set a field to it's default value, it's not a bad thing to remove it anyway.\n\n## Common mutating controllers\n\nHere are the [recommended](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#what-does-each-admission-controller-do) admission controllers, and their relation to kubectl-neat:\n\ncontroller | description | neat\n---|---|---\nNamespaceLifecycle | rejects operations on resources in namespaces being deleted | ignore\nLimitRanger | set default values for resource requests and limits | ignore\nServiceAccount | set default service account and assign token | Remove `default-token-*` volumes. Remove deprecated `spec.serviceAccount`\nTaintNodesByCondition | automatically taint a node based on node conditions | TODO\nPriority | validate priority class and add it's value | ignore\nDefaultTolerationSeconds | configure pods to temporarily tolarate notready and unreachable taints | TODO\nDefaultStorageClass | validate and set default storage class for new pvc | ignore\nStorageObjectInUseProtection | prevent deletion of pvc/pv in use by adding a finalizer | ignore\nPersistentVolumeClaimResize | enforce pvc resizing only for enabled storage classes | ignore\nMutatingAdmissionWebhook | implement the mutating webhook feature | ignore\nValidatingAdmissionWebhook | implement the validating webhook feature | ignore\nRuntimeClass | add pod overhead according to runtime class | TODO\nResourceQuota | implement the resource qouta feature | ignore\nKubernetes Scheduler | assign pods to nodes | Remove `spec.nodeName`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitaysk%2Fkubectl-neat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitaysk%2Fkubectl-neat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitaysk%2Fkubectl-neat/lists"}