|
| 1 | +--- |
| 2 | +title: Kui Graphical Terminal Enhancements |
| 3 | +authors: |
| 4 | + - "@starpit" |
| 5 | + - "@paulcastro" |
| 6 | +owning-sig: sig-cli |
| 7 | +participating-sigs: |
| 8 | + - sig-cli |
| 9 | +reviewers: |
| 10 | + - TBD |
| 11 | +approvers: |
| 12 | + - TBD |
| 13 | +editor: TBD |
| 14 | +creation-date: 2019-11-14 |
| 15 | +last-updated: 2020-01-30 |
| 16 | +status: implemented |
| 17 | +see-also: |
| 18 | + |
| 19 | +replaces: |
| 20 | + |
| 21 | +superseded-by: |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +# Kubectl Graphical Plugins |
| 26 | + |
| 27 | +## Table of Contents |
| 28 | + |
| 29 | +<!-- toc --> |
| 30 | +- [Summary](#summary) |
| 31 | +- [Motivation](#motivation) |
| 32 | + - [Goals](#goals) |
| 33 | + - [Non-Goals](#non-goals) |
| 34 | +- [Proposal](#proposal) |
| 35 | + - [Risks and Mitigations](#risks-and-mitigations) |
| 36 | +- [Design Details](#design-details) |
| 37 | + - [Test Plan](#test-plan) |
| 38 | + - [Graduation Criteria](#graduation-criteria) |
| 39 | + - [Examples](#examples) |
| 40 | + - [Alpha -> Beta Graduation](#alpha---beta-graduation) |
| 41 | + - [Beta -> GA Graduation](#beta---ga-graduation) |
| 42 | + - [Removing a deprecated flag](#removing-a-deprecated-flag) |
| 43 | + - [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy) |
| 44 | + - [Version Skew Strategy](#version-skew-strategy) |
| 45 | +- [Implementation History](#implementation-history) |
| 46 | +<!-- /toc --> |
| 47 | + |
| 48 | +## Summary |
| 49 | + |
| 50 | +This enhancement offers a kubectl plugin framework that allows |
| 51 | +`kubectl` and `kubectl` plugins the ability to have graphical popups |
| 52 | +in response to normal CLI commands. To provide a popup-from-terminal |
| 53 | +experience, this project leverages the Kui project. |
| 54 | + |
| 55 | +## Motivation |
| 56 | + |
| 57 | +CLIs are highly desired, for their speed, ease of sharing and |
| 58 | +scripting, and generally not getting in the way of development and |
| 59 | +operational tasks. However, visualizations, even simple ones, can go a |
| 60 | +long way with assisting in common kubernetes tasks. |
| 61 | + |
| 62 | +Today, the `kubectl` CLI and its plugins exist separately from the |
| 63 | +visual experience provided by browser-based consoles. You must chose |
| 64 | +to inhabit (using, and extending) one world or the other. |
| 65 | + |
| 66 | +We believe it is possible to bring the two closer together. So that, |
| 67 | +as a tool user, transitions from a terminal world into a graphical |
| 68 | +world are fast, and only at my choosing; and, as a tool developer, I |
| 69 | +can enhance the world of CLIs, in a way that can be reused, if needed, |
| 70 | +in a browser context: a framework for CLI-driven graphical tools. |
| 71 | + |
| 72 | +### Goals |
| 73 | + |
| 74 | +1) Deliver a `kui` plugin for kubectl that has graphical popups that enhance the user experience |
| 75 | +2) Deliver a `kui-core` framework with a well defined API to facilitate development of plugins such as `kui`. |
| 76 | +3) Deliver a `kui-template` repository that plugin developers can opt to use as a starting point for developing their own graphical plugins. |
| 77 | +4) That such graphical plugins can leverage `krew` for installation |
| 78 | + |
| 79 | +### Non-Goals |
| 80 | + |
| 81 | +- We limit the scope such that graphical plugins and the required |
| 82 | + framework are installed and used with the discretion of our |
| 83 | + users. In particular, there is no need to replace existing |
| 84 | + non-graphical `kubectl` plugins that work well with purely textual |
| 85 | + output. |
| 86 | +- We desire no mandates for radical updates or parallel constructs to |
| 87 | + `krew` in order to support graphical plugins. We will base any |
| 88 | + krew-focused work on the goal of minimal perturbation. |
| 89 | + |
| 90 | +## Proposal |
| 91 | + |
| 92 | +An implementation of the first deliverable is available at |
| 93 | +[https://github.com/kui-shell/plugin-kubeui](https://github.com/kui-shell/plugin-kubeui). |
| 94 | + |
| 95 | +An implementation of the second deliverable is available at |
| 96 | +[https://github.com/IBM/kui](https://github.com/IBM/kui). |
| 97 | + |
| 98 | +An implementation of the third deliverable is available at |
| 99 | +[https://github.com/kui-shell/plugin-kubectl-boilerplate](https://github.com/kui-shell/plugin-kubectl-boilerplate). |
| 100 | + |
| 101 | +The minimal krew integration should only depend upon support for |
| 102 | +symlinks in its tarball extraction logic. This is due to the way |
| 103 | +Electron executables are structured on macOS. In this scheme, which we |
| 104 | +refer to as producing and distributing "fat" plugins, each plugin will |
| 105 | +contain its own copy of kui-core, including all of Electron (and its |
| 106 | +attendant copy of Chromium). |
| 107 | + |
| 108 | +An alternate krew integrration story, which we refer to as the "thin |
| 109 | +plugin" strategy, would require development of a chain loader. When |
| 110 | +installing a thin plugin, the plugin would install, if needed, the |
| 111 | +kui-loader plugin. This would: 1) allow for very small plugin |
| 112 | +downloads; 2) maintain the ability for plugins to pin themselves to a |
| 113 | +particular version of electron and kui-core; 3) avoid having a |
| 114 | +separate copy of chromium in memory for every plugin window.. We have |
| 115 | +a prototype of such a chain loader here: |
| 116 | +[https://github.com/kui-shell/kask](https://github.com/kui-shell/kask). |
| 117 | + |
| 118 | + |
| 119 | +### Risks and Mitigations |
| 120 | + |
| 121 | +- Mac OS X utilizes symlinks to link to platform frameworks. Symlinks |
| 122 | + could be a security concern so we would need a way to ensure links |
| 123 | + are contained in "safe" directories |
| 124 | + |
| 125 | +## Design Details |
| 126 | + |
| 127 | +We refer you to the repository links above. In addition, we have API |
| 128 | +documentation for kui-core available |
| 129 | +[here](https://github.com/IBM/kui/wiki). |
| 130 | + |
| 131 | +### Test Plan |
| 132 | + |
| 133 | +The kui-core and kui repositories have a Travis-based test story in |
| 134 | +place. As part of kui-core, there is a set of test APIs that plugin |
| 135 | +developers can use that substantially reduce the development effort |
| 136 | +required to cover their plugin with tests. |
| 137 | + |
| 138 | +### Graduation Criteria |
| 139 | + |
| 140 | +TBD |
| 141 | + |
| 142 | +#### Examples |
| 143 | + |
| 144 | +We also have a log plugin written using the kui-core framework: [logui](https://github.com/kui-shell/plugin-logui). |
| 145 | + |
| 146 | +We also have a plugin for OpenWhisk: [oui](https://github.com/kui-shell/oui). |
| 147 | + |
| 148 | +##### Alpha -> Beta Graduation |
| 149 | + |
| 150 | + |
| 151 | +##### Beta -> GA Graduation |
| 152 | + |
| 153 | + |
| 154 | +##### Removing a deprecated flag |
| 155 | + |
| 156 | + |
| 157 | +### Upgrade / Downgrade Strategy |
| 158 | + |
| 159 | + |
| 160 | +### Version Skew Strategy |
| 161 | + |
| 162 | + |
| 163 | + |
| 164 | +## Implementation History |
| 165 | + |
| 166 | + |
| 167 | + |
0 commit comments