From c74ebb68fb1121f45029703bb742c49d2f52f0bf Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:03:14 +0200 Subject: [PATCH 01/10] feat: bump k8s v0.30.3 --- go.mod | 57 ++++++++- go.sum | 308 +++++++++++++++++++--------------------------- kube/arguments.go | 192 ++++++++++++++--------------- kube/completer.go | 15 +-- kube/resource.go | 205 +++++++++++++----------------- main.go | 6 +- 6 files changed, 371 insertions(+), 412 deletions(-) diff --git a/go.mod b/go.mod index 8ae578b..6eb44ab 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,56 @@ module github.com/c-bata/kube-prompt require ( - github.com/c-bata/go-prompt v0.2.5 - github.com/googleapis/gnostic v0.2.0 // indirect - k8s.io/api v0.17.0 - k8s.io/apimachinery v0.17.0 - k8s.io/client-go v0.17.0 + github.com/c-bata/go-prompt v0.2.6 + k8s.io/api v0.30.3 + k8s.io/apimachinery v0.30.3 + k8s.io/client-go v0.30.3 ) -go 1.15 +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.22.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/imdario/mergo v0.3.6 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.7 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-tty v0.0.3 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pkg/term v1.2.0-beta.2 // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/oauth2 v0.10.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.3.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.33.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/klog/v2 v2.120.1 // indirect + k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect +) + +go 1.22.0 + +toolchain go1.22.5 diff --git a/go.sum b/go.sum index beb048b..8fc9218 100644 --- a/go.sum +++ b/go.sum @@ -1,84 +1,55 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0 h1:ROfEUZz+Gh5pa62DJWXSaonyu3StP6EA6lPEXPI6mCo= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/c-bata/go-prompt v0.2.5 h1:3zg6PecEywxNn0xiqcXHD96fkbxghD+gdB2tbsYfl+Y= -github.com/c-bata/go-prompt v0.2.5/go.mod h1:vFnjEGDIIA/Lib7giyE4E9c50Lvl8j0S+7FVlAwDAVw= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/c-bata/go-prompt v0.2.6 h1:POP+nrHE+DfLYx370bedwNhsqmpCUynWPxuHi0C5vZI= +github.com/c-bata/go-prompt v0.2.6/go.mod h1:/LMAke8wD2FsNu9EXNdHxNLbd9MedkPnCdfpU9wwHfY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= -github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= -github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= -github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= -github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g= -github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/391+sT5o= -github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= -github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -94,132 +65,111 @@ github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvr github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= -github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pkg/term v1.1.0 h1:xIAAdCMh3QIAy+5FrE8Ad8XoDhEU4ufwbaSozViP9kk= -github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= +github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= +github.com/pkg/term v1.2.0-beta.2 h1:L3y/h2jkuBVFdWiJvNfYfKmzcCnILw7mJWm2JQuMppw= +github.com/pkg/term v1.2.0-beta.2/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI= -golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200918174421-af09f7315aff h1:1CPUrky56AcgSpxz/KfgzQWzfG09u5YOL8MvPYBlrL8= golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.17.0 h1:H9d/lw+VkZKEVIUc8F3wgiQ+FUXTTr21M87jXLU7yqM= -k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= -k8s.io/apimachinery v0.17.0 h1:xRBnuie9rXcPxUkDizUsGvPf1cnlZCFu210op7J7LJo= -k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= -k8s.io/client-go v0.17.0 h1:8QOGvUGdqDMFrm9sD6IUFl256BcffynGoe80sxgTEDg= -k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= -k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= -k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= -k8s.io/utils v0.0.0-20191114184206-e782cd3c129f h1:GiPwtSzdP43eI1hpPCbROQCCIgCuiMMNF8YUVLF3vJo= -k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= -sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= -sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= +k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= +k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= +k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k= +k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/kube/arguments.go b/kube/arguments.go index 275de94..5d2cab3 100644 --- a/kube/arguments.go +++ b/kube/arguments.go @@ -1,6 +1,10 @@ package kube -import prompt "github.com/c-bata/go-prompt" +import ( + "context" + + "github.com/c-bata/go-prompt" +) var commands = []prompt.Suggest{ {Text: "get", Description: "Display one or many resources"}, @@ -93,7 +97,7 @@ var resourceTypes = []prompt.Suggest{ {Text: "svc"}, } -func (c *Completer) argumentsCompleter(namespace string, args []string) []prompt.Suggest { +func (c *Completer) argumentsCompleter(ctx context.Context, namespace string, args []string) []prompt.Suggest { if len(args) <= 1 { return prompt.FilterHasPrefix(commands, args[0], true) } @@ -160,47 +164,45 @@ func (c *Completer) argumentsCompleter(namespace string, args []string) []prompt if len(args) == 3 { switch second { case "componentstatuses", "cs": - return prompt.FilterContains(getComponentStatusCompletions(c.client), third, true) + return prompt.FilterContains(getComponentStatusCompletions(ctx, c.client), third, true) case "configmaps", "cm": - return prompt.FilterContains(getConfigMapSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getConfigMapSuggestions(ctx, c.client, namespace), third, true) case "daemonsets", "ds": - return prompt.FilterContains(getDaemonSetSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getDaemonSetSuggestions(ctx, c.client, namespace), third, true) case "deploy", "deployments": - return prompt.FilterContains(getDeploymentSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getDeploymentSuggestions(ctx, c.client, namespace), third, true) case "endpoints", "ep": - return prompt.FilterContains(getEndpointsSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getEndpointsSuggestions(ctx, c.client, namespace), third, true) case "ingresses", "ing": - return prompt.FilterContains(getIngressSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getIngressSuggestions(ctx, c.client, namespace), third, true) case "limitranges", "limits": - return prompt.FilterContains(getLimitRangeSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getLimitRangeSuggestions(ctx, c.client, namespace), third, true) case "namespaces", "ns": return prompt.FilterContains(getNameSpaceSuggestions(c.namespaceList), third, true) case "no", "nodes": - return prompt.FilterContains(getNodeSuggestions(c.client), third, true) + return prompt.FilterContains(getNodeSuggestions(ctx, c.client), third, true) case "po", "pod", "pods": - return prompt.FilterContains(getPodSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), third, true) case "persistentvolumeclaims", "pvc": - return prompt.FilterContains(getPersistentVolumeClaimSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPersistentVolumeClaimSuggestions(ctx, c.client, namespace), third, true) case "persistentvolumes", "pv": - return prompt.FilterContains(getPersistentVolumeSuggestions(c.client), third, true) - case "podsecuritypolicies", "psp": - return prompt.FilterContains(getPodSecurityPolicySuggestions(c.client), third, true) + return prompt.FilterContains(getPersistentVolumeSuggestions(ctx, c.client), third, true) case "podtemplates": - return prompt.FilterContains(getPodTemplateSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodTemplateSuggestions(ctx, c.client, namespace), third, true) case "replicasets", "rs": - return prompt.FilterContains(getReplicaSetSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getReplicaSetSuggestions(ctx, c.client, namespace), third, true) case "replicationcontrollers", "rc": - return prompt.FilterContains(getReplicationControllerSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getReplicationControllerSuggestions(ctx, c.client, namespace), third, true) case "resourcequotas", "quota": - return prompt.FilterContains(getResourceQuotasSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getResourceQuotasSuggestions(ctx, c.client, namespace), third, true) case "secrets": - return prompt.FilterContains(getSecretSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getSecretSuggestions(ctx, c.client, namespace), third, true) case "sa", "serviceaccounts": - return prompt.FilterContains(getServiceAccountSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getServiceAccountSuggestions(ctx, c.client, namespace), third, true) case "svc", "services": - return prompt.FilterContains(getServiceSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getServiceSuggestions(ctx, c.client, namespace), third, true) case "job", "jobs": - return prompt.FilterContains(getJobSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getJobSuggestions(ctx, c.client, namespace), third, true) } } case "describe": @@ -213,47 +215,45 @@ func (c *Completer) argumentsCompleter(namespace string, args []string) []prompt if len(args) == 3 { switch second { case "componentstatuses", "cs": - return prompt.FilterContains(getComponentStatusCompletions(c.client), third, true) + return prompt.FilterContains(getComponentStatusCompletions(ctx, c.client), third, true) case "configmaps", "cm": - return prompt.FilterContains(getConfigMapSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getConfigMapSuggestions(ctx, c.client, namespace), third, true) case "daemonsets", "ds": - return prompt.FilterContains(getDaemonSetSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getDaemonSetSuggestions(ctx, c.client, namespace), third, true) case "deploy", "deployments": - return prompt.FilterContains(getDeploymentSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getDeploymentSuggestions(ctx, c.client, namespace), third, true) case "endpoints", "ep": - return prompt.FilterContains(getEndpointsSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getEndpointsSuggestions(ctx, c.client, namespace), third, true) case "ingresses", "ing": - return prompt.FilterContains(getIngressSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getIngressSuggestions(ctx, c.client, namespace), third, true) case "limitranges", "limits": - return prompt.FilterContains(getLimitRangeSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getLimitRangeSuggestions(ctx, c.client, namespace), third, true) case "namespaces", "ns": return prompt.FilterContains(getNameSpaceSuggestions(c.namespaceList), third, true) case "no", "nodes": - return prompt.FilterContains(getNodeSuggestions(c.client), third, true) + return prompt.FilterContains(getNodeSuggestions(ctx, c.client), third, true) case "po", "pod", "pods": - return prompt.FilterContains(getPodSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), third, true) case "persistentvolumeclaims", "pvc": - return prompt.FilterContains(getPersistentVolumeClaimSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPersistentVolumeClaimSuggestions(ctx, c.client, namespace), third, true) case "persistentvolumes", "pv": - return prompt.FilterContains(getPersistentVolumeSuggestions(c.client), third, true) - case "podsecuritypolicies", "psp": - return prompt.FilterContains(getPodSecurityPolicySuggestions(c.client), third, true) + return prompt.FilterContains(getPersistentVolumeSuggestions(ctx, c.client), third, true) case "podtemplates": - return prompt.FilterContains(getPodTemplateSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodTemplateSuggestions(ctx, c.client, namespace), third, true) case "replicasets", "rs": - return prompt.FilterContains(getReplicaSetSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getReplicaSetSuggestions(ctx, c.client, namespace), third, true) case "replicationcontrollers", "rc": - return prompt.FilterContains(getReplicationControllerSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getReplicationControllerSuggestions(ctx, c.client, namespace), third, true) case "resourcequotas", "quota": - return prompt.FilterContains(getResourceQuotasSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getResourceQuotasSuggestions(ctx, c.client, namespace), third, true) case "secrets": - return prompt.FilterContains(getSecretSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getSecretSuggestions(ctx, c.client, namespace), third, true) case "sa", "serviceaccounts": - return prompt.FilterContains(getServiceAccountSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getServiceAccountSuggestions(ctx, c.client, namespace), third, true) case "svc", "services": - return prompt.FilterContains(getServiceSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getServiceSuggestions(ctx, c.client, namespace), third, true) case "job", "jobs": - return prompt.FilterContains(getJobSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getJobSuggestions(ctx, c.client, namespace), third, true) } } case "create": @@ -279,47 +279,45 @@ func (c *Completer) argumentsCompleter(namespace string, args []string) []prompt if len(args) == 3 { switch second { case "componentstatuses", "cs": - return prompt.FilterContains(getComponentStatusCompletions(c.client), third, true) + return prompt.FilterContains(getComponentStatusCompletions(ctx, c.client), third, true) case "configmaps", "cm": - return prompt.FilterContains(getConfigMapSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getConfigMapSuggestions(ctx, c.client, namespace), third, true) case "daemonsets", "ds": - return prompt.FilterContains(getDaemonSetSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getDaemonSetSuggestions(ctx, c.client, namespace), third, true) case "deploy", "deployments": - return prompt.FilterContains(getDeploymentSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getDeploymentSuggestions(ctx, c.client, namespace), third, true) case "endpoints", "ep": - return prompt.FilterContains(getEndpointsSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getEndpointsSuggestions(ctx, c.client, namespace), third, true) case "ingresses", "ing": - return prompt.FilterContains(getIngressSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getIngressSuggestions(ctx, c.client, namespace), third, true) case "limitranges", "limits": - return prompt.FilterContains(getLimitRangeSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getLimitRangeSuggestions(ctx, c.client, namespace), third, true) case "namespaces", "ns": return prompt.FilterContains(getNameSpaceSuggestions(c.namespaceList), third, true) case "no", "nodes": - return prompt.FilterContains(getNodeSuggestions(c.client), third, true) + return prompt.FilterContains(getNodeSuggestions(ctx, c.client), third, true) case "po", "pod", "pods": - return prompt.FilterContains(getPodSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), third, true) case "persistentvolumeclaims", "pvc": - return prompt.FilterContains(getPersistentVolumeClaimSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPersistentVolumeClaimSuggestions(ctx, c.client, namespace), third, true) case "persistentvolumes", "pv": - return prompt.FilterContains(getPersistentVolumeSuggestions(c.client), third, true) - case "podsecuritypolicies", "psp": - return prompt.FilterContains(getPodSecurityPolicySuggestions(c.client), third, true) + return prompt.FilterContains(getPersistentVolumeSuggestions(ctx, c.client), third, true) case "podtemplates": - return prompt.FilterContains(getPodTemplateSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodTemplateSuggestions(ctx, c.client, namespace), third, true) case "replicasets", "rs": - return prompt.FilterContains(getReplicaSetSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getReplicaSetSuggestions(ctx, c.client, namespace), third, true) case "replicationcontrollers", "rc": - return prompt.FilterContains(getReplicationControllerSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getReplicationControllerSuggestions(ctx, c.client, namespace), third, true) case "resourcequotas", "quota": - return prompt.FilterContains(getResourceQuotasSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getResourceQuotasSuggestions(ctx, c.client, namespace), third, true) case "secrets": - return prompt.FilterContains(getSecretSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getSecretSuggestions(ctx, c.client, namespace), third, true) case "sa", "serviceaccounts": - return prompt.FilterContains(getServiceAccountSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getServiceAccountSuggestions(ctx, c.client, namespace), third, true) case "svc", "services": - return prompt.FilterContains(getServiceSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getServiceSuggestions(ctx, c.client, namespace), third, true) case "job", "jobs": - return prompt.FilterContains(getJobSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getJobSuggestions(ctx, c.client, namespace), third, true) } } case "edit": @@ -331,47 +329,45 @@ func (c *Completer) argumentsCompleter(namespace string, args []string) []prompt third := args[2] switch args[1] { case "componentstatuses", "cs": - return prompt.FilterContains(getComponentStatusCompletions(c.client), third, true) + return prompt.FilterContains(getComponentStatusCompletions(ctx, c.client), third, true) case "configmaps", "cm": - return prompt.FilterContains(getConfigMapSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getConfigMapSuggestions(ctx, c.client, namespace), third, true) case "daemonsets", "ds": - return prompt.FilterContains(getDaemonSetSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getDaemonSetSuggestions(ctx, c.client, namespace), third, true) case "deploy", "deployments": - return prompt.FilterContains(getDeploymentSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getDeploymentSuggestions(ctx, c.client, namespace), third, true) case "endpoints", "ep": - return prompt.FilterContains(getEndpointsSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getEndpointsSuggestions(ctx, c.client, namespace), third, true) case "ingresses", "ing": - return prompt.FilterContains(getIngressSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getIngressSuggestions(ctx, c.client, namespace), third, true) case "limitranges", "limits": - return prompt.FilterContains(getLimitRangeSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getLimitRangeSuggestions(ctx, c.client, namespace), third, true) case "namespaces", "ns": return prompt.FilterContains(getNameSpaceSuggestions(c.namespaceList), third, true) case "no", "nodes": - return prompt.FilterContains(getNodeSuggestions(c.client), third, true) + return prompt.FilterContains(getNodeSuggestions(ctx, c.client), third, true) case "po", "pod", "pods": - return prompt.FilterContains(getPodSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), third, true) case "persistentvolumeclaims", "pvc": - return prompt.FilterContains(getPersistentVolumeClaimSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPersistentVolumeClaimSuggestions(ctx, c.client, namespace), third, true) case "persistentvolumes", "pv": - return prompt.FilterContains(getPersistentVolumeSuggestions(c.client), third, true) - case "podsecuritypolicies", "psp": - return prompt.FilterContains(getPodSecurityPolicySuggestions(c.client), third, true) + return prompt.FilterContains(getPersistentVolumeSuggestions(ctx, c.client), third, true) case "podtemplates": - return prompt.FilterContains(getPodTemplateSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodTemplateSuggestions(ctx, c.client, namespace), third, true) case "replicasets", "rs": - return prompt.FilterContains(getReplicaSetSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getReplicaSetSuggestions(ctx, c.client, namespace), third, true) case "replicationcontrollers", "rc": - return prompt.FilterContains(getReplicationControllerSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getReplicationControllerSuggestions(ctx, c.client, namespace), third, true) case "resourcequotas", "quota": - return prompt.FilterContains(getResourceQuotasSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getResourceQuotasSuggestions(ctx, c.client, namespace), third, true) case "secrets": - return prompt.FilterContains(getSecretSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getSecretSuggestions(ctx, c.client, namespace), third, true) case "sa", "serviceaccounts": - return prompt.FilterContains(getServiceAccountSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getServiceAccountSuggestions(ctx, c.client, namespace), third, true) case "svc", "services": - return prompt.FilterContains(getServiceSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getServiceSuggestions(ctx, c.client, namespace), third, true) case "job", "jobs": - return prompt.FilterContains(getJobSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getJobSuggestions(ctx, c.client, namespace), third, true) } } @@ -381,20 +377,20 @@ func (c *Completer) argumentsCompleter(namespace string, args []string) []prompt } case "logs": if len(args) == 2 { - return prompt.FilterContains(getPodSuggestions(c.client, namespace), args[1], true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), args[1], true) } case "rolling-update", "rollingupdate": if len(args) == 2 { - return prompt.FilterContains(getReplicationControllerSuggestions(c.client, namespace), args[1], true) + return prompt.FilterContains(getReplicationControllerSuggestions(ctx, c.client, namespace), args[1], true) } else if len(args) == 3 { - return prompt.FilterContains(getReplicationControllerSuggestions(c.client, namespace), args[2], true) + return prompt.FilterContains(getReplicationControllerSuggestions(ctx, c.client, namespace), args[2], true) } case "scale", "resize": if len(args) == 2 { // Deployment, ReplicaSet, Replication Controller, or Job. - r := getDeploymentSuggestions(c.client, namespace) - r = append(r, getReplicaSetSuggestions(c.client, namespace)...) - r = append(r, getReplicationControllerSuggestions(c.client, namespace)...) + r := getDeploymentSuggestions(ctx, c.client, namespace) + r = append(r, getReplicaSetSuggestions(ctx, c.client, namespace)...) + r = append(r, getReplicationControllerSuggestions(ctx, c.client, namespace)...) return prompt.FilterContains(r, args[1], true) } case "cordon": @@ -403,19 +399,19 @@ func (c *Completer) argumentsCompleter(namespace string, args []string) []prompt fallthrough case "uncordon": if len(args) == 2 { - return prompt.FilterHasPrefix(getNodeSuggestions(c.client), args[1], true) + return prompt.FilterHasPrefix(getNodeSuggestions(ctx, c.client), args[1], true) } case "attach": if len(args) == 2 { - return prompt.FilterContains(getPodSuggestions(c.client, namespace), args[1], true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), args[1], true) } case "exec": if len(args) == 2 { - return prompt.FilterContains(getPodSuggestions(c.client, namespace), args[1], true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), args[1], true) } case "port-forward": if len(args) == 2 { - return prompt.FilterContains(getPodSuggestions(c.client, namespace), args[1], true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), args[1], true) } if len(args) == 3 { return prompt.FilterHasPrefix(getPortsFromPodName(namespace, args[1]), args[2], true) @@ -482,9 +478,9 @@ func (c *Completer) argumentsCompleter(namespace string, args []string) []prompt if len(args) == 3 { switch second { case "no", "node", "nodes": - return prompt.FilterContains(getNodeSuggestions(c.client), third, true) + return prompt.FilterContains(getNodeSuggestions(ctx, c.client), third, true) case "po", "pod", "pods": - return prompt.FilterContains(getPodSuggestions(c.client, namespace), third, true) + return prompt.FilterContains(getPodSuggestions(ctx, c.client, namespace), third, true) } } default: diff --git a/kube/completer.go b/kube/completer.go index ea730b3..c2c2d1f 100644 --- a/kube/completer.go +++ b/kube/completer.go @@ -1,6 +1,7 @@ package kube import ( + "context" "os" "strings" @@ -13,7 +14,7 @@ import ( "k8s.io/client-go/tools/clientcmd" ) -func NewCompleter() (*Completer, error) { +func NewCompleter(ctx context.Context) (*Completer, error) { loadingRules := clientcmd.NewDefaultClientConfigLoadingRules() loader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig( loadingRules, @@ -35,7 +36,7 @@ func NewCompleter() (*Completer, error) { return nil, err } - namespaces, err := client.CoreV1().Namespaces().List(metav1.ListOptions{}) + namespaces, err := client.CoreV1().Namespaces().List(ctx, metav1.ListOptions{}) if err != nil { if statusError, ok := err.(*errors.StatusError); ok && statusError.Status().Code == 403 { namespaces = nil @@ -77,7 +78,7 @@ func (c *Completer) Complete(d prompt.Document) []prompt.Suggest { } // Return suggestions for option - if suggests, found := c.completeOptionArguments(d); found { + if suggests, found := c.completeOptionArguments(context.TODO(), d); found { return suggests } @@ -91,7 +92,7 @@ func (c *Completer) Complete(d prompt.Document) []prompt.Suggest { // So we need to skip argumentCompleter. return []prompt.Suggest{} } - return c.argumentsCompleter(namespace, commandArgs) + return c.argumentsCompleter(context.TODO(), namespace, commandArgs) } func checkNamespaceArg(d prompt.Document) string { @@ -136,7 +137,7 @@ func getPreviousOption(d prompt.Document) (cmd, option string, found bool) { return "", "", false } -func (c *Completer) completeOptionArguments(d prompt.Document) ([]prompt.Suggest, bool) { +func (c *Completer) completeOptionArguments(ctx context.Context, d prompt.Document) ([]prompt.Suggest, bool) { cmd, option, found := getPreviousOption(d) if !found { return []prompt.Suggest{}, false @@ -168,9 +169,9 @@ func (c *Completer) completeOptionArguments(d prompt.Document) ([]prompt.Suggest cmdArgs := getCommandArgs(d) var suggestions []prompt.Suggest if cmdArgs == nil || len(cmdArgs) < 2 { - suggestions = getContainerNamesFromCachedPods(c.client, c.namespace) + suggestions = getContainerNamesFromCachedPods(ctx, c.client, c.namespace) } else { - suggestions = getContainerName(c.client, c.namespace, cmdArgs[1]) + suggestions = getContainerName(ctx, c.client, c.namespace, cmdArgs[1]) } return prompt.FilterHasPrefix( suggestions, diff --git a/kube/resource.go b/kube/resource.go index 8578fca..a78d278 100644 --- a/kube/resource.go +++ b/kube/resource.go @@ -1,6 +1,7 @@ package kube import ( + "context" "fmt" "sort" "strings" @@ -8,13 +9,12 @@ import ( "sync/atomic" "time" - prompt "github.com/c-bata/go-prompt" + "github.com/c-bata/go-prompt" "github.com/c-bata/kube-prompt/internal/debug" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" - policyv1beta1 "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" ) @@ -69,18 +69,18 @@ var ( componentStatusList atomic.Value ) -func fetchComponentStatusList(client *kubernetes.Clientset) { +func fetchComponentStatusList(ctx context.Context, client *kubernetes.Clientset) { key := "component_status" if !shouldFetch(key) { return } - l, _ := client.CoreV1().ComponentStatuses().List(metav1.ListOptions{}) + l, _ := client.CoreV1().ComponentStatuses().List(ctx, metav1.ListOptions{}) componentStatusList.Store(l) updateLastFetchedAt(key) } -func getComponentStatusCompletions(client *kubernetes.Clientset) []prompt.Suggest { - go fetchComponentStatusList(client) +func getComponentStatusCompletions(ctx context.Context, client *kubernetes.Clientset) []prompt.Suggest { + go fetchComponentStatusList(ctx, client) l, ok := componentStatusList.Load().(*corev1.ComponentStatusList) if !ok || len(l.Items) == 0 { return []prompt.Suggest{} @@ -100,18 +100,18 @@ var ( configMapsList atomic.Value ) -func fetchConfigMapList(client *kubernetes.Clientset, namespace string) { +func fetchConfigMapList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "config_map_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().ConfigMaps(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().ConfigMaps(namespace).List(ctx, metav1.ListOptions{}) configMapsList.Store(l) } -func getConfigMapSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchConfigMapList(client, namespace) +func getConfigMapSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchConfigMapList(ctx, client, namespace) l, ok := configMapsList.Load().(*corev1.ConfigMapList) if !ok || len(l.Items) == 0 { return []prompt.Suggest{} @@ -163,19 +163,19 @@ var ( podList *sync.Map ) -func fetchPods(client *kubernetes.Clientset, namespace string) { +func fetchPods(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "pod_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().Pods(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{}) podList.Store(namespace, l) } -func getPodSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchPods(client, namespace) +func getPodSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchPods(ctx, client, namespace) x, ok := podList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -243,8 +243,8 @@ func getPortsFromPodName(namespace string, podName string) []prompt.Suggest { return suggests } -func getContainerNamesFromCachedPods(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchPods(client, namespace) +func getContainerNamesFromCachedPods(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchPods(ctx, client, namespace) x, ok := podList.Load(namespace) if !ok { @@ -271,8 +271,8 @@ func getContainerNamesFromCachedPods(client *kubernetes.Clientset, namespace str return s } -func getContainerName(client *kubernetes.Clientset, namespace string, podName string) []prompt.Suggest { - go fetchPods(client, namespace) +func getContainerName(ctx context.Context, client *kubernetes.Clientset, namespace string, podName string) []prompt.Suggest { + go fetchPods(ctx, client, namespace) pod, found := getPod(namespace, podName) if !found { @@ -294,20 +294,20 @@ var ( daemonSetList *sync.Map ) -func fetchDaemonSetList(client *kubernetes.Clientset, namespace string) { +func fetchDaemonSetList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "daemon_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.AppsV1().DaemonSets(namespace).List(metav1.ListOptions{}) + l, _ := client.AppsV1().DaemonSets(namespace).List(ctx, metav1.ListOptions{}) daemonSetList.Store(namespace, l) return } -func getDaemonSetSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchDaemonSetList(client, namespace) +func getDaemonSetSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchDaemonSetList(ctx, client, namespace) x, ok := daemonSetList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -331,20 +331,20 @@ var ( deploymentList *sync.Map ) -func fetchDeployments(client *kubernetes.Clientset, namespace string) { +func fetchDeployments(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "deployment_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.AppsV1().Deployments(namespace).List(metav1.ListOptions{}) + l, _ := client.AppsV1().Deployments(namespace).List(ctx, metav1.ListOptions{}) deploymentList.Store(namespace, l) return } -func getDeploymentSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchDeployments(client, namespace) +func getDeploymentSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchDeployments(ctx, client, namespace) x, ok := deploymentList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -368,20 +368,20 @@ var ( endpointList *sync.Map ) -func fetchEndpoints(client *kubernetes.Clientset, namespace string) { +func fetchEndpoints(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "endpoint_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().Endpoints(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().Endpoints(namespace).List(ctx, metav1.ListOptions{}) endpointList.Store(key, l) return } -func getEndpointsSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchEndpoints(client, namespace) +func getEndpointsSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchEndpoints(ctx, client, namespace) x, ok := endpointList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -405,20 +405,20 @@ var ( eventList *sync.Map ) -func fetchEvents(client *kubernetes.Clientset, namespace string) { +func fetchEvents(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "event_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().Events(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().Events(namespace).List(ctx, metav1.ListOptions{}) eventList.Store(namespace, l) return } -func getEventsSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchEvents(client, namespace) +func getEventsSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchEvents(ctx, client, namespace) x, ok := eventList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -442,20 +442,20 @@ var ( nodeList atomic.Value ) -func fetchNodeList(client *kubernetes.Clientset) { +func fetchNodeList(ctx context.Context, client *kubernetes.Clientset) { key := "node" if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().Nodes().List(metav1.ListOptions{}) + l, _ := client.CoreV1().Nodes().List(ctx, metav1.ListOptions{}) nodeList.Store(l) return } -func getNodeSuggestions(client *kubernetes.Clientset) []prompt.Suggest { - go fetchNodeList(client) +func getNodeSuggestions(ctx context.Context, client *kubernetes.Clientset) []prompt.Suggest { + go fetchNodeList(ctx, client) l, ok := nodeList.Load().(*corev1.NodeList) if !ok || len(l.Items) == 0 { return []prompt.Suggest{} @@ -475,20 +475,20 @@ var ( secretList *sync.Map ) -func fetchSecretList(client *kubernetes.Clientset, namespace string) { +func fetchSecretList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "secret_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().Secrets(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().Secrets(namespace).List(ctx, metav1.ListOptions{}) secretList.Store(namespace, l) return } -func getSecretSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchSecretList(client, namespace) +func getSecretSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchSecretList(ctx, client, namespace) x, ok := secretList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -512,19 +512,19 @@ var ( ingressList *sync.Map ) -func fetchIngresses(client *kubernetes.Clientset, namespace string) { +func fetchIngresses(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "ingress_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.ExtensionsV1beta1().Ingresses(namespace).List(metav1.ListOptions{}) + l, _ := client.ExtensionsV1beta1().Ingresses(namespace).List(ctx, metav1.ListOptions{}) ingressList.Store(namespace, l) } -func getIngressSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchIngresses(client, namespace) +func getIngressSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchIngresses(ctx, client, namespace) x, ok := ingressList.Load(namespace) if !ok { @@ -553,20 +553,20 @@ var ( limitRangeList *sync.Map ) -func fetchLimitRangeList(client *kubernetes.Clientset, namespace string) { +func fetchLimitRangeList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "limit_range_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().LimitRanges(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().LimitRanges(namespace).List(ctx, metav1.ListOptions{}) limitRangeList.Store(namespace, l) return } -func getLimitRangeSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchLimitRangeList(client, namespace) +func getLimitRangeSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchLimitRangeList(ctx, client, namespace) x, ok := limitRangeList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -605,20 +605,20 @@ var ( persistentVolumeClaimsList *sync.Map ) -func fetchPersistentVolumeClaimsList(client *kubernetes.Clientset, namespace string) { +func fetchPersistentVolumeClaimsList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "persistent_volume_claims" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().PersistentVolumeClaims(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().PersistentVolumeClaims(namespace).List(ctx, metav1.ListOptions{}) persistentVolumeClaimsList.Store(namespace, l) return } -func getPersistentVolumeClaimSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchPersistentVolumeClaimsList(client, namespace) +func getPersistentVolumeClaimSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchPersistentVolumeClaimsList(ctx, client, namespace) x, ok := persistentVolumeClaimsList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -642,20 +642,20 @@ var ( persistentVolumesList atomic.Value ) -func fetchPersistentVolumeList(client *kubernetes.Clientset) { +func fetchPersistentVolumeList(ctx context.Context, client *kubernetes.Clientset) { key := "persistent_volume" if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().PersistentVolumes().List(metav1.ListOptions{}) + l, _ := client.CoreV1().PersistentVolumes().List(ctx, metav1.ListOptions{}) persistentVolumesList.Store(l) return } -func getPersistentVolumeSuggestions(client *kubernetes.Clientset) []prompt.Suggest { - go fetchPersistentVolumeList(client) +func getPersistentVolumeSuggestions(ctx context.Context, client *kubernetes.Clientset) []prompt.Suggest { + go fetchPersistentVolumeList(ctx, client) l, ok := persistentVolumesList.Load().(*corev1.PersistentVolumeList) if !ok || len(l.Items) == 0 { return []prompt.Suggest{} @@ -669,59 +669,26 @@ func getPersistentVolumeSuggestions(client *kubernetes.Clientset) []prompt.Sugge return s } -/* Pod Security Policies */ - -var ( - podSecurityPolicyList atomic.Value -) - -func fetchPodSecurityPolicyList(client *kubernetes.Clientset) { - key := "pod_security_policy" - if !shouldFetch(key) { - return - } - updateLastFetchedAt(key) - - l, _ := client.ExtensionsV1beta1().PodSecurityPolicies().List(metav1.ListOptions{}) - podSecurityPolicyList.Store(l) - return -} - -func getPodSecurityPolicySuggestions(client *kubernetes.Clientset) []prompt.Suggest { - go fetchPodSecurityPolicyList(client) - l, ok := podSecurityPolicyList.Load().(policyv1beta1.PodSecurityPolicyList) - if !ok || len(l.Items) == 0 { - return []prompt.Suggest{} - } - s := make([]prompt.Suggest, len(l.Items)) - for i := range l.Items { - s[i] = prompt.Suggest{ - Text: l.Items[i].Name, - } - } - return s -} - /* Pod Templates */ var ( podTemplateList *sync.Map ) -func fetchPodTemplateList(client *kubernetes.Clientset, namespace string) { +func fetchPodTemplateList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "pod_template_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().PodTemplates(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().PodTemplates(namespace).List(ctx, metav1.ListOptions{}) podTemplateList.Store(namespace, l) return } -func getPodTemplateSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchPodTemplateList(client, namespace) +func getPodTemplateSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchPodTemplateList(ctx, client, namespace) x, ok := podTemplateList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -745,20 +712,20 @@ var ( replicaSetList *sync.Map ) -func fetchReplicaSetList(client *kubernetes.Clientset, namespace string) { +func fetchReplicaSetList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "replica_set_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.AppsV1beta2().ReplicaSets(namespace).List(metav1.ListOptions{}) + l, _ := client.AppsV1beta2().ReplicaSets(namespace).List(ctx, metav1.ListOptions{}) replicaSetList.Store(namespace, l) return } -func getReplicaSetSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchReplicaSetList(client, namespace) +func getReplicaSetSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchReplicaSetList(ctx, client, namespace) x, ok := replicaSetList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -782,20 +749,20 @@ var ( replicationControllerList *sync.Map ) -func fetchReplicationControllerList(client *kubernetes.Clientset, namespace string) { +func fetchReplicationControllerList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "replication_controller" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().ReplicationControllers(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().ReplicationControllers(namespace).List(ctx, metav1.ListOptions{}) replicationControllerList.Store(namespace, l) return } -func getReplicationControllerSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchReplicationControllerList(client, namespace) +func getReplicationControllerSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchReplicationControllerList(ctx, client, namespace) x, ok := replicationControllerList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -819,20 +786,20 @@ var ( resourceQuotaList *sync.Map ) -func fetchResourceQuotaList(client *kubernetes.Clientset, namespace string) { +func fetchResourceQuotaList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "resource_quota" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().ResourceQuotas(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().ResourceQuotas(namespace).List(ctx, metav1.ListOptions{}) resourceQuotaList.Store(namespace, l) return } -func getResourceQuotasSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchResourceQuotaList(client, namespace) +func getResourceQuotasSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchResourceQuotaList(ctx, client, namespace) x, ok := resourceQuotaList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -856,20 +823,20 @@ var ( serviceAccountList *sync.Map ) -func fetchServiceAccountList(client *kubernetes.Clientset, namespace string) { +func fetchServiceAccountList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "service_account_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().ServiceAccounts(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().ServiceAccounts(namespace).List(ctx, metav1.ListOptions{}) serviceAccountList.Store(namespace, l) return } -func getServiceAccountSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchServiceAccountList(client, namespace) +func getServiceAccountSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchServiceAccountList(ctx, client, namespace) x, ok := serviceAccountList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -893,20 +860,20 @@ var ( serviceList *sync.Map ) -func fetchServiceList(client *kubernetes.Clientset, namespace string) { +func fetchServiceList(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "service_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.CoreV1().Services(namespace).List(metav1.ListOptions{}) + l, _ := client.CoreV1().Services(namespace).List(ctx, metav1.ListOptions{}) serviceList.Store(namespace, l) return } -func getServiceSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchServiceList(client, namespace) +func getServiceSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchServiceList(ctx, client, namespace) x, ok := serviceList.Load(namespace) if !ok { return []prompt.Suggest{} @@ -930,19 +897,19 @@ var ( jobList *sync.Map ) -func fetchJobs(client *kubernetes.Clientset, namespace string) { +func fetchJobs(ctx context.Context, client *kubernetes.Clientset, namespace string) { key := "job_" + namespace if !shouldFetch(key) { return } updateLastFetchedAt(key) - l, _ := client.BatchV1().Jobs(namespace).List(metav1.ListOptions{}) + l, _ := client.BatchV1().Jobs(namespace).List(ctx, metav1.ListOptions{}) jobList.Store(namespace, l) } -func getJobSuggestions(client *kubernetes.Clientset, namespace string) []prompt.Suggest { - go fetchJobs(client, namespace) +func getJobSuggestions(ctx context.Context, client *kubernetes.Clientset, namespace string) []prompt.Suggest { + go fetchJobs(ctx, client, namespace) x, ok := jobList.Load(namespace) if !ok { return []prompt.Suggest{} diff --git a/main.go b/main.go index f5a4b2d..9a6f266 100644 --- a/main.go +++ b/main.go @@ -1,17 +1,17 @@ package main import ( + "context" "fmt" "os" - prompt "github.com/c-bata/go-prompt" + "github.com/c-bata/go-prompt" "github.com/c-bata/go-prompt/completer" "github.com/c-bata/kube-prompt/internal/debug" "github.com/c-bata/kube-prompt/kube" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" - _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" ) var ( @@ -20,7 +20,7 @@ var ( ) func main() { - c, err := kube.NewCompleter() + c, err := kube.NewCompleter(context.TODO()) if err != nil { fmt.Println("error", err) os.Exit(1) From 6be7caa2da55f0de2c656665c1a871ced6104d1c Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:04:45 +0200 Subject: [PATCH 02/10] chore: rename branch --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f5d4cf7..8b2f49e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: test on: pull_request: branches: - - master + - main jobs: lint: From 3729f07addf2337eefd2c83e1c13eccf1c03577a Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:08:41 +0200 Subject: [PATCH 03/10] chore: bump go --- .github/workflows/release.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df9cdc3..36101e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,14 +10,13 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.13 - uses: actions/setup-go@v1 - with: - go-version: 1.13 + - uses: actions/setup-go@v5 id: go + with: + check-latest: true + go-version-file: go.mod - - name: Check out code into the Go module directory - uses: actions/checkout@master + - uses: actions/checkout@4 - name: Build env: From 40573d086c78ec451e6bffe0b1cc0ef015524a1b Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:10:10 +0200 Subject: [PATCH 04/10] chore: fix version --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 36101e3..970dc78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: check-latest: true go-version-file: go.mod - - uses: actions/checkout@4 + - uses: actions/checkout@v4 - name: Build env: From 6c5649acf2c3aca607f45496eabc473795b8ecb5 Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:11:01 +0200 Subject: [PATCH 05/10] chore: fix order --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 970dc78..ddf0f31 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,7 @@ jobs: name: Build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/setup-go@v5 id: go @@ -16,8 +17,6 @@ jobs: check-latest: true go-version-file: go.mod - - uses: actions/checkout@v4 - - name: Build env: GO111MODULE: on From 12931b7363ae0fdcde900f6a19de80c179d86063 Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:16:59 +0200 Subject: [PATCH 06/10] chore: fix path --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ddf0f31..98d683c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Build env: GO111MODULE: on - GOPATH: /home/runner/work/ + GOPATH: /home/runner/work GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH" | sed -e "s/refs\/tags\///") @@ -33,5 +33,7 @@ jobs: ls pkg/ echo "=========================================================" go get -u github.com/tcnksm/ghr + ls -la $GOPATH + ls -la $GOPATH/bin $GOPATH/bin/ghr -n ${TAGNAME} -b "ʕ◔ϖ◔ʔ Release ${TAGNAME}" -draft ${TAGNAME} pkg/ From 875abed91c882c9640beb4baac8a505a9c1d5a65 Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:24:13 +0200 Subject: [PATCH 07/10] chore: use install --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 98d683c..cdac0bf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,6 @@ jobs: - name: Build env: - GO111MODULE: on GOPATH: /home/runner/work GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -32,7 +31,7 @@ jobs: echo "DEBUG: ls pkg/" ls pkg/ echo "=========================================================" - go get -u github.com/tcnksm/ghr + go install github.com/tcnksm/ghr ls -la $GOPATH ls -la $GOPATH/bin $GOPATH/bin/ghr -n ${TAGNAME} -b "ʕ◔ϖ◔ʔ Release ${TAGNAME}" -draft ${TAGNAME} pkg/ From 988e6d6d3b3e1c3fdabafdc81a09d5195e75c1e6 Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:31:42 +0200 Subject: [PATCH 08/10] chore: use install --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cdac0bf..95a466e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: echo "DEBUG: ls pkg/" ls pkg/ echo "=========================================================" - go install github.com/tcnksm/ghr + go install github.com/tcnksm/ghr@latest ls -la $GOPATH ls -la $GOPATH/bin $GOPATH/bin/ghr -n ${TAGNAME} -b "ʕ◔ϖ◔ʔ Release ${TAGNAME}" -draft ${TAGNAME} pkg/ From 23ae4ea4135b493e87aa526c1065696a07ff768f Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 29 Jul 2024 17:39:12 +0200 Subject: [PATCH 09/10] chore: update builds --- .github/workflows/release.yml | 2 -- Makefile | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95a466e..6009448 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,5 @@ jobs: ls pkg/ echo "=========================================================" go install github.com/tcnksm/ghr@latest - ls -la $GOPATH - ls -la $GOPATH/bin $GOPATH/bin/ghr -n ${TAGNAME} -b "ʕ◔ϖ◔ʔ Release ${TAGNAME}" -draft ${TAGNAME} pkg/ diff --git a/Makefile b/Makefile index a30e2da..eb1affc 100644 --- a/Makefile +++ b/Makefile @@ -32,12 +32,12 @@ code-gen: ## Generate source codes. cross: main.go ## Build binaries for cross platform. mkdir -p pkg @# darwin - @for arch in "amd64" "386"; do \ + @for arch in "amd64" "arm64"; do \ GOOS=darwin GOARCH=$${arch} make build; \ zip pkg/kube-prompt_$(VERSION)_darwin_$${arch}.zip kube-prompt; \ done; @# linux - @for arch in "amd64" "386" "arm64" "arm"; do \ + @for arch in "amd64" "arm64"; do \ GOOS=linux GOARCH=$${arch} make build; \ zip pkg/kube-prompt_$(VERSION)_linux_$${arch}.zip kube-prompt; \ done; From 625d53d246647dffee592116ee61d3473194afb1 Mon Sep 17 00:00:00 2001 From: franklin Date: Tue, 30 Jul 2024 15:51:31 +0200 Subject: [PATCH 10/10] chore: update builds --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index eb1affc..9a6a36b 100644 --- a/Makefile +++ b/Makefile @@ -32,12 +32,12 @@ code-gen: ## Generate source codes. cross: main.go ## Build binaries for cross platform. mkdir -p pkg @# darwin - @for arch in "amd64" "arm64"; do \ + @for arch in "amd64" "386" "arm64"; do \ GOOS=darwin GOARCH=$${arch} make build; \ zip pkg/kube-prompt_$(VERSION)_darwin_$${arch}.zip kube-prompt; \ done; @# linux - @for arch in "amd64" "arm64"; do \ + @for arch in "amd64" "386" "arm64" "arm"; do \ GOOS=linux GOARCH=$${arch} make build; \ zip pkg/kube-prompt_$(VERSION)_linux_$${arch}.zip kube-prompt; \ done;