From f3218ec271dc54ecb9f1fff71fb5cf6ed480af7d Mon Sep 17 00:00:00 2001 From: Phil Dibowitz Date: Mon, 4 Mar 2024 21:24:04 -0800 Subject: [PATCH] Update README; add MDL (#2) Signed-off-by: Phil Dibowitz --- .github/workflows/lint.yml | 7 ++++++ README.md | 49 ++++++++++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ac280b7..bc3bd3c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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/markdownlint@1.2.0 diff --git a/README.md b/README.md index 3ce8079..7f5e1c1 100644 --- a/README.md +++ b/README.md @@ -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 | grep +kubectl describe pod +kubectl delete pod +kubectl get pods -o wide | grep | grep +... ``` Now you can do: + ```shell -kubectl d get -N +kubectl d describe -N +kubectl d delete -N ``` ## General Usage @@ -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?** @@ -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.