Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Add support for Argo CLI plugins #5586

Closed
wants to merge 1 commit into from

Conversation

dinever
Copy link
Member

@dinever dinever commented Apr 3, 2021

Closes #4158

This will allow us to create CLI plugins in the kubectl style.

For example, by having this at /usr/local/bin/argo-foo

#!/bin/bash

# optional argument handling
if [[ "$1" == "version" ]]
then
    echo "1.0.0"
    exit 0
fi

echo "I am a plugin named argo-foo"

We can do:

Screen Shot 2021-04-05 at 7 16 30 PM

This will open opportunities for the community to write Argo plugins for some more specific use cases. For example:

TODO:

  • Add tests
  • Write docs for Argo plugin

Thanks!

/cc @alexec

@dinever
Copy link
Member Author

dinever commented Apr 3, 2021

Do we also want a argo plugin list command to list all the available plugins? This is what kubectl has: https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/#checking-for-plugin-warnings

@codecov
Copy link

codecov bot commented Apr 3, 2021

Codecov Report

Merging #5586 (4bbfd59) into master (4e450e2) will decrease coverage by 0.16%.
The diff coverage is 0.00%.

❗ Current head 4bbfd59 differs from pull request most recent head 883b4b2. Consider uploading reports for the commit 883b4b2 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5586      +/-   ##
==========================================
- Coverage   47.01%   46.84%   -0.17%     
==========================================
  Files         240      241       +1     
  Lines       15002    15044      +42     
==========================================
- Hits         7053     7048       -5     
- Misses       7048     7099      +51     
+ Partials      901      897       -4     
Impacted Files Coverage Δ
cmd/argo/commands/plugin.go 0.00% <0.00%> (ø)
cmd/argo/commands/root.go 0.00% <0.00%> (ø)
server/workflow/workflow_server.go 38.74% <0.00%> (-3.99%) ⬇️
workflow/controller/operator.go 70.96% <0.00%> (+0.27%) ⬆️
cmd/argo/commands/get.go 56.66% <0.00%> (+0.66%) ⬆️
workflow/metrics/server.go 16.66% <0.00%> (+4.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e450e2...883b4b2. Read the comment docs.

}

return nil
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is pretty much copied from https://github.com/kubernetes/kubernetes/blob/v1.19.6/pkg/kubectl/cmd/cmd.go#L330-L429

Unfortunately, I couldn't just import it because it was not in the k8s.io/kubectl module until v1.20.x (we are using the v1.19.6 SDK).

One way to use it is to directly import k8s.io/kubernetes which we are not supposed to do.

Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
@dinever
Copy link
Member Author

dinever commented May 17, 2021

Closing this for now because as of k8s API v0.19.6 the NewDefaultPluginHandler is not exposed. Will be easier to implement once we upgrade the k8s API to v0.20.x.

@dinever dinever closed this May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Argo CLI plugins
2 participants