Kubectl golang - kubectl krew template repo

kubectl krew template repo

There's a lot of scaffolding needed to set up a good kubectl plugin. This repo is a GitHub Template Repo to make it easy to set all of this scaffolding up for a new repo.

The assumptions made are:

  1. You'll write your plugin in go
  2. You want client-go to interact with the cluster
  3. You want all of the kubectl flags available to your plugin
  4. Your plugin's home will be a github.com repo
  5. Your plugin will work in Linux, MacOS and Windows

Create your repo

Start here to create a new repo based on this template. This is not a fork, it will make a copy of this repo into your own organization or GitHub account.

Click that, and create your own version of this repo. Clone it locally. The rest of the steps you will be performing on your local copy.

Make it yours

Once you have your own repo created locally, change to the directory and run:

make setup

This will prompt you for a few things, such as your GitHub org, repo name and plugin name. The setup application will then update the import paths and code with the data you provided.

(Note, once you've run this step, these instructions will no longer be present in your repo. You can always vew then at https://github.com/replicatedhq/krew-plugin-template).

Commit and check it in to your repo!

git add .
git commit -m "Updating from template"
git push -u origin master

Write your Plugin

Next, open the pkg/plugin/plugin.go file. This is where you can start writing your plugin.

For an example, take a look at the outdated plugin that inspired this template.

To make a local build:

make bin

Creating a release

To create a new release of your plugin, create and push a tag.

git tag v0.1.0 -m 'initial release'
git push --tags

This repo has a built-in GitHub Action that will handle the build process. We use GoReleaser to create tagged releases. This will create all three binaries and push them to the releases page when you push a tag. It will take a few minutes to complete, so be patient.

Submitting to Krew

Be sure to read the guidelines on the Krew Developer guide before submitting you plugin. This is not automated (yet). We've created a starting point for your plugin manifest, look for it in deploy/krew/plugin.yaml.

Share!

Finally, we'd love to hear if you've used this template. Let us know on Twitter at @replicatedhq. We've written a few kubectl plugins too, and are always curious to see what other people are working on.

Owner
geodis
linux syadmin for fun and profit
geodis
Similar Resources

A kubectl plugin for getting endoflife information about your cluster.

A kubectl plugin for getting endoflife information about your cluster.

kubectl-endoflife A kubectl plugin that checks your clusters for component compatibility and Kubernetes version end of life. This plugin is meant to a

Jul 21, 2022

A kubectl plugin to evict pods

kubectl-evict A kubectl plugin to evict pods. This plugin is good to remove a pod from your cluster or to test your PodDistruptionBudget. 💿 Installat

Dec 7, 2022

Kubectl Locality Plugin - A plugin to get the locality of pods

Kubectl Locality Plugin - A plugin to get the locality of pods

Nov 18, 2021

kubectl plugin for generating nginx-ingress compatible basic-auth secrets on kubernetes clusters

kubectl-htpasswd kubectl plugin for easily generating hashed basic auth secrets. Supported hash algorithms bcrypt Examples Create the secret on the cl

Jul 17, 2022

🦥 kubectl plugin to easy to view pod

kubectl-lazy Install curl -sSL https://mirror.ghproxy.com/https://raw.githubusercontent.com/togettoyou/kubectl-lazy/main/install.sh | bash Or you can

Oct 13, 2022

This is kubectl-plugins repository

This is kubectl-plugins repository

golang CLI Template golang project template for building CLI Setup Setup by Command git clone https://github.com/mpppk/cli-template your_awesome_tool

Dec 20, 2021

The Coherence command line interface (CLI) is a lightweight tool, in the tradition of tools such as kubectl

The Coherence command line interface (CLI) is a lightweight tool, in the tradition of tools such as kubectl

Coherence Command Line Interface (CLI) Contents Overview Why use the Coherence C

Dec 15, 2022

Kubectl-over-env - Created for github actions or any other CI/CD-Pipelining tool which cannot push to a custom local kubernetes cluster

kubectl-over-env This repository was created for github actions or any other CI/

Jan 4, 2022

A replacement for "kubectl exec" that works over WebSocket connections.

kubectl-execws A replacement for "kubectl exec" that works over WebSocket connections. Kubernetes API server has support for exec over WebSockets, but

Sep 23, 2022
Provider-template - Template for writing providers for crossplane

provider-template provider-template is a minimal Crossplane Provider that is mea

Feb 3, 2022
This repo houses some Golang introductory files, sample codes and implementations

This repo houses some Golang introductory files, sample codes and implementations. I will be updating it as I keep getting a hang of the language.

Aug 27, 2022
Kubectl plugin to ease sniffing on kubernetes pods using tcpdump and wireshark
Kubectl plugin to ease sniffing on kubernetes pods using tcpdump and wireshark

ksniff A kubectl plugin that utilize tcpdump and Wireshark to start a remote capture on any pod in your Kubernetes cluster. You get the full power of

Jan 4, 2023
colorizes kubectl output
colorizes kubectl output

kubecolor Colorize your kubectl output get pods describe pods something wrong You can change color theme for light-backgrounded environment What's thi

Jan 8, 2023
kubectl plugin for signing Kubernetes manifest YAML files with sigstore
kubectl plugin for signing Kubernetes manifest YAML files with sigstore

k8s-manifest-sigstore kubectl plugin for signing Kubernetes manifest YAML files with sigstore ⚠️ Still under developement, not ready for production us

Nov 28, 2022
A kubectl plugin for finding decoded secret data with productive search flags.

kubectl-secret-data What is it? This is a kubectl plugin for finding decoded secret data. Since kubectl only outputs base64-encoded secrets, it makes

Dec 2, 2022
A 'kubectl' plugin for interacting with Clusternet.

kubectl-clusternet A kubectl plugin for interacting with Clusternet. Installation Install With Krew kubectl-clusternet can be installed using Krew, pl

Aug 14, 2022
kubetnl tunnels TCP connections from within a Kubernetes cluster to a cluster-external endpoint, e.g. to your local machine. (the perfect complement to kubectl port-forward)

kubetnl kubetnl (kube tunnel) is a command line utility to tunnel TCP connections from within a Kubernetes to a cluster-external endpoint, e.g. to you

Dec 16, 2022
Kubectl plugin to run curl commands against kubernetes pods

kubectl-curl Kubectl plugin to run curl commands against kubernetes pods Motivation Sending http requests to kubernetes pods is unnecessarily complica

Dec 22, 2022
A kubectl plugin for finding decoded secret data with productive search flags.

kubectl-secret-data What is it? This is a kubectl plugin for finding decoded secret data. Since kubectl outputs base64-encoded secrets basically, it m

Dec 2, 2022