Giter VIP home page Giter VIP logo

kubectl-relate-resources's Introduction

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.

kubectl-relate-resources's People

Contributors

shijieqin avatar

Watchers

James Cloos avatar  avatar

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.