|
4 | 4 |
|
5 | 5 | This [Lens](https://k8slens.dev/) Extension adds a status bar item, and a menu item, that makes it easy to connect Lens to a Mirantis Container Cloud instance and add its clusters to Lens.
|
6 | 6 |
|
7 |
| -ℹ️ Requires Lens `>= 4.0.6`. |
| 7 | +ℹ️ Requires Lens `>= 4.2`. |
8 | 8 |
|
9 | 9 | 
|
10 | 10 |
|
| 11 | +## 🚨 Version 2.2.0 of this extension will be the last one to support basic authentication |
| 12 | + |
| 13 | +As of the next major release of this extension (v3.0.0), basic auth (entering the username and password in the extension itself) will no longer be supported. Your instance will need to be configured to use Container Cloud's built-in Keycloak service for authentication and authorization. |
| 14 | + |
| 15 | +> Keycloak-based authentication/authorization is much more secure than basic username/password authentication. Consider migrating your Container Cloud instance to it if you haven't already. |
| 16 | +
|
| 17 | +As there are major changes coming in Lens 5.0 as well, when we update this extension to drop basic auth, it will coincide with the Lens 5.0 release, and any prior versions of this extension will no longer work with Lens 5.0. You will need to install an older version of Lens in order to use an older version of this extension. |
| 18 | + |
11 | 19 | ## Installing
|
12 | 20 |
|
13 | 21 | These instructions will help you install the extension for direct use with Lens. Follow the [development](#development) instructions below if you intend to work on the extension to improve it.
|
@@ -82,12 +90,50 @@ $ git push && git push --tags
|
82 | 90 |
|
83 | 91 | The `prepublishOnly` script will automatically produce a production build in the `./dist` directory, which will be published.
|
84 | 92 |
|
85 |
| -## Help |
| 93 | +## SSO support |
| 94 | + |
| 95 | +Mirantis Container Cloud instances that use third-party SSO authentication via __Keycloak__ are supported. |
| 96 | + |
| 97 | +### Keycloak Configuration |
| 98 | + |
| 99 | +Since the integration leverages the `lens://` URL protocol handling feature for extensions, __Lens 4.2__ (or later) is required, and the __Keycloak Client__ of the instance must be configured as follows: |
| 100 | + |
| 101 | +- Allow requests from the `"*"` origin. This is because the internal Electron browser used by the Lens App uses a random port. Therefore, the originating URL cannot be predicted. |
| 102 | +- Allow the following redirect URI: `lens://extensions/@mirantis/lens-extension-cc/oauth/code` |
| 103 | + |
| 104 | +> 💡 Be sure to make these configuration adjustments __on every Keycloak Client__ (`kaas` for the management cluster, and `k8s` for child clusters by default) that manages clusters you will want to add. The extension does not know ahead of time whether you have given it the appropriate access, and adding clusters without this configuration will result in an error. |
| 105 | +
|
| 106 | +### Authentication flow |
| 107 | + |
| 108 | +The extension will automatically detect when an instance uses SSO (upon clicking the __Access__ button). |
| 109 | + |
| 110 | +If that's the case, Lens will open the instance's SSO authorization page in the system's default browser. |
| 111 | + |
| 112 | +Once authorized, Keycloak will redirect to the `lens://...` URL, triggering the browser to ask permission to open the Lens app to process the request (unless permission was granted previously with the _always allow_ check box for your SSO ID Provider, e.g. `accounts.google.com`): |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | +> ⚠️ Even if you check the "Always allow" box, your browser may still continue to show a popup message waiting for you to click on an "Open Lens.app" button. This is a built-in security feature. Please be on the look out for this popup in your browser whenever accessing your Container Cloud instance, or adding clusters to Lens. |
| 117 | +
|
| 118 | +Whether the permission was already given, or upon clicking __Open Lens.app__, Lens will receive focus again, and the extension will then read the list of namespaces and clusters as it normally would when using basic (username/password) authentication. |
| 119 | + |
| 120 | +The temporary browser window used for SSO authorization will likely still be open, and should now be closed manually. |
| 121 | + |
| 122 | +### Single cluster limitation |
| 123 | + |
| 124 | +Due to technical issues with generating a unique kubeConfig per cluster, when the Container Cloud instance uses SSO authorization, cluster selection is __limited to a single cluster__: |
86 | 125 |
|
87 |
| -### SSO not supported |
| 126 | + |
88 | 127 |
|
89 |
| -Mirantis Container Cloud instances that use third-party SSO authentication (e.g. Google OAuth) are __not supported__ at this time. We plan on adding support [soon](https://github.com/Mirantis/lens-extension-cc/issues/12). |
| 128 | +We hope to overcome this limitation in the future. |
90 | 129 |
|
91 |
| -### Management clusters not selected by default |
| 130 | +## FAQ |
92 | 131 |
|
93 |
| -The extension purposely doesn't not add management clusters to the default/initial set of selected clusters after retrieving clusters from a Mirantis Container Cloud instance because they are typically of less interest than workload clusters. |
| 132 | +- Why are management clusters not selected by default? |
| 133 | + - The extension purposely doesn't not add management clusters to the default/initial set of selected clusters after retrieving clusters from a Mirantis Container Cloud instance because they are typically of less interest than workload clusters. |
| 134 | +- I get an error, "Invalid redirect_uri", when I attempt to access or add my clusters. |
| 135 | + - Make sure you have properly [configured](#keycloak-configuration) all your Keycloak clients for use with the extension. |
| 136 | +- Why can I only selected one cluster to add at a time? |
| 137 | + - See [Single cluster limitation](#single-cluster-limitation) when using SSO. |
| 138 | +- I was able to add my cluster to Lens, but Lens fails to show it because of an authentication error. |
| 139 | + - Check if the cluster is only accessible over a private network (i.e. VPN) connection, and try opening it in Lens once connected to the network. Even though you can see the cluster in Container Cloud, as well as in the extension, accessing the cluster's details may still require a VPN connection in this case. |
0 commit comments