Giter Site home page Giter Site logo

kubectl-neat's Introduction

kubectl-neat

Remove clutter from Kubernetes manifests to make them more readable.

Demo

Here 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.

demo

Why

When 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:

  • Metadata such as creation timestamp, or some internal IDs
  • Fill in for missing attributes with default values
  • Additional system attributes created by admission controllers, such as service account token
  • Status information

If you try to kubectl get resources you have created, they will no longer look like what you originally authored, and will be unreadably verbose.
kubectl-neat cleans up that redundant information for you.

Installation

kubectl krew install neat

or just download the binary if you prefer.

When used as a kubectl plugin the command is kubectl neat, and when used as a standalone executable it's kubectl-neat.

Usage

There are two modes of operation that specify where to get the input document from: a local file or from Kubernetes.

Local - file or Stdin

This 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.

There'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).

Examples:

kubectl get pod mypod -o yaml | kubectl neat

kubectl get pod mypod -oyaml | kubectl neat -o json

kubectl neat -f - <./my-pod.json

kubectl neat -f ./my-pod.json

kubectl neat -f ./my-pod.json --output yaml

Kubernetes - kubectl get wrapper

This 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.

Examples:

kubectl neat get -- pod mypod -oyaml
kubectl neat get -- svc -n default myservice --output json

How it works

Besides 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.

Kubernetes object model defaults

For 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.

Common mutating controllers

Here are the recommended admission controllers, and their relation to kubectl-neat:

controller description neat
NamespaceLifecycle rejects operations on resources in namespaces being deleted ignore
LimitRanger set default values for resource requests and limits ignore
ServiceAccount set default service account and assign token Remove default-token-* volumes. Remove deprecated spec.serviceAccount
TaintNodesByCondition automatically taint a node based on node conditions TODO
Priority validate priority class and add it's value ignore
DefaultTolerationSeconds configure pods to temporarily tolarate notready and unreachable taints TODO
DefaultStorageClass validate and set default storage class for new pvc ignore
StorageObjectInUseProtection prevent deletion of pvc/pv in use by adding a finalizer ignore
PersistentVolumeClaimResize enforce pvc resizing only for enabled storage classes ignore
MutatingAdmissionWebhook implement the mutating webhook feature ignore
ValidatingAdmissionWebhook implement the validating webhook feature ignore
RuntimeClass add pod overhead according to runtime class TODO
ResourceQuota implement the resource qouta feature ignore
Kubernetes Scheduler assign pods to nodes Remove spec.nodeName

kubectl-neat's People

Contributors

amirschw avatar dependabot[bot] avatar erikgb avatar itaysk avatar jmcshane avatar mig4 avatar olegsu avatar philoserf avatar ryane avatar superbrothers avatar therealjsie avatar vicmarbev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubectl-neat's Issues

Stop adding a line break

This useful command always adds a new line break to the last line of the manifest. This is superfluous and I want to remove it.

$ git show -q
commit cb318129e812c819a80199febc38e5a18e6b64f0 (HEAD -> master, origin/master, origin/HEAD)
Author: karancode <[email protected]>
Date:   Tue Oct 6 18:41:08 2020 +0900

    update ci workflow
$ cat <<EOL | kubectl-neat
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        name: nginx
        resources: {}
status: {}
EOL
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        name: nginx

Fully support List type

This is useful to do things like kubectl get pods -oyaml | kubectl neat. Currently it seems like it does some work, but there are a few fields like managedFields that stick around. Using v1.1.1

Traefik IngressRoute tls option disappear

Be careful with next - spend 2 hours to found out on batch configuration.

k get ingressroute SomeRoute -o yaml
spec:
entryPoints:

  • websecure
    routes:
  • kind: Rule
    match:PathPrefix(/)
    services:
    • name: service
      port: 8000
      tls: {}

k get ingressroute SomeRoute -o yaml | kubectl neat
spec:
entryPoints:

  • websecure
    routes:
  • kind: Rule
    match:PathPrefix(/)
    services:
    • name: service
      port: 8000

Windows release

nothing really prohibits this plugin from running perfectly on windows. just need to add windows CI tests and builds.

  • add e2e test that runs the tool on windows
  • modification to the makefile to cross compile a windows binary

Allow multipart yaml files

When not piping from kubectl directly, there are cases to run neat over multipart yaml docs such as

kind: Deployment
...
---
kind: Service
...

Currently, only the first one is returned and the rest are dropped silently

[krew] Distribute with license

๐Ÿ‘‹ Hello, maintainer of the kubectl plugin manager krew here.

Thank you for your commitment to open source by making this plugin available via krew!

