kubernetes-sigs / krew Goto Github PK
View Code? Open in Web Editor NEW📦 Find and install kubectl plugins
Home Page: https://krew.sigs.k8s.io
License: Apache License 2.0
📦 Find and install kubectl plugins
Home Page: https://krew.sigs.k8s.io
License: Apache License 2.0
We should explain:
-
s in plugin names to _
(dev guide?)A binary compiled with build-cross-releases on glibc doesn't work on Alpine.
Needs cgo disabling and cross-compilation flags.
It should be possible to force installation of another platform from any other platform. i.e. I should be able to install windows/arm from darwin/amd64.
This would be needed to write a program that validates installation recipes (url, bin, files...) of all platforms listed in a manifest.
cmd/krew/cmd/list.go
42: if !(isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd())) {
cmd/krew/cmd/install.go
47: if (len(pluginNames) != 0 || *manifest != "") && !(isatty.IsTerminal(os.Stdin.Fd()) || isatty.IsCygwinTerminal(os.Stdin.Fd())) {
51: if len(pluginNames) == 0 && *manifest == "" && !(isatty.IsTerminal(os.Stdin.Fd()) || isatty.IsCygwinTerminal(os.Stdin.Fd())) {
It should be easy to tell which tag/commit that it's built from using kubectl plugin krew version
. Currently only shows the sha256 of the krew plugin itself.
$ kubectl krew -h
Usage of /Users/ahmetb/.krew/bin/kubectl-krew:
-alsologtostderr
log to standard error as well as files
-log_backtrace_at value
when logging hits line file:N, emit a stack trace
-log_dir string
If non-empty, write log files in this directory
-logtostderr
log to standard error instead of files
-stderrthreshold value
logs at or above this threshold go to stderr
-v value
log level for V logs
-vmodule value
comma-separated list of pattern=N settings for file-filtered logging
List of issues encountered while releasing v0.2.0 with the scripts we have:
-m
to git tag needs a header: e.g.krew ${TAG}
+ an empty line, then the actual message.https://github.com/kubernetes/cli-runtime
Since krew is already a plugin today, using cli-runtime
can help us standardize some cmdline flags (esp. useful for list
cmd probably). (I don't know what else we'd get out of it right away.)
/cc @juanvallejo
We need index.Validate() code to check if there are overlapping platform selectors.
For example, a manifest shouldn't be allowed to have a platform spec with os in [darwin,linux]
and another with {os:darwin,arch:amd64}
selector. (Because darwin/amd64 matches both.)
We currently don't validate this. It's more of a static check/linting for plugin developers. Also if we have overlapping selectors, it's currently unclear which one we'd pick (probably the first one depending on the order, which isn't good).
Instead it just says it failed and moves onto the next download (we probably don't need this behavior).
In case of sha256 verifications, even the logs don't print any errors.
I'm trying to install krew following the instructions at https://github.com/GoogleContainerTools/krew. Unfortunately it fails with the error message "failed to install plugin "krew", err: the resulting plugin dir has to contain a plugin.yaml file".
My computer is running Linux with Fedora Core 28. Uname output:
Linux AARN20440W10B1 4.17.9-200.fc28.x86_64 #1 SMP Mon Jul 23 21:41:29 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Here is detailed log when I run it from the temp directory:
$ ./krew-linux -v 9 install krew
I0730 09:56:51.947909 30818 root.go:101] Ensure creating dir: "/home/andreas/.kube/plugins/krew"
I0730 09:56:51.948225 30818 root.go:101] Ensure creating dir: "/tmp/krew"
I0730 09:56:51.948297 30818 root.go:101] Ensure creating dir: "/home/andreas/.kube/plugins/krew/store"
I0730 09:56:51.949300 30818 git.go:62] Going to run git pull --ff-only -v
From https://github.com/GoogleContainerTools/krew-index
= [up to date] master -> origin/master
Already up to date.
Updated index
I0730 09:56:52.535801 30818 scanner.go:73] Reading plugin "krew"
Will install plugin: krew
I0730 09:56:52.538575 30818 install.go:105] Installing plugin: krew
I0730 09:56:52.538602 30818 install.go:64] Looking for installed versions
I0730 09:56:52.538633 30818 util.go:58] Searching for installed versions of krew in "/home/andreas/.kube/plugins/krew/store"
I0730 09:56:52.538795 30818 install.go:73] Finding download target for plugin krew
I0730 09:56:52.538822 30818 util.go:40] Matching platform for labels(arch=amd64,os=linux)
I0730 09:56:52.538956 30818 util.go:47] Found matching platform with index (1)
I0730 09:56:52.538989 30818 util.go:119] Matching plugin version is 437272f4f52b6d114f87b366cc3d069f54ab7451dc530c9b6517139fc150f908
I0730 09:56:52.539014 30818 install.go:41] Creating download dir "/tmp/krew/krew"
I0730 09:56:52.539211 30818 install.go:51] Getting sha256 (437272f4f52b6d114f87b366cc3d069f54ab7451dc530c9b6517139fc150f908) signed version
I0730 09:56:52.539241 30818 downloader.go:32] Fetching "https://storage.googleapis.com/krew-test/krew-437272f4f52b6d114f87b366cc3d069f54ab7451dc530c9b6517139fc150f908.zip"
I0730 09:56:52.983511 30818 downloader.go:39] Reading download data into memory
I0730 09:56:55.014619 30818 downloader.go:44] Read 13917853 bytes of download data into memory
I0730 09:56:55.014784 30818 downloader.go:52] Extracting download zip to "/tmp/krew/krew"
I0730 09:56:55.572781 30818 move.go:151] Creating plugin dir "/home/andreas/.kube/plugins/krew/store/krew"
I0730 09:56:55.572859 30818 move.go:157] Creating temp plugin move operations dir "/tmp/krew-temp-move716057421"
I0730 09:56:55.572872 30818 move.go:122] Finding move targets from "/tmp/krew/krew" to "/tmp/krew-temp-move716057421" with file operation={build/unix/plugin.yaml plugin.yaml}
I0730 09:56:55.572890 30818 move.go:44] Trying to move single file directly from=%q to=%q with file operation=%+v /tmp/krew/krew /tmp/krew-temp-move716057421 {build/unix/plugin.yaml plugin.yaml}
I0730 09:56:55.572911 30818 move.go:52] Wasn't a single file, proceeding with Glob move
I0730 09:56:55.572920 30818 move.go:122] Finding move targets from "/tmp/krew/krew" to "/tmp/krew-temp-move716057421" with file operation={build/krew-linux krew}
I0730 09:56:55.572927 30818 move.go:44] Trying to move single file directly from=%q to=%q with file operation=%+v /tmp/krew/krew /tmp/krew-temp-move716057421 {build/krew-linux krew}
I0730 09:56:55.572934 30818 move.go:52] Wasn't a single file, proceeding with Glob move
I0730 09:56:55.572942 30818 move.go:122] Finding move targets from "/tmp/krew/krew" to "/tmp/krew-temp-move716057421" with file operation={build/unix/commands/* commands}
I0730 09:56:55.572948 30818 move.go:44] Trying to move single file directly from=%q to=%q with file operation=%+v /tmp/krew/krew /tmp/krew-temp-move716057421 {build/unix/commands/* commands}
I0730 09:56:55.572957 30818 move.go:52] Wasn't a single file, proceeding with Glob move
I0730 09:56:55.572968 30818 move.go:167] Checking for plugin descriptor in new plugin dir
I0730 09:56:55.572974 30818 util.go:81] Checking path "/tmp/krew-temp-move716057421" for plugin descriptors
W0730 09:56:55.577480 30818 install.go:112] failed to install plugin "krew", err: the resulting plugin dir has to contain a plugin.yaml file
Error: failed to install some plugins: [krew]
Usage:
krew install [flags]
Flags:
--HEAD Force HEAD if versioned and HEAD installs are possible.
-h, --help help for install
--source string (Development-only) specify plugin manifest directly.
Global Flags:
--alsologtostderr log to standard error as well as files
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--logtostderr log to standard error instead of files (default true)
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level log level for V logs (default 9)
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
F0730 09:56:55.578205 30818 root.go:49] failed to install some plugins: [krew]
When plugins not found, krew search
outputs only header.
$ kubectl plugin search hoge
NAME DESCRIPTION STATUS
I think it is better that the command doesn't output anything when no plugins found.
$ kubectl krew list -v=10
F1007 14:45:13.892817 4431 root.go:50] failed to find all installed versions,
err failed to get plugin version, err: the plugin name ".DS_Store" is not allowed
This probably happened because I launched the index directory in macOS Finder.app once.
If no files
field specified, we may consider assuming:
files
- from: '*'
to: '.'
then developers can just point to the entrypoint within the extracted archive through bin:
field.
This already started to become a common pattern in several plugins.
Current problems with methods called via Install():
I'm proposing Install() method should be a linear call pipeline and we should separate installation "steps" to individual methods that:
(call stack TOO DEEP, signatures too long/complex/untestable)
func Install(p environment.Paths, plugin index.Plugin, forceHEAD bool, forceDownloadFile string) error {
- findInstalledPluginVersion(p.InstallPath(), p.BinPath(), plugin.Name)
- getDownloadTarget(plugin, forceHEAD)
- install(plugin.Name, version, uri, bin, p, fos, forceDownloadFile)--|
func install(plugin, version, uri, bin string, p environment.Paths, fos []index.FileOperation, forceDownloadFile string) error
- downloadAndMove(version, uri, fos, filepath.Join(p.DownloadPath(), plugin), p.PluginInstallPath(plugin), forceDownloadFile)
- createOrUpdateLink(p.BinPath(), filepath.Join(dst, filepath.FromSlash(bin)), plugin)
func downloadAndMove(version, uri string, fos []index.FileOperation, downloadPath, installPath, forceDownloadFile string) (dst string, err error)
- pseudo initializeFetcher(forceDownloadFile, version, uri, downloadPath)
- moveToInstallDir(downloadPath, installPath, version, fos)
func moveToInstallDir(download, pluginDir, version string, fos []index.FileOperation) (string, error)
- moveAllFiles(download, tempdir, fos); err != nil
- moveOrCopyDir(tempdir, installPath)
(linear, minimal responsibility, testable)
func Install(){
1. Does it exist (<- paths, plugin.Name)
2. Find a matching platform (<- Plugin, os,arch)
3. Determine which version (=url) to install (<- Platform, forceHEAD)
4. Initialize a fetcher (<- url, forceHEAD, forceDownloadFile)
5. Fetch archive file (fetcher.Do) (<-fetcher)
6. Save archive file to a temp file (<-io.Reader, tmpFile)
7. Determine Unarchiver (<-tmpFile.Name)
7. Extract archive file to download dir (<-tmpFile, tmpDir unarchiver)
8. Do fileOps from=download_dir to=temp_dir <(download_dir, temp_dir, fos)
9. Move/Copy from=temp_dir to=install_dir <(download_dir, install_dir)
10. Create/Update link (<-paths, plugin.Name)
}
README could use a Roadmap section outlining this.
Similar to #27, another common problem people have with spf13/cobra
for sure...
Krew should support customizable index repositories.
This would allow users to distribute plugins without requiring them to make a pull request to the centralized index repo like "krew-index".
Similarly, this would allow vendors to distribute their plugins that are too specific or one-off to be in the centralized index repo.
Work here is probably:
update
/upgrade
paths to keep taps in mind@lbb has showed interest to work on this.
kubectl plugin search certificate
is not bringing up ca-cert which has the word in its description.
/priority P2
/priority backlog
gs://krew
hack/build-cross-releases.sh
cloudbuild{,-release}.yaml
to build & push the builds/releases.After #88 is merged, delete deploy
script in travis CI as GCB will upload the release binaries.
That said, we need to set correctly with the pre-calculated GCS URLs so (1) the Release message on GitHub (2) README links to the correct binary URLs.
Context:
Kubernetes 1.12 implements git-style plugins (executables prefixed kubectl-*
placed in PATH).
Krew does not support this model (predates it), but we saw this coming during the design phase.
This change will still break krew heavily.
Now that kubernetes 1.12.0-beta.1 release is available, we need to make krew work with the new kubectl plugin model.
platforms[]
indicating which file(s) should be symlinked (#35)
linux/arm
platform (was in #48) (#80)I'm probably missing a few but will update the list above continuously.
cc: @lbb
For a lot of Go projects, binary releases are either available directly or in a .tar.gz
format. With how many k8s related projects are written in Go, it seems like it would make sense to add support for those formats. As an example, I'm using goreleaser to release rbac-lookup. That defaults to .tar.gz
formats for Mac and Linux releases. Even just supporting downloading binaries directly without trying to unzip them would likely be helpful (and very straightforward). I'm happy to do some work in this direction if this is a feature if there's interest.
We should have a way of doing some sanity checks on the plugin files to prevent:
Perhaps we can find the changed yaml files and do krew install --source=$f
to verify installation.
#49 adds a hardcoded krew base path to $HOME/.krew
.
It should be possible to override this path for reasons like:
mktemp -d
or /tmp/some-test
without causing any disturbance to their main krew installation.A very simple way to do this appears to be environment variable, such as:
KREW_BASE="$(mktemp -d)" kubectl krew install foo
KREW_BASE="$HOME/work-profile/krew" krew install foo
We should migrate to http://github.com/pkg/errors sometime. We have a lot of error message consistencies such as:
something bad happened, err: %v
something bad happened, err=%+v
something bad happened: %v
This would involve:
%+v
where appropriate to print the stack trace.I am not sure what failure I am experiencing with this plugin. Errors seem to be concatenated against each other.
https://github.com/jasonrichardsmith/krew-index/blob/initial-submission/plugins/rbac-view.yaml
$ kubectl krew install --manifest=rbac-view.yaml
Installing plugin: rbac-view
W1019 10:03:04.251654 14926 install.go:132] failed to install plugin "rbac-view": failed to dowload and move during installation: failed to download and verify file: failed to create file "/tmp/krew-downloads/rbac-view/bin/linux/rbac-view": open /tmp/krew-downloads/rbac-view/bin/linux/rbac-view: no such file or directory
F1019 10:03:04.251778 14926 root.go:52] failed to install some plugins: [rbac-view]
$ kubectl plugin upgrade ca-cert
Updated index
Error: failed to upgrade plugin "ca-cert", err: can't upgrade, the newest version is already installed
Usage:
krew upgrade [flags]
Flags:
-h, --help help for upgrade
F0815 12:26:42.423219 57730 root.go:49] failed to upgrade plugin "ca-cert", err: can't upgrade, the newest version is already installed
error: exit status 255
I've been thinking about this for a while.
Especially with kubectl 1.12 plugin model, it's inevitable people will have Go repositories on Github with static binary releases (without ZIPs).
I've so far heard from at least one plugin dev that goreleaser
doesn't support creating .zip, so they need to change their release model to accommodate krew distribution.
We can have 3 modes, like:
archive downloads:
download: archive: https://.../foo.zip sha256: [...] |
file downloads:
download: file: https://.../kubectl-foo_linux_amd64 sha256: [...] |
head:
download: head: [...] |
Thoughts? There's time to do this during for krew 0.2.
cc: @lbb
When plugin doesn't exist, krew info
outputs error message as follows:
$ kubectl plugin info hoge
F0728 16:15:27.943022 8904 info.go:40] failed to read the plugin file, err: failed to open index file, err: open /Users/ksuda/.kube/plugins/krew/index/plugins/hoge.yaml: no such file or directory
error: exit status 255
Personally, I feel the above message is not user friendly.
I expect error message as follows:
$ kubectl plugin info hoge
Error: plugin "hoge" not found
Given now --manifest
and --archive
can be provided to krew install
command to ease installing plugins locally for development, head:
no longer provides a good value:
head
fieldRunning
krew install
without providing any args (because user wants to just see the help/usage) takes long time, because it ensures the index.
Any krew plugin named like a-b-c
today is symlinked as kubectl-a-b-c
.
This causes plugin to be invokable only through kubectl a b c
and loses the dashes in the original name.
Per kubectl/#540, the new design allows underscores (_
) to be treated as -
at invocation-time. This means, if a symlink is linked as kubectl-a_b_c
, it can be invoked as kubectl a-b-c
as desired (and equivalent of pre-1.12 behavior).
Just replace dashes (-
) with underscores _
. This way we don't have to replace plugin identifiers in manifest filenames or name:
fields.
This way krew can hide this implementation detail behind the covers and not expose it to both plugin devs and plugin users.
Will submit a PR shortly.
I added bin: ca-cert.sh
to existing ca-cert.yaml and ran:
kubectl krew install --source ~/.krew/index/plugins/ca-cert.yaml -v=10
I0925 10:43:18.446458 77773 git.go:62] Going to run git pull --ff-only -v
From https://github.com/GoogleContainerTools/krew-index
= [up to date] master -> origin/master
Already up to date.
Updated index
Will install plugin: ca-cert
I0925 10:43:18.943571 77773 install.go:105] Installing plugin: ca-cert
I0925 10:43:18.943610 77773 install.go:69] Looking for installed versions
I0925 10:43:18.943639 77773 util.go:61] Searching for installed versions of ca-cert in "/Users/ahmetb/.krew/bin"
I0925 10:43:18.943675 77773 install.go:78] Finding download target for plugin ca-cert
I0925 10:43:18.943689 77773 util.go:43] Matching platform for labels(arch=amd64,os=darwin)
I0925 10:43:18.943792 77773 util.go:50] Found matching platform with index (0)
I0925 10:43:18.943817 77773 util.go:113] Matching plugin version is 8be8ed348d02285abc46bbf7a4cc83da0ee9d54dc2c5bf86a7b64947811b843c
I0925 10:43:18.943827 77773 install.go:46] Creating download dir "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew/ca-cert"
I0925 10:43:18.944054 77773 install.go:56] Getting sha256 (8be8ed348d02285abc46bbf7a4cc83da0ee9d54dc2c5bf86a7b64947811b843c) signed version
I0925 10:43:18.944087 77773 downloader.go:32] Fetching "https://github.com/ahmetb/kubectl-extras/archive/c403c5714a4442b8314e5a86b0ff63f7a815f83f.zip"
I0925 10:43:19.750567 77773 downloader.go:39] Reading download data into memory
I0925 10:43:19.818536 77773 downloader.go:44] Read 19613 bytes of download data into memory
I0925 10:43:19.818588 77773 downloader.go:52] Extracting download zip to "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew/ca-cert"
I0925 10:43:19.829590 77773 move.go:155] Creating plugin dir "/Users/ahmetb/.krew/store/ca-cert"
I0925 10:43:19.829832 77773 move.go:161] Creating temp plugin move operations dir "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew-temp-move184368352"
I0925 10:43:19.829850 77773 move.go:126] Finding move targets from "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew/ca-cert" to "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew-temp-move184368352" with file operation=index.FileOperation{From:"/*/ca-cert/*", To:"."}
I0925 10:43:19.829898 77773 move.go:44] Trying to move single file directly from="/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew/ca-cert" to="/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew-temp-move184368352" with file operation=index.FileOperation{From:"/*/ca-cert/*", To:"."}
I0925 10:43:19.830031 77773 move.go:52] Wasn't a single file, proceeding with Glob move
I0925 10:43:19.830323 77773 move.go:76] Move operations are complete
I0925 10:43:19.830338 77773 move.go:133] Move file from "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew/ca-cert/kubectl-extras-c403c5714a4442b8314e5a86b0ff63f7a815f83f/ca-cert/ca-cert.bash" to "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew-temp-move184368352/ca-cert.bash"
I0925 10:43:19.830543 77773 move.go:133] Move file from "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew/ca-cert/kubectl-extras-c403c5714a4442b8314e5a86b0ff63f7a815f83f/ca-cert/plugin.yaml" to "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew-temp-move184368352/plugin.yaml"
I0925 10:43:19.830729 77773 move.go:172] Move "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew-temp-move184368352" to "/Users/ahmetb/.krew/store/ca-cert/8be8ed348d02285abc46bbf7a4cc83da0ee9d54dc2c5bf86a7b64947811b843c"
W0925 10:43:19.836107 77773 install.go:112] failed to install plugin "ca-cert", err: failed to dowload and move during installation, err: could not rename file from "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew-temp-move184368352" to "/Users/ahmetb/.krew/store/ca-cert/8be8ed348d02285abc46bbf7a4cc83da0ee9d54dc2c5bf86a7b64947811b843c", err: rename /var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew-temp-move184368352 /Users/ahmetb/.krew/store/ca-cert/8be8ed348d02285abc46bbf7a4cc83da0ee9d54dc2c5bf86a7b64947811b843c: file exists
F0925 10:43:19.836154 77773 root.go:48] failed to install some plugins: [ca-cert]
We currently rely on .zip and .tar.gz extension of downloaded files to choose extraction algorithm. File magic numbers can help here better and make it possible to use plugin archives without explicit file extension.
We should bring krew.yaml to this repository and put it in the release .zip file.
If I run hack/make-all.sh
twice, I get different checksums. e.g.
krew.tar.gz checksum: 86fff449a95637432c28592b530077a449fe578acc296aacbcc9a7e71ef83126
krew.zip checksum: 08aa780dc8cc702c553fb622f334b8439b537c8679309680feb5b2d462b3b2ed
and
krew.tar.gz checksum: 0233e2af055875784db833083d56fc235e09a085f2bcc1624598ab03a8bf43cd
krew.zip checksum: 8bb9df9aef534442c9d7f5b05c3112ae7cf20f4b5ec54b28c1e5c60b11f47482
Binaries between two runs are identical, but for some reason, archives are changing.
In addition to .zip (which is good for windows) we should also have .tar.gz for krew releases.
This would unburden the mac and linux users from installing unzip
tool, which is not really standard, whereas tar
is.
When using --archive
we assume the filetype of the index URL.
This will lead to a decoding error when the --archive
type mismatches with the type specified in the uri:
.
./bin/krew-darwin_amd64 install --archive ./krew.zip --manifest krew.yaml -v 6
I1014 21:40:35.421829 9181 install.go:132] --manifest specified, not ensuring plugin index
I1014 21:40:35.423021 9181 install.go:101] Will install plugin: krew
Installing plugin: krew
I1014 21:40:35.423051 9181 install.go:74] Looking for installed versions
I1014 21:40:35.423066 9181 util.go:77] Searching for installed versions of krew in "/Users/lbb/.krew/bin"
I1014 21:40:35.423113 9181 install.go:83] Finding download target for plugin krew
I1014 21:40:35.423123 9181 util.go:36] Using os=darwin arch=amd64
I1014 21:40:35.423129 9181 util.go:59] Matching platform for labels(arch=amd64,os=darwin)
I1014 21:40:35.423179 9181 util.go:66] Found matching platform with index (0)
I1014 21:40:35.423186 9181 util.go:129] Matching plugin version is 170f15a0f363bf1d35896b5963495e70e215caa41ebfb7244351c42c6ab06222
I1014 21:40:35.423196 9181 install.go:46] Creating download dir "/var/folders/b6/3hk_x4nx08z2qb9ph8_zcxgh0000gn/T/krew-downloads/krew"
I1014 21:40:35.423865 9181 install.go:61] Getting sha256 (170f15a0f363bf1d35896b5963495e70e215caa41ebfb7244351c42c6ab06222) signed version
I1014 21:40:35.423888 9181 downloader.go:36] Fetching "https://github.com/GoogleContainerTools/krew/releases/download/v0.1.0-alpha.1-56-g1727d93/krew.tar.gz"
I1014 21:40:35.423936 9181 downloader.go:43] Reading download data into memory
I1014 21:40:35.507490 9181 downloader.go:48] Read 14405237 bytes of download data into memory
W1014 21:40:35.507655 9181 install.go:114] failed to install plugin "krew"
F1014 21:40:35.507691 9181 root.go:50] failed to install some plugins: [krew]
github.com/GoogleContainerTools/krew/cmd/krew/cmd.init.1.func1
/Users/lbb/go/src/github.com/GoogleContainerTools/krew/cmd/krew/cmd/install.go:124
github.com/GoogleContainerTools/krew/vendor/github.com/spf13/cobra.(*Command).execute
/Users/lbb/go/src/github.com/GoogleContainerTools/krew/vendor/github.com/spf13/cobra/command.go:762
github.com/GoogleContainerTools/krew/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/Users/lbb/go/src/github.com/GoogleContainerTools/krew/vendor/github.com/spf13/cobra/command.go:852
github.com/GoogleContainerTools/krew/vendor/github.com/spf13/cobra.(*Command).Execute
/Users/lbb/go/src/github.com/GoogleContainerTools/krew/vendor/github.com/spf13/cobra/command.go:800
github.com/GoogleContainerTools/krew/cmd/krew/cmd.Execute
/Users/lbb/go/src/github.com/GoogleContainerTools/krew/cmd/krew/cmd/root.go:48
main.main
/Users/lbb/go/src/github.com/GoogleContainerTools/krew/cmd/krew/main.go:23
runtime.main
/Users/lbb/homebrew/Cellar/go/1.11.1/libexec/src/runtime/proc.go:201
runtime.goexit
/Users/lbb/homebrew/Cellar/go/1.11.1/libexec/src/runtime/asm_amd64.s:1333
(valid after #42 is merged)
$ kubectl-krew
F0924 19:35:45.867271 43700 root.go:65] failed to find current krew version, err: failed to resolve path, err: failed to stat the currently executed path, err: lstat kubectl-krew: no such file or directory
but kubectl krew
works.
kubectl-krew -v=10
I0924 19:36:04.659937 43717 root.go:93] Ensure creating dir: "/Users/ahmetb/.krew"
I0924 19:36:04.660571 43717 root.go:93] Ensure creating dir: "/var/folders/76/5g_jbgjn6xg_jkwcm2n_m52r00dl55/T/krew"
I0924 19:36:04.660603 43717 root.go:93] Ensure creating dir: "/Users/ahmetb/.krew/store"
I0924 19:36:04.660622 43717 root.go:93] Ensure creating dir: "/Users/ahmetb/.krew/bin"
F0924 19:36:04.660670 43717 root.go:65] failed to find current krew version, err: failed to resolve path, err: failed to stat the currently executed path, err: lstat kubectl-krew: no such file or directory
Not sure why krew needs to find itself through current directory. It's now at $HOME/.krew/bin/kubectl-krew
.
Right now krew.zip has the following structure
unzip -l out/krew.zip
drwxr-xr-x 3.0 unx 0 b- stor 18-Oct-10 23:17 out/bin/
-rwxr-xr-x 3.0 unx 11682304 b- defN 18-Oct-10 23:17 out/bin/krew-windows_amd64.exe
-rwxr-xr-x 3.0 unx 11716104 b- defN 18-Oct-10 23:17 out/bin/krew-darwin_amd64
-rwxr-xr-x 3.0 unx 10214825 b- defN 18-Oct-10 23:17 out/bin/krew-linux_arm
-rwxr-xr-x 3.0 unx 11828176 b- defN 18-Oct-10 23:17 out/bin/krew-linux_amd64
The out/
prefix in the .zip yaml is unnecessary. I'm even thinking bin/
is redundant, too.
We can keep bin/
in case we add other stuff to the release someday, but I think it doesn't matter that much.
Fixing this would
/cc @lbb; wdyt?
We are currently not linting or verifying submissions for the krew index. We should provide a lint tool that is equal to the homebrew audit
command.
$ krew audit --source=./foo.yaml
Check Name Convention: OK
Validate Manifest: OK
Check Install: OK
Test Install and Uninstall with labels(os=linux,arch=amd64): SKIP
All Checks passed
$ krew audit foo
....
The plugin developer can invoke the command locally. In the CI we can call the command for all updated plugin files like:
for name in $(git diff --name-only HEAD~1 HEAD | grep -o "^plugins/.*.yaml"); do
krew audit "$name"
done
The CI executes this command for different platforms to test the installation.
The audit command should check for:
fixes https://github.com/GoogleContainerTools/krew-index/issues/15
Krew by design can't remove itself. We need to handle the case that someone wants to remove krew itself.
$ krew remove krew
krew can't remove krew. Please run:
rm -r <krew-path>
$ echo $?
1
Is there a way to prevent the bash completion naming conflicts?
After krew
installation, when kubectl
is tab-completed, instead of the name being output and a space (useful), I'm given no space and another tab
gives the options:
$ kubectl
kubectl kubectl-krew kubectl-view_secret
This is on macos with bash 5.0.0, I haven't checked on Linux.
Thanks
Example:
https://travis-ci.org/GoogleContainerTools/krew/builds/427308224 (I think I just destroyed it by clicking Rebuild).
Error message:
$ go get gopkg.in/alecthomas/gometalinter.v2
package gopkg.in/alecthomas/gometalinter.v2: unrecognized import path "gopkg.in/alecthomas/gometalinter.v2" (parse https://gopkg.in/alecthomas/gometalinter.v2?go-get=1: no go-import meta tags ())
The command "go get gopkg.in/alecthomas/gometalinter.v2" failed and exited with 1 during .
If a plugin's windows platform
spec specifies something like bin: foo
, we:
foo
I am not at all sure that kubectl-foo.exe
which points to foo
(that has no .exe extension) can be executed. Can someone verify if this works or not?
Depending on that, (1) we need to make sure if a platform spec matches windows
, its bin
must end with ".exe" (2) we need to update existing plugin specs in krew-index.
The centralized krew-index repo started to get many pull requests. So far the #1 issue is:
I suggest we explain GOOD/BAD names by recommending people with example suggestions in a Style Guide that improves over time.
cc: @lbb.
Zip inflation currently tried to get rid of the first folder in a zip archive.
This behavior is inconsistent, it should be removed before we have to move many plugins.
See: #9
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.