Open frankfarzan opened 3 years ago
@frankfarzan @droot We should also have a way to list the available functions
$ kpt fn doc
Here are the list of available kpt functions
gcr.io/kpt-fn/apply-setters:v0.1
gcr.io/kpt-fn/apply-setters:v0.2
gcr.io/kpt-fn/set-namespace:v0.1
...
$ kpt fn doc --image gcr.io/kpt-fn/apply-setters:v0.1
Display the usage documentation(similar to the one in issue description.)
cc @bgrant0607
+1 to listing available functions for each registered catalog (I assume multiple catalogs will happen as soon as others start to write functions).
Being able to filter according to relevant functions would be awesome, too.
As we move functionality out of inline parameters and template code into functions, users need to be able to discover applicable functions they could use on a given package containing a particular set of resource types. For instance, if there were a function to set Gatekeeper (https://open-policy-agent.github.io/gatekeeper/website/docs/violations/#dry-run-enforcement-action) constraint common attributes such as enforcementAction, excludedNamespaces, etc., we would like to recommend it for a package containing pod security constraints (https://github.com/open-policy-agent/gatekeeper-library/tree/master/library/pod-security-policy).
+1 to highlighting relevant functions. For example, a set-project function should be highlighted when interacting with a KCC package but is useless otherwise.
I suggest filing a separate issue for function discovery. This issue is specifically about the doc
command that shows the help message for a given function which is orthogonal to this.
Filed https://github.com/GoogleContainerTools/kpt/issues/2333 to track function discovery