Krew wants to give credit where credit is due by installing the proper license file for the plugins it distributes. However, your plugin was found to not contain any license file. We wanted to remind you that if you're using a license such as Apache 2.0, you should be bundling your LICENSE file with your pluginโ€™s distributions.

What do you have to do?

  • Please ensure your GitHub repository has a license file.
  • Make sure your archive file (.tar.gz or .zip) contains the license file.
  • Please submit a pull-request to krew-index and update the files: section to copy the file to the installation directory. Have a look at this PR for an example: https://github.com/kubernetes-sigs/krew-index/pull/314/files

If you need further assistance, don't hesitate to ask for help.

kubectl neat removing resource values

Input:

    resources:
      limits:
        cpu: "1"
        memory: 1Gi
      requests:
        cpu: 50m
        memory: 1Gi

output after | kubectl neat:

    resources:
      limits:
        cpu: "1"
        memory: 1Gi
      requests:
        cpu: 50m

Maybe there's some default relation between requests and limits but would be nice to see them both usually

[FR] Filter openshift-related fields for Pod resource

This ticket is a feature request to filter fields related to Red Hat OpenShift Container Platform (RHOCP), which is a kubernetes flavor.
kubectl-neat doesn't filter out some useless fields when I do kubectl get pod/mypod -yaml | kubectl-neat that need to be filtered and I suppose were not considered simply because they are custom fields used by RHOCP.
The output of the above command has these useless pieces:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    k8s.v1.cni.cncf.io/network-status: |-
      [{
          "name": "",
          "interface": "eth0",
          "ips": [
              "10.240.16.148"
          ],
          "default": true,
          "dns": {}
      }]
    k8s.v1.cni.cncf.io/networks-status: |-
      [{
          "name": "",
          "interface": "eth0",
          "ips": [
              "10.240.16.148"
          ],
          "default": true,
          "dns": {}
      }]
    openshift.io/deployment-config.latest-version: "6"
    openshift.io/deployment-config.name: "my-deployment-config"
    openshift.io/deployment.name: "my-deployment-config-6"
    openshift.io/scc: restricted

support cleaning up a list of resources

This is a feature request.

While cleaning up a single resource is great, it could also be nice to clean up a whole list of resources.

For example, I would like to do kubectl neat pod -n mynamespace -oyaml in order to get all the uncluttered pods in my namespace.

I can make the PR if you find this useful :)

leverage managedFields

