You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+86
Original file line number
Diff line number
Diff line change
@@ -127,6 +127,92 @@ Due to technical issues with generating a unique kubeConfig per cluster, when th
127
127
128
128
We hope to overcome this limitation in the future.
129
129
130
+
## Supported protocol requests
131
+
132
+
[Lens 4.2](https://medium.com/k8slens/lens-4-2-released-f1c3268d3f95) introduced a new __custom Lens protocol handler__. This means Lens can now respond to `lens://` URL requests made in the browser, and this extension can now support some interesting requests that enable tighter integration between Mirantis Container Cloud instances and Lens.
133
+
134
+
> Note that this integration is a one-way street: Container Cloud -> Lens. It does not work the other way around. _Reverse_ integration is achieved simply by making Container Cloud API requests from Lens, which is much easier to achieve, and has been used by this extension since its inception.
135
+
136
+
The __base URL__ for requests that this extension can respond to is:
137
+
138
+
```
139
+
lens://extensions/@mirantis/lens-extension-cc
140
+
```
141
+
142
+
The following APIs are currently supported by this extension, from the base URL above:
143
+
144
+
### Protocol - Activate cluster
145
+
146
+
Activates a cluster __already added__ to Lens.
147
+
148
+
```
149
+
GET /activateCluster
150
+
?cloudUrl={string}
151
+
&namespace={string}
152
+
&clusterName={string}
153
+
&clusterId={string}
154
+
```
155
+
156
+
-`cloudUrl`: URL to the instance, e.g. `https://container-cloud.my-company.com`
157
+
-`namespace`: ID of the Container Cloud namespace containing the cluster to activate.
158
+
-`clusterName`: Name of the cluster to activate.
159
+
-`clusterId`: ID of the cluster (in `namespace`) to activate.
160
+
161
+
### Protocol - Add one cluster
162
+
163
+
Adds a __single__ cluster to Lens (if it hasn't already been added) by providing a pre-configured kubeConfig JSON object for the cluster. As such, this endpoint does not require the extension to perform any authentication/authorization requests. It simply stores the kubeConfig on disk and tells Lens where to find it.
164
+
165
+
```
166
+
GET /kubeConfig
167
+
?cloudUrl={string}
168
+
&namespace={string}
169
+
&clusterName={string}
170
+
&clusterId={string}
171
+
&kubeConfig={string}
172
+
```
173
+
174
+
-`cloudUrl`: URL to the instance, e.g. `https://container-cloud.my-company.com`
175
+
-`namespace`: ID of the Container Cloud namespace containing the cluster to activate.
176
+
-`clusterName`: Name of the cluster to activate.
177
+
-`clusterId`: ID of the cluster (in `namespace`) to activate.
Allows the user to add __one or more__ clusters to Lens by telling the extension where to find them. Unlike [adding one cluster](#add-one-cluster), it does not automatically add any clusters to Lens. It simply triggers the extension to immediately list all available clusters, and then lets the user choose which ones to add.
183
+
184
+
```
185
+
GET /addClusters
186
+
?cloudUrl={string}
187
+
&username={string}
188
+
&tokens={string}
189
+
[ &keycloakLogin={boolean} ]
190
+
[ &namespaces={string} ]
191
+
```
192
+
193
+
-`cloudUrl`: URL to the instance, e.g. `https://container-cloud.my-company.com`
194
+
-`username`: Username associated with the `tokens`.
195
+
-`tokens`: JSON-stringified, Base64-encoded OAuth2 tokens for the user.
196
+
-`keycloakLogin` (Optional): `false` (default) if the instance in `cloudUrl` uses basic (username/password) authentication; `true` if the instance in `cloudUrl` uses SSO authorization.
197
+
-`namespaces` (Optional): Comma-delimited list of namespace IDs to restrict the list of clusters presented by the extension (i.e. a filter on namespaces). Only clusters in these namespaces will be listed.
198
+
199
+
### Protocol - SSO OAuth Code
200
+
201
+
Allow the extension to use the system's default browser to broker an OAuth authorization code with a Keycloak client in a Container Cloud instance. This is used both for general access (to list clusters) as well as specific cluster access to generate kubeConfig files to add to Lens.
202
+
203
+
```
204
+
GET /oauth/code
205
+
?code={string}
206
+
[ &state={string} ]
207
+
[ &error={string} ]
208
+
[ &error_description={string} ]
209
+
```
210
+
211
+
-`code`: Temporary authorization code to exchange for API tokens.
212
+
-`state` (Optional): Used to differentiate between requests for general access and specific access. The value is generated by the extension as part of the request and should come back as part of the response.
213
+
-`error` (Optional): OAuth error message, if an error occurs.
214
+
-`error_description` (Optional): OAuth error description, if an error occurs.
215
+
130
216
## FAQ
131
217
132
218
- Why are management clusters not selected by default?
0 commit comments