Skip to content

Commit 0c76878

Browse files
committed
Remove "Bind Service" feature due to the deprecation of the Service Binding Operator redhat-developer#4682
Issue: redhat-developer#4682 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
1 parent 74731b6 commit 0c76878

File tree

14 files changed

+16
-654
lines changed

14 files changed

+16
-654
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ jobs:
5252
if: (success() || failure()) && runner.os == 'Linux'
5353
name: Start cluster
5454
with:
55-
version: v0.11.1
55+
version: v0.20.0
5656

5757
- name: Configure cluster
5858
if: (success() || failure()) && runner.os == 'Linux'
5959
run: |
6060
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.19.1/install.sh | bash -s v0.19.1
6161
kubectl create -f https://operatorhub.io/install/service-binding-operator.yaml
62-
kubectl create -f https://operatorhub.io/install/stable/cloud-native-postgresql.yaml
62+
kubectl create -f https://operatorhub.io/install/cloudnative-pg.yaml
6363
nb=0
6464
echo -n "Waiting for operator to show up "
6565
while [ "$nb" != "2" ]

build/esbuild.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const webviews = [
2828
'feedback',
2929
'serverless-function',
3030
'serverless-manage-repository',
31-
'add-service-binding',
3231
'openshift-terminal',
3332
];
3433