interesting development in Kubernetes 1.18 - server side apply was rearchitected to track field ownership using a metadata field called managedFields. This field can be a great insight for kubectl-neat, especially when it comes to controllers, where it was hard to tell if the field was added by a controller (the should be removed), or by the user (and should be preserved) (For example: #12). we can now use the managedFields field get this information.
Another approach can be to just trim everything that's not managed by the user.

Feature: neat clusterip of service

When i use the command kubectl get svc kubernetes -o yaml | kubectl-neat to get the neat output of the kubernetes service, the clusterIP is not removed. In result of that, when i apply the output to a new k8s cluster, it turns out the apply cannot be executed successfully for the reason of different ServiceCIDR.
So, neating clusterip of service, is that reasonable?

support CRDs

currently if a CRD is processed, NeatDefault will error when trying to decode as a type registered in the schema. A quick fix is to check for type before decoding.

neaten svc yaml could not be applied in a different svcCIDR environment

Description:
When I use the kubectl-neat 2.0.3 to do the clean of yaml file, I found that after neaten the yaml of a svc, the yaml still contains the part of clusterIP and clusterIPs. In the scenario that I generated the yaml file in a svcCIDR range is 172.21.0.0/16 k8s environment, but apply these svc yaml files in a new environment that svcCIDR is 192.168.0.0/16, it will occur the error that 'failed to allocated ip:172.21.132.103 with error:provided IP is not in the valid range. The range of valid IPs is 192.168.0.0/16'.

What I expected to happen:
I think these part 'clusterIP and clusterIPs' in the yaml is not the mandatory part, perhaps it could be remove by the kubectl-neat function. Thanks for your time to look at this issue.

Some addition output I can provide:
Original svc yaml content:

apiVersion: v1
kind: Service
metadata:
annotations:
meta.helm.sh/release-name: minimum
meta.helm.sh/release-namespace: default
creationTimestamp: "2022-09-07T02:19:41Z"
labels:
app: im
app.kubernetes.io/managed-by: Helm
grp: xxxx
managedFields:

  • apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
    f:metadata:
    f:annotations:
    .: {}
    f:meta.helm.sh/release-name: {}
    f:meta.helm.sh/release-namespace: {}
    f:labels:
    .: {}
    f:app: {}
    f:app.kubernetes.io/managed-by: {}
    f:grp: {}
    f:spec:
    f:ports:
    .: {}
    k:{"port":xxx,"protocol":"TCP"}:
    .: {}
    f:name: {}
    f:port: {}
    f:protocol: {}
    f:targetPort: {}
    k:{"port":xxx,"protocol":"TCP"}:
    .: {}
    f:name: {}
    f:port: {}
    f:protocol: {}
    f:targetPort: {}
    f:selector:
    .: {}
    f:app: {}
    f:sessionAffinity: {}
    f:type: {}
    manager: Go-http-client
    operation: Update
    time: "2022-09-07T02:19:41Z"
    name: im
    namespace: default
    resourceVersion: "4366696"
    uid: 8cf3fb18-6703-4e98-91f9-379f1abb0b50
    spec:
    clusterIP: 172.21.132.103
    clusterIPs:
  • 172.21.132.103
    ipFamilies:
  • IPv4
    ipFamilyPolicy: SingleStack
    ports:
  • name: xx
    port: xxxx
    ...............

Neat svc yaml content:

apiVersion: v1
kind: Service
metadata:
annotations:
meta.helm.sh/release-name: minimum
meta.helm.sh/release-namespace: default
labels:
app: im
app.kubernetes.io/managed-by: Helm
grp: xxx
name: im
namespace: default
spec:
clusterIP: 172.21.132.103
clusterIPs:

  • 172.21.132.103
    ipFamilies:
  • IPv4
    ipFamilyPolicy: SingleStack
    ports:
  • name: xxx
    port: xxxx

The error info when I applied the neat yaml in a new env which svcCIDR changed:

The Service "xxx" is invalid: spec.clusterIPs: Invalid value: []string{"172.21.132.103"}: failed to allocated ip:172.21.132.103 with error:provided IP is not in the valid range. The range of valid IPs is 192.168.0.0/16

Environment:

OS:
CentOS Linux release 7.9.2009 (Core)

Kernel:
Linux iZuf638qwylkt54jqjznyuZ 3.10.0-1160.66.1.el7.x86_64 #1 SMP Wed May 18 16:02:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

kubectl neat get all output to separate files

Hi, I'm currently using a script to dump everything in a namespace to yaml:

kubectl neat get all -n pos -o yaml > pos-all.yaml

I'm curious if there's an option similar to kompose tool to output yaml as separate files for each deployment, service, ingress ? I prefer having separate so I can organize them into folders. If this process were automated in a cron on a volume with snapshotting it would make for a great version control solution. Thanks!

Should this project version design under golang module semantic version?

In golang library semantic version design, v2.x.x release is much difference of v1.x.x. All classes is not consistent. And if this library using go module, version 2 should using in github.com/itaysk/kubectl-neat/v2 v2.x.x format.

My solution is fork this repo, and tag v2.0.3 as v1.20.0, so it works for me.

I wish this repo will migrate to github.com/itaysk/kubectl-neat/v2 pkg structure, thanks.

Remove `replace` directives in go.mod so `go install` works

$ go install github.com/itaysk/kubectl-neat@latest
go install github.com/itaysk/kubectl-neat@latest: github.com/itaysk/[email protected]
        The go.mod file for the module providing named packages contains one or
        more replace directives. It must not contain directives that would cause
        it to be interpreted differently than if it were the main module.

This can be fixed by removing the replaces in go.mod. I believe these are not needed anymore, or at least they will not be if the k8s client libraries are updated?

M1 mac arm64 build

Would it be possible to provide builds for the M1 mac?

โœ— kubectl krew install neat
Updated the local copy of plugin index.
Installing plugin: neat
W0321 13:58:17.153568   38001 install.go:164] failed to install plugin "neat": plugin "neat" does not offer installation for this platform
F0321 13:58:17.153611   38001 root.go:79] failed to install some plugins: [neat]: plugin "neat" does not offer installation for this platform

Thanks!

Neat is printing output to stderr

Not sure if it's intended or not, I assume it was introduced in this commit:
297ddff

My use case for neat was something like: kubectl get po foo -oyaml | kubectl neat > foo.yaml which I noticed stopped working on the latest version. Redirecting stderr to the file will of course work: kubectl get po foo -oyaml | kubectl neat 2> foo.yaml, but this is not conforming to the usual kubectl get behavior which is to print to stdout.

kubectl neat removes field from network policy

Hi,

