Skip to content

Commit

Permalink
add goreleaser, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kegley committed Mar 21, 2019
1 parent 4afbf2c commit 6a629fb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
dist/
26 changes: 26 additions & 0 deletions .goreleaser.yml
@@ -0,0 +1,26 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
builds:
- env:
- CGO_ENABLED=0
main: cmd/kubectl-cleanup.go
binary: kubectl-cleanup
archive:
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
env_files:
github_token: ~/.github/release_token
20 changes: 14 additions & 6 deletions README.md
@@ -1,4 +1,4 @@
## kubectl-cleanup ##
# kubectl-cleanup #

kubectl cleanup is a plugin for automatically cleaning up your kubeconfig. Every cloud provider has their own utilities for adding kubernetes cluster credentials to your kubeconfig but they don't offer the ability to clean it up once the cluster is deleted.
For those of us who launch and delete multiple clusters per day, it would be useful to have an automated way to clean up old kubeconfig entries. This plugin will attempt to connect to each cluster defined in a context, if the connection succeeds then the user, cluster, and context entry are maintained in the result. Otherwise, the entries are removed.
Expand All @@ -17,7 +17,6 @@ kubectl cleanup --print-removed --raw > ./kubeconfig-removed.yaml
kubectl cleanup --print-removed -o=jsonpath='{ range.contexts[*] }{ .name }{"\n"}'
```


### cleanup.ignore ###

Add a `~/.kube/cleanup.ignore` to specify contexts which should be ignored during cleanup. The associated context, user, and cluster
Expand All @@ -36,14 +35,23 @@ data:
docker-for-desktop
```

## Install ##

Just download the [latest release binary](https://github.com/b23llc/kubectl-cleanup/releases/latest) for your platform and add it to your PATH


### Building from source ###

`go build cmd/kubectl-cleanup.go`

#### Install ####

### Build ###
`mv kubectl-cleanup /usr/local/bin/.`

go build cmd/kubectl-cleanup.go
#### Release ####

### Install ###
`goreleaser release`

mv kubectl-cleanup /usr/local/bin/.

> Requires `kubectl > v1.12.0`
https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/#before-you-begin
Expand Down

0 comments on commit 6a629fb

Please sign in to comment.