Skip to content

Commit

Permalink
Update README; add MDL (#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Phil Dibowitz <[email protected]>
  • Loading branch information
jaymzh authored Mar 5, 2024
1 parent ce03c9a commit f3218ec
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ jobs:
with:
version: latest
args: --timeout=5m
markdownlint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: MarkdownLint mdl Action
uses: actionshub/[email protected]
49 changes: 39 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# kubectl-daemons

[![Lint](https://github.com/jaymzh/kubectl-daemons/workflows/Lint/badge.svg)](https://github.com/jaymzh/kubectl-daemons/actions?query=workflow%3ALint) [![Build](https://github.com/jaymzh/kubectl-daemons/workflows/Build/badge.svg)](https://github.com/jaymzh/kubectl-daemons/actions?query=workflow%3ABuild) [![DCO](https://github.com/jaymzh/kubectl-daemons/workflows/DCO%20Check/badge.svg)](https://github.com/jaymzh/kubectl-daemons/actions?query=workflow%3A%22DCO+Check%22)
[![Lint](https://github.com/jaymzh/kubectl-daemons/actions/workflows/lint.yml/badge.svg?branch=main&event=push)](https://github.com/jaymzh/kubectl-daemons/actions/workflows/lint.yml)
[![Build](https://github.com/jaymzh/kubectl-daemons/actions/workflows/build.yml/badge.svg?branch=main&event=push)](https://github.com/jaymzh/kubectl-daemons/actions/workflows/build.yml)

## Intro

kubectl-daemons is a kubectl plugin to help with daemonset work. When running
a kubernetes infrastructure, it is common to do lots of work with deamonsets,
but the tools are optimized for other types of k8s objects. With daemonsets,
you often know a node and a DS you care about, and this plugin lets you focus
on that.
kubectl-daemons is a kubectl plugin to help with daemonset work. When running a
kubernetes infrastructure, it is common to do lots of work with deamonsets, but
the tools are optimized for other types of k8s objects. With daemonsets, you
often know a node and a DS you care about, and this plugin lets you focus on
that.

Previously you'd do things like:

```shell
kubectl get pods -o wide | grep <daemonset> | grep <node>
kubectl describe pod <pod_from_above>
kubectl delete pod <pod_from_above>
kubectl get pods -o wide | grep <daemonset> | grep <node>
...
```

Now you can do:

```shell
kubectl d get <daemonset> -N <node>
kubectl d describe <daemonset> -N <node>
kubectl d delete <daemonset> -N <node>
```

## General Usage
Expand Down Expand Up @@ -92,15 +99,21 @@ goreleaser release

## Thanks

A huge thanks to Benjamin Muschko's [Writing your first kubectl plugin](https://bmuschko.com/blog/writing-your-first-kubectl-plugin/) blog post and associated [GH repo](https://github.com/bmuschko/kubectl-server-version). This was invaluable in getting me up and running.
A huge thanks to Benjamin Muschko's [Writing your first kubectl
plugin](https://bmuschko.com/blog/writing-your-first-kubectl-plugin/) blog post
and associated [GH repo](https://github.com/bmuschko/kubectl-server-version).
This was invaluable in getting me up and running.

## FAQ

**Why not just write a simple shell wrapper?**

For many reasons. First, I had that, and it's quite slow. You end up doing more queries than you need, and if your API servers are on the other side of privatelinks, it can get quite slow.
For many reasons. First, I had that, and it's quite slow. You end up doing more
queries than you need, and if your API servers are on the other side of
privatelinks, it can get quite slow.

Second, I wanted a good excuse to learn some golang and get better at Kube internals.
Second, I wanted a good excuse to learn some golang and get better at Kube
internals.

**Aren't there already other plugins that do this?**

Expand All @@ -109,3 +122,19 @@ Not that I could find!
**Can I contribute?**

Sure, send a pull request!

**Why did you end up re-implementing so much kubectl formatting code?**

Trust me, I didn't want to. Unfortunately kubectl plugins aren't really
"plugins". They're standalone binaries that `kubectl` executes for you. So you
can use whatever is in the k8s libraries, but various things kubectl does like
formatting `describe` output, or various calculated fields, are note exposed as
functions other code can call.

Ideally, plugins would be a library that could hook into various stages within
kubectl and allow you to not have to implement so much yourself, but it turns
out that's not how kubectl plugins work.

**Will you be submitting this to Krew?**

Yes! That'll happen very soon.

0 comments on commit f3218ec

Please sign in to comment.