https://kubernetes.io/docs/concepts/services-networking/network-policies/#default-deny-all-egress-traffic
https://kubernetes.io/docs/concepts/services-networking/network-policies/#allow-all-egress-traffic

If we use kubectl neat with two yaml files above, the end results are the same. However for network policies, removing the block below changes the behaviour.

  egress:
  - {}

An example:

cat n.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-egress
spec:
  podSelector:
    matchLabels:
      app: test
  egress:
  - {}
  policyTypes:
  - Egress

kubectl neat -f n.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-egress
spec:
  podSelector:
    matchLabels:
      app: test
  policyTypes:
  - Egress

Expected output:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-egress
spec:
  podSelector:
    matchLabels:
      app: test
  egress:
  - {}
  policyTypes:
  - Egress

Thanks!

cmd: default value of the inputFile flag

inputFile = rootCmd.Flags().StringP("file", "f", "-", "file path to neat, or - to read from stdin")

kubectl-neat/cmd/cmd.go

Lines 60 to 68 in 78c0fa2

if *inputFile == "-" {
stdin := cmd.InOrStdin()
in, err = ioutil.ReadAll(stdin)
} else {
in, err = ioutil.ReadFile(*inputFile)
if err != nil {
return err
}
}

In daily work, when we need to know how to use a command tool(for example: kubectl), we simply execute kubectl -h or just kubectl, then the help information will be shown on the screen. However, kubectl-neat cannot be executed like that which is a little confusing if someone uses the tool directly without reading README.md carefully.

Few wrong results when using kubectl-neat with kubevirt CRD (VirtualMachineInstance)

Hi, thanks for the great tool

This is a bug report / feature request.
When trying to use kubectl-neaton VirtualMachineInstance yaml
The result is great beside few problems (https://www.diffchecker.com/H6mj1YnW)

  1. The following fields should be left untouched please if possible
      interfaces:	
      - masquerade: {}	
        name: default	
      rng: {}
 networks:	
  - name: default	
    pod: {}

Maybe a robust concept like profiles which say what fields to touch / untouch can help in such cases ?
Unless this specific case can be solved hardcoded.

  1. The following fields should be removed please if possible.
    I understand some of it is not feasible to auto detect, unless there is a configurable filter,
    Can a filter be implemented ? such as it will say remove all annotations / labels beside xyz that maybe the user do want to keep.
metadata:
  annotations:
    kubevirt.io/latest-observed-api-version: v1
    kubevirt.io/storage-observed-api-version: v1
    kubevirt.io/vm-generation: "1"
  labels:
    kubevirt.io/nodeName: node02
    kubevirt.io/vm: vm-fedora

Thanks

error neating : error in neatDefaults

I am trying to use this module to easily move secrets between namespaces, however when I attempt to neat an image pull secret with docker config inside, the following error is returned:

2020/04/02 16:02:08 error neating : error in neatDefaults : error flattening json : error unmarshaling: unexpected end of JSON input

I have attempted to use the module directly as a kubectl plugin: kubectl neat secret regcred -oyaml, and also by piping the output of kubectl get: kubectl get secret regcred -oyaml | kubectl-neat, but both give the same error.

Additionally, when I don't specify an output format, the following error is returned:

2020/04/02 16:03:48 error neating : error in neatDefaults : error unmarshaling as PartialObject : json: cannot unmarshal string into Go value of type v1.PartialObjectMetadata

System Details:
OS: macOS 10.15.3
neat version: v1.1.0

Kubernetes:

Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T23:41:55Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.10-gke.27", GitCommit:"145f9e21a4515947d6fb10819e5a336aff1b6959", GitTreeState:"clean", BuildDate:"2020-02-21T18:01:40Z", GoVersion:"go1.12.12b4", Compiler:"gc", Platform:"linux/amd64"}

Krew:

GitTag        v0.3.3
GitCommit     71418fa
IndexURI      https://github.com/kubernetes-sigs/krew-index.git
BasePath      /Users/mhill/.krew
IndexPath     /Users/mhill/.krew/index
InstallPath   /Users/mhill/.krew/store
DownloadPath  /var/folders/fv/p5zj_bcd71xfk_cl47j6mxm40000gn/T/krew-downloads
BinPath       /Users/mhill/.krew/bin

Please let me know if additional information is needed. Thanks!

Error when you don't supply an output format

This is probably a user error, but maybe there could be a better message to indicate I just didn't fully read the README before trying to use this great tool ๐Ÿ˜„

$ kubectl neat nodes
2020/06/11 16:43:21 error neating : error in neatDefaults : error unmarshaling as PartialObject : json: cannot unmarshal string into Go value of type v1.PartialObjectMetadata

whereas I should've been doing kubectl neat nodes -o yaml or -o json.

URI: https://github.com/itaysk/kubectl-neat/releases/download/v1.2.0/kubectl-neat_linux.tar.gz
SHA256: d515a1c09c4450f7a9ab30bcdccd516f18a4dfd8c42311ffb41fb53d7c8ff2c8
VERSION: v1.2.0

Using neat on windows 64-bit platform

k krew install neat
Updated the local copy of plugin index.
Installing plugin: neat
W1217 13:46:29.914981 16380 install.go:164] failed to install plugin "neat": plugin "neat" does not offer installation for this platform
F1217 13:46:29.952985 16380 root.go:79] failed to install some plugins: [neat]: plugin "neat" does not offer installation for this platform
exit status 255

