-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement kube config injection on openshift cluster (#517)
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
- Loading branch information
Showing
3 changed files
with
76 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/********************************************************************* | ||
* Copyright (c) 2020 Red Hat, Inc. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
**********************************************************************/ | ||
|
||
import * as commandExists from 'command-exists' | ||
|
||
export const KUBERNETES_CLI = 'kubectl' | ||
export const OPENSHIFT_CLI = 'oc' | ||
|
||
export function getClusterClientCommand(): string { | ||
const clusterClients = [KUBERNETES_CLI, OPENSHIFT_CLI] | ||
for (const command of clusterClients) { | ||
if (commandExists.sync(command)) { | ||
return command | ||
} | ||
} | ||
|
||
throw new Error('No cluster CLI client is installed.') | ||
} |