generated from replicatedhq/krew-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
customizes template to init code base
- Loading branch information
1 parent
2e15650
commit 0a63676
Showing
15 changed files
with
37 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
*.out | ||
|
||
bin/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,11 @@ | ||
# kubectl krew template repo | ||
# fleet kubectl | ||
|
||
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. | ||
A `kubectl` plugin to ... | ||
|
||
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 | ||
## Quick Start | ||
|
||
## Create your repo | ||
|
||
[Start here](https://github.com/replicatedhq/krew-plugin-template/generate) 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: | ||
|
||
```shell | ||
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](https://github.com/replicatedhq/krew-plugin-template)). | ||
|
||
Commit and check it in to your repo! | ||
|
||
```shell | ||
git add . | ||
git commit -m "Updating from template" | ||
git push -u origin master | ||
kubectl krew install fleet | ||
kubectl fleet | ||
``` | ||
|
||
## 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](https://github.com/replicatedhq/outdated) plugin that inspired this template. | ||
|
||
To make a local build: | ||
|
||
```shell | ||
make bin | ||
``` | ||
|
||
## Creating a release | ||
|
||
To create a new release of your plugin, create and push a tag. | ||
|
||
```shell | ||
git tag v0.1.0 | ||
git push --tags | ||
``` | ||
|
||
This repo has a built-in GitHub Action that will handle the build process. We use [GoReleaser](https://goreleaser.com) 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
apiVersion: krew.googlecontainertools.github.com/v1alpha2 | ||
kind: Plugin | ||
metadata: | ||
name: {{ .PluginName }} | ||
name: fleet | ||
spec: | ||
version: "v0.1.0" | ||
platforms: | ||
- selector: | ||
matchLabels: | ||
os: linux | ||
arch: amd64 | ||
uri: https://github.com/{{ .Owner }}/{{ .Repo }}/releases/download/v0.1.0/{{ .PluginName }}_linux_amd64.tar.gz | ||
uri: https://github.com/mhausenblas/kcf/releases/download/v0.1.0/fleet_linux_amd64.tar.gz | ||
sha256: "" | ||
files: | ||
- from: "./{{ .PluginName }}" | ||
- from: "./fleet" | ||
to: "." | ||
bin: "{{ .PluginName }}" | ||
bin: "fleet" | ||
- selector: | ||
matchLabels: | ||
os: darwin | ||
arch: amd64 | ||
uri: https://github.com/{{ .Owner }}/{{ .Repo }}/releases/download/v0.1.0/{{ .PluginName }}_darwin_amd64.tar.gz | ||
uri: https://github.com/mhausenblas/kcf/releases/download/v0.1.0/fleet_darwin_amd64.tar.gz | ||
sha256: "" | ||
files: | ||
- from: "./{{ .PluginName }}" | ||
- from: "./fleet" | ||
to: "." | ||
bin: "{{ .PluginName }}" | ||
bin: "fleet" | ||
- selector: | ||
matchLabels: | ||
os: windows | ||
arch: amd64 | ||
uri: https://github.com/{{ .Owner }}/{{ .Repo }}/releases/download/v0.1.0/{{ .PluginName }}_windows_amd64.zip | ||
uri: https://github.com/mhausenblas/kcf/releases/download/v0.1.0/fleet_windows_amd64.zip | ||
sha256: "" | ||
files: | ||
- from: "/{{ .PluginName }}.exe" | ||
- from: "/fleet.exe" | ||
to: "." | ||
bin: "{{ .PluginName }}.exe" | ||
bin: "fleet.exe" | ||
shortDescription: A new plugin | ||
homepage: https://github.com/{{ .Owner }}/{{ .Repo }} | ||
homepage: https://github.com/mhausenblas/kcf | ||
caveats: | | ||
Usage: | ||
$ kubectl {{ .PluginName }} | ||
$ kubectl fleet | ||
For additional options: | ||
$ kubectl {{ .PluginName }} --help | ||
or https://github.com/{{ .Owner }}/{{ .Repo }}/blob/v0.1.0/doc/USAGE.md | ||
$ kubectl fleet --help | ||
or https://github.com/mhausenblas/kcf/blob/v0.1.0/doc/USAGE.md | ||
description: | | ||
This is a new plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module github.com/replicatedhq/krew-plugin-template | ||
module github.com/mhausenblas/kcf | ||
|
||
go 1.12 | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.