mine
derailed 2021-03-15 11:01:47 -06:00
parent 3a3b9b5074
commit 3792d30031
7 changed files with 519 additions and 321 deletions

33
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: K9s Checks
on:
push:
branches:
- master
tags:
- rc*
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Setup GO env
run: go env -w CGO_ENABLED=0
- name: Checkout Code
uses: actions/checkout@v2
- name: Run Tests
run: make test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

68
go.mod
View File

@ -1,22 +1,52 @@
module github.com/derailed/k9s
go 1.15
go 1.16
replace (
github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d
github.com/docker/docker => github.com/moby/moby v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
k8s.io/api => k8s.io/api v0.20.2
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.20.2
k8s.io/apimachinery => k8s.io/apimachinery v0.20.2
k8s.io/apiserver => k8s.io/apiserver v0.20.2
k8s.io/cli-runtime => k8s.io/cli-runtime v0.20.2
k8s.io/client-go => k8s.io/client-go v0.20.2
k8s.io/cloud-provider => k8s.io/cloud-provider v0.20.2
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.20.2
k8s.io/code-generator => k8s.io/code-generator v0.20.2
k8s.io/component-base => k8s.io/component-base v0.20.2
k8s.io/cri-api => k8s.io/cri-api v0.20.2
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.20.2
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.20.2
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.20.2
k8s.io/kube-proxy => k8s.io/kube-proxy v0.20.2
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.20.2
k8s.io/kubectl => k8s.io/kubectl v0.20.2
k8s.io/kubelet => k8s.io/kubelet v0.20.2
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.20.2
k8s.io/metrics => k8s.io/metrics v0.20.2
k8s.io/sample-apiserver => k8s.ios/sample-apiserver v0.20.2
)
require (
github.com/Azure/go-autorest v14.0.0+incompatible // indirect
github.com/atotto/clipboard v0.1.2
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/cenkalti/backoff/v4 v4.1.0
github.com/derailed/popeye v0.9.0
github.com/derailed/tview v0.4.9
github.com/drone/envsubst v1.0.2 // indirect
github.com/emicklei/go-restful v2.15.0+incompatible // indirect
github.com/fatih/color v1.10.0
github.com/fsnotify/fsnotify v1.4.9
github.com/fvbommel/sortorder v1.0.2
github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591
github.com/ghodss/yaml v1.0.0
github.com/golang/protobuf v1.4.2 // indirect
github.com/go-openapi/spec v0.20.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gnostic v0.5.4 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-runewidth v0.0.9
github.com/openfaas/faas v0.0.0-20200207215241-6afae214e3ec
github.com/openfaas/faas-cli v0.0.0-20200124160744-30b7cec9634c
@ -26,23 +56,23 @@ require (
github.com/rs/zerolog v1.20.0
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sahilm/fuzzy v0.1.0
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.6.1
golang.org/x/net v0.0.0-20200519113804-d87ec0cfa476 // indirect
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect
golang.org/x/text v0.3.2
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587 // indirect
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.7.0
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
golang.org/x/text v0.3.5
google.golang.org/grpc v1.29.1 // indirect
gopkg.in/yaml.v2 v2.2.8
helm.sh/helm/v3 v3.2.0
k8s.io/api v0.18.8
k8s.io/apimachinery v0.18.8
k8s.io/cli-runtime v0.18.8
k8s.io/client-go v0.18.8
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
helm.sh/helm/v3 v3.5.3
k8s.io/api v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/cli-runtime v0.20.2
k8s.io/client-go v0.20.2
k8s.io/klog v1.0.0
k8s.io/kubectl v0.18.2
k8s.io/metrics v0.18.8
rsc.io/letsencrypt v0.0.3 // indirect
k8s.io/klog/v2 v2.8.0 // indirect
k8s.io/kube-openapi v0.0.0-20210305164622-f622666832c1 // indirect
k8s.io/kubectl v0.20.2
k8s.io/metrics v0.20.2
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
sigs.k8s.io/yaml v1.2.0
vbom.ml/util v0.0.0-20180919145318-efcd4e0f9787 // indirect
)

729
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,7 @@ func (o DrainOptions) toDrainHelper(k kubernetes.Interface, w io.Writer) drain.H
Client: k,
GracePeriodSeconds: o.GracePeriodSeconds,
Timeout: o.Timeout,
DeleteLocalData: o.DeleteLocalData,
DeleteEmptyDirData: o.DeleteEmptyDirData,
IgnoreAllDaemonSets: o.IgnoreAllDaemonSets,
Out: w,
ErrOut: w,

View File

@ -77,7 +77,7 @@ type DrainOptions struct {
GracePeriodSeconds int
Timeout time.Duration
IgnoreAllDaemonSets bool
DeleteLocalData bool
DeleteEmptyDirData bool
Force bool
}

View File

@ -48,8 +48,8 @@ func ShowDrain(view ResourceViewer, path string, defaults dao.DrainOptions, okFn
f.AddCheckbox("Ignore DaemonSets:", defaults.IgnoreAllDaemonSets, func(v bool) {
opts.IgnoreAllDaemonSets = v
})
f.AddCheckbox("Delete Local Data:", defaults.DeleteLocalData, func(v bool) {
opts.DeleteLocalData = v
f.AddCheckbox("Delete Local Data:", defaults.DeleteEmptyDirData, func(v bool) {
opts.DeleteEmptyDirData = v
})
f.AddCheckbox("Force:", defaults.Force, func(v bool) {
opts.Force = v

View File

@ -73,7 +73,7 @@ func (n *Node) drainCmd(evt *tcell.EventKey) *tcell.EventKey {
defaults := dao.DrainOptions{
GracePeriodSeconds: -1,
Timeout: 5 * time.Second,
DeleteLocalData: false,
DeleteEmptyDirData: false,
IgnoreAllDaemonSets: false,
}
ShowDrain(n, path, defaults, drainNode)