package.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,6 @@
525525
"title": "Start Dev (manually trigger rebuild)",
526526
"category": "OpenShift"
527527
},
528-
{
529-
"command": "openshift.component.binding.add",
530-
"title": "Bind Service",
531-
"category": "OpenShift"
532-
},
533528
{
534529
"command": "openshift.component.exitDevMode",
535530
"title": "Stop Dev",
@@ -1371,10 +1366,6 @@
13711366
"command": "openshift.component.openInBrowser",
13721367
"when": "false"
13731368
},
1374-
{
1375-
"command": "openshift.component.binding.add",
1376-
"when": "false"
1377-
},
13781369
{
13791370
"command": "openshift.Serverless.openFunction",
13801371
"when": "false"
@@ -1839,11 +1830,6 @@
18391830
"when": "view == openshiftComponentsView && viewItem =~ /openshift\\.component.*\\.dep-nrn.*/ || viewItem =~ /openshift\\.component.*\\.dep-run.*/",
18401831
"group": "c2@1"
18411832
},
1842-
{
1843-
"command": "openshift.component.binding.add",
1844-
"when": "view == openshiftComponentsView && viewItem =~ /openshift\\.component.*\\.dev-nrn.*/",
1845-
"group": "c2@2"
1846-
},
18471833
{
18481834
"command": "openshift.component.showDevTerminal",
18491835
"when": "view == openshiftComponentsView && viewItem =~ /openshift\\.component.*\\.dev-run.*/",

src/helm/helm.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ export type HelmRelease = {
2727
*/
2828
export async function getHelmReleases(): Promise<HelmRelease[]> {
2929
const res = await CliChannel.getInstance().executeTool(HelmCommands.listHelmReleases(), undefined, false);
30-
return JSON.parse(res.stdout) as HelmRelease[];
30+
try {
31+
return JSON.parse(res.stdout) as HelmRelease[];
32+
} catch {
33+
return [];
34+
}
3135
}
3236

3337
/**

src/oc/ocWrapper.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@ export class Oc {
8686

8787
public async getAllKubernetesObjects(namespace?: string, executionContext?: ExecutionContext): Promise<KubernetesObject[]> {
8888
const result = await CliChannel.getInstance().executeTool(
89-
Oc.getKubernetesObjectCommand('all', namespace),
90-
undefined, true, executionContext);
91-
return JSON.parse(result.stdout).items;
89+
Oc.getKubernetesObjectCommand('all', namespace), undefined, true, executionContext);
90+
try {
91+
return JSON.parse(result.stdout).items;
92+
} catch {
93+
return [];
94+
}
9295
}
9396

9497
/**

src/odo/odoWrapper.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
55

6-
import { KubernetesObject } from '@kubernetes/client-node';
76
import { Uri, WorkspaceFolder, workspace } from 'vscode';
87
import { CommandOption, CommandText } from '../base/command';
98
import * as cliInstance from '../cli';
@@ -12,7 +11,6 @@ import { ChildProcessUtil, CliExitData } from '../util/childProcessUtil';
1211
import { VsCommandError } from '../vscommand';
1312
import { Command } from './command';
1413
import { ComponentDescription } from './componentTypeDescription';
15-
import { BindableService } from './odoTypes';
1614

1715
/**
1816
* Wraps the `odo` cli tool.
@@ -189,62 +187,4 @@ export class Odo {
189187
componentPath,
190188
);
191189
}
192-
193-
/**
194-
* Bind a component to a bindable service by modifying the devfile
195-
*
196-
* Resolves when the binding it created.
197-
*
198-
* @param contextPath the path to the component
199-
* @param serviceNamespace the namespace the the service is in
200-
* @param serviceName the name of the service to bind to
201-
* @param bindingName the name of the service binding
202-
*/
203-
public async addBinding(
204-
contextPath: string,
205-
serviceNamespace: string,
206-
serviceName: string,
207-
bindingName: string,
208-
) {
209-
await this.execute(
210-
new CommandText('odo', 'add binding', [
211-
new CommandOption('--service-namespace', serviceNamespace, false),
212-
new CommandOption('--service', serviceName, false),
213-
new CommandOption('--name', bindingName, false),
214-
]),
215-
contextPath,
216-
true,
217-
);
218-
}
219-
220-
/**
221-
* Returns a list of all the bindable services on the cluster.
222-
*
223-
* @returns a list of all the bindable services on the cluster
224-
*/
225-
public async getBindableServices(): Promise<KubernetesObject[]> {
226-
const data: CliExitData = await this.execute(
227-
new CommandText('odo', 'list service', [new CommandOption('-o json')]),
228-
);
229-
let responseObj;
230-
try {
231-
responseObj = JSON.parse(data.stdout);
232-
} catch {
233-
throw new Error(JSON.parse(data.stderr).message);
234-
}
235-
if (!responseObj.bindableServices) {
236-
return [];
237-
}
238-
return (responseObj.bindableServices as BindableService[]) //
239-
.map((obj) => {
240-
return {
241-
kind: obj.kind,
242-
apiVersion: obj.apiVersion,
243-
metadata: {
244-
namespace: obj.namespace,
245-
name: obj.name,
246-
},
247-
} as KubernetesObject;
248-
});
249-
}
250190
}

src/openshift/component.ts

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ import { Command } from '../odo/command';
1212
import { CommandProvider } from '../odo/componentTypeDescription';
1313
import { Odo } from '../odo/odoWrapper';
1414
import { ComponentWorkspaceFolder } from '../odo/workspace';
15-
import sendTelemetry from '../telemetry';
1615
import { ChildProcessUtil, CliExitData } from '../util/childProcessUtil';
1716
import { Progress } from '../util/progress';
1817
import * as fs from '../util/utils';
1918
import { vsCommand, VsCommandError } from '../vscommand';
20-
import AddServiceBindingViewLoader, { ServiceBindingFormResponse } from '../webview/add-service-binding/addServiceBindingViewLoader';
2119
import CreateComponentLoader from '../webview/create-component/createComponentLoader';
2220
import { OpenShiftTerminalApi, OpenShiftTerminalManager } from '../webview/openshift-terminal/openShiftTerminal';
2321
import OpenShiftItem, { clusterRequired, projectRequired } from './openshiftItem';
@@ -241,75 +239,6 @@ export class Component extends OpenShiftItem {
241239
return false;
242240
}
243241

244-
@vsCommand('openshift.component.binding.add')
245-
static async addBinding(component: ComponentWorkspaceFolder) {
246-
247-
const services = await Progress.execFunctionWithProgress('Looking for bindable services', (progress) => {
248-
return Odo.Instance.getBindableServices();
249-
});
250-
251-
if (!services || services.length === 0) {
252-
void window.showErrorMessage('No bindable services are available', 'Open Service Catalog in OpenShift Console')
253-
.then((result) => {
254-
if (result === 'Open Service Catalog in OpenShift Console') {
255-
void commands.executeCommand('openshift.open.operatorBackedServiceCatalog')
256-
}
257-
});
258-
return;
259-
}
260-
261-
void sendTelemetry('startAddBindingWizard');
262-
263-
let formResponse: ServiceBindingFormResponse = undefined;
264-
try {
265-
formResponse = await new Promise<ServiceBindingFormResponse>(
266-
(resolve, reject) => {
267-
void AddServiceBindingViewLoader.loadView(
268-
component.contextPath,
269-
services.map(
270-
(service) => `${service.metadata.namespace}/${service.metadata.name}`,
271-
),
272-
(panel) => {
273-
panel.onDidDispose((_e) => {
274-
reject(new Error('The \'Add Service Binding\' wizard was closed'));
275-
});
276-
return async (eventData) => {
277-
if (eventData.action === 'addServiceBinding') {
278-
resolve(eventData.params);
279-
await panel.dispose();
280-
}
281-
};
282-
},
283-
).then(view => {
284-
if (!view) {
285-
// the view was already created
286-
reject(undefined as Error);
287-
}
288-
});
289-
},
290-
);
291-
} catch {
292-
// The form was closed without submitting,
293-
// or the form already exists for this component.
294-
// stop the command.
295-
return;
296-
}
297-
298-
const selectedServiceObject = services.filter(
299-
(service) =>
300-
`${service.metadata.namespace}/${service.metadata.name}` === formResponse.selectedService,
301-
)[0];
302-
303-
void sendTelemetry('finishAddBindingWizard');
304-
305-
await Odo.Instance.addBinding(
306-
component.contextPath,
307-
selectedServiceObject.metadata.namespace,
308-
selectedServiceObject.metadata.name,
309-
formResponse.bindingName,
310-
);
311-
}
312-
313242
@vsCommand('openshift.component.dev')
314243
@clusterRequired()
315244
@projectRequired()

src/webview/add-service-binding/addServiceBindingViewLoader.ts

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)