Skip to content

Commit

Permalink
fix(plugins/plugin-kubectl): oc login does not switch kube proxy in b…
Browse files Browse the repository at this point in the history
…rowser clients

part of kubernetes-sigs#7742
  • Loading branch information
starpit committed Jun 29, 2021
1 parent 011478f commit 58eab9f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugins/plugin-kubectl/oc/src/controller/oc/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ import { doExecWithPty, emitKubectlConfigChangeEvent } from '@kui-shell/plugin-k

export default function registerOcLogin(registrar: Registrar) {
registrar.listen('/oc/login', async args => {
const command = args.command.replace(/login/, '_login')
const response = await args.REPL.qexec(command)
emitKubectlConfigChangeEvent('SetNamespaceOrContext')
return response
})

registrar.listen('/oc/_login', async args => {
args.command = args.command.replace(/_login/, 'login')
args.argvNoOptions[1] = 'login'
args.argv[1] = 'login'
const response = await doExecWithPty(args)
emitKubectlConfigChangeEvent('SetNamespaceOrContext')
return response
Expand Down

0 comments on commit 58eab9f

Please sign in to comment.