Clusterrole removes required field

$ echo 'apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: role
rules:
- apiGroups:
  - ""
  resources:
  - services
  verbs:
  - get
  - list
  - watch
  - patch' | kubectl neat | kubectl apply -f -
The ClusterRole "role" is invalid: rules[0].apiGroups: Required value: resource rules must supply at least one api group

Looks like we remove the apiGroups: [""] which leads to a rejection when applying

simplify release

the make file includes 2 release related targets, release and krew. release invokes goreleaser, and krew invokes release and builds the krew manifest.
In order to release, I run make krew --publish=1. this is great but there's no real use case for anyone to invoke the release target, so it's better to have a make release that invokes goreleaser and builds the krew file.
Additionally, before releasing I have to manully update the krew template file. This should be automated in the same make recipe.

Typo in Repo description

There is a little typo in the repo description:

Clean up Kuberntes yaml and json output to make it readable

Kubernetes is missing an E.

NeatEmpty may be too agressive

NeatEmpty will look for empty resources and clean up their entire hierarchy if necessary. This was originally designed to handle the fact the Neaters may leave fields empty after they finish working, however it may not always work for the benefit of the user.
consider the following common CRD in Istio:

apiVersion: "authentication.istio.io/v1alpha1"
kind: "Policy"
metadata:
  name: "default"
  namespace: "foo"
spec:
  peers:
  - mtls: {}

NeatEmpty will end up deleting .spec altogether.

Pod tolerations field is not removed

a "neat" pod still has the tolerations field intact. need to investigate why this is not recognized as a default, or think if it make sense to manually clean as part of NeatPod.

eliminate redundant CI runs

#13 added basic CI but I noticed it's building twice on a common use case: once for push and again for PR event. the fix is probably something with adding branch filtering to the triggers.

Metadata isn't removed from lists

This part of code doesn't get executed when neat-ing lists:

kubectl-neat/cmd/neat.go

Lines 76 to 88 in f975c89

// general neating
draft, err = neatMetadata(draft)
if err != nil {
return draft, fmt.Errorf("error in neatMetadata : %v", err)
}
draft, err = neatStatus(draft)
if err != nil {
return draft, fmt.Errorf("error in neatStatus : %v", err)
}
draft, err = neatEmpty(draft)
if err != nil {
return draft, fmt.Errorf("error in neatEmpty : %v", err)
}

Therefore, metadata isn't removed:
image

Run tests requiring kubernetes in CI

PR #13 addresses #5 but only runs the basic tests which don't require Kubernetes. It should be possible to extend the workflow added in #13 to run all tests by using a local temporary instance.

One way of getting one would be to use an action that sets it up in the execution environment like:

Once that's added it should be enough to just change the last step to make test.

How to ignore deployment revision and restartedat

hi,

how can I extend the code so that it ignores the following k8s Deployments properties
metatdata.annotations.deployment.kubernetes.io/revision
spec.template.metadata.annotations.kubectl.kubernetes.io/restartedAt

If you point me in the right direction I can do the change myself.
Thank you.

Suggestion: Add version flag

It's currently not possible to request the version of kubectl-neat. I suggest an build in --version option to display the current version.

`kubectl neat pod` error when kubectl is an alias

reported by Polymerase here: https://stackoverflow.com/questions/62077977/kubectl-get-o-yaml-is-it-posible-to-hide-metadata-managedfields/62111936?noredirect=1#comment109868163_62111936

This is SUPER 'neat' thank you very much. Just a little hiccup with the syntax kubectl neat pod/mypod-abcd -oyaml using microk8s: "error while running [kubectl get pod/mypod-abcd -oyaml]: exec: "kubectl": executable file not found in $PATH" This is because the alias kubectl='microk8s.kubectl' is not expanded in non-interactive use. kubectl neat pod/mypod -oyaml | kubectl neat works OK.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.