Bug 1670652 - [MSTR-8] The new mechanism for oc plugin of git-style does not work
Summary: [MSTR-8] The new mechanism for oc plugin of git-style does not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.1.0
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-30 03:11 UTC by zhou ying
Modified: 2019-06-04 10:42 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Plugins were recognized only when having kubect- prefix Consequence: Not all plugins were working. Fix: Allow both kubectl- and oc- prefix for plugins. Result: Both plugins are working as expected.
Clone Of:
Environment:
Last Closed: 2019-06-04 10:42:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0758 0 None None None 2019-06-04 10:42:36 UTC

Description zhou ying 2019-01-30 03:11:07 UTC
Description of problem:
The new mechanism for oc plugin of git-style does not work

Version-Release number of selected component (if applicable):
oc v4.0.0-0.149.0
kubernetes v1.12.4+50c2f2340a


How reproducible:
Always

Steps to Reproduce:
1. Install the latest OC  and kubectl client;
2. Create the plugin :
   `echo -e '#!/bin/bash\n echo "Plugin oc-foo_bar is executed"' > ./oc-foo_bar`
   `chmod +x oc-foo_bar`
   `mv oc-foo_bar /usr/local/bin/`
3. Use `oc plugin list` command to list the plugin
4. Change the plugin name to 'kubectl-foo_bar' , use the 'oc plugin list' command
5. Use `oc plugin -h` command to check the help info.

Actual results:
3. Could not find the oc plugin:
[root@dhcp-140-138 ~]# oc plugin list
error: unable to find any kubectl plugins in your PATH

4. Show the kubectl-compatible plugins are available, but could not use the plugin
5. The help info was not clear



Expected results:
3. Should find the oc plugin;
4. Only the kubectl could use the plugin , the oc client could not use the kubectl-compatible plugin.
5. Should give clear documentation and examples for how to write the plugin.


Additional info:

Comment 1 Juan Vallejo 2019-01-30 19:27:21 UTC
Thanks for catching this.
Origin PR: https://github.com/openshift/origin/pull/21909

Will open upstream PR once we decide if we want to carry a patch for any of the upstream changes.

Comment 2 Juan Vallejo 2019-02-04 15:34:15 UTC
Upstream [1] and Origin [2] PRs have merged.

1. https://github.com/kubernetes/kubernetes/pull/73642
2. https://github.com/openshift/origin/pull/21909

Comment 6 zhou ying 2019-02-14 02:53:02 UTC
The new mechanism works fine now:
[root@dhcp-140-138 ~]# oc plugin list
The following compatible plugins are available:

/root/bin/oc-foo
/usr/bin/oc-fao_bar
/usr/local/sbin/oc-foo_bar
/usr/local/sbin/oc-foo_bar_baz
[root@dhcp-140-138 ~]# oc foo
I am a plugin named foo
[root@dhcp-140-138 ~]# oc foo-bar
Plugin oc-foo-bar is executed
[root@dhcp-140-138 ~]# oc version
oc v4.0.0-0.170.0
kubernetes v1.12.4+45dbe929fa
features: Basic-Auth GSSAPI Kerberos SPNEGO

Comment 9 errata-xmlrpc 2019-06-04 10:42:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0758


Note You need to log in before you can comment on or make changes to this bug.