K9s: Templating in plugins are not working as expected

Created on 13 Jan 2020  路  2Comments  路  Source: derailed/k9s






Describe the bug
The args in the plugins have a templating system to allow concatenate strings with varaibles like $COL0. It doesn't work in complex strings. Check #303

To Reproduce
Steps to reproduce the behavior:

  1. Go to your plugins.yaml
  2. Add the next code
  suspendCronsSwitch:
    shortCut: Ctrl-S
    scopes:
    - cj
    description: Suspend
    command: kubectl
    background: true
    args:
    - patch
    - cronjobs
    - $COL0
    - -p
    - '{"spec" : {"suspend" : $COL2 }}'
  1. Go to cornjob view and execute the plughin while checking with ps aux what is being launched
while true; do ps aux | grep kubectl | grep -v .svn | grep -v defunct; done

Expected behavior
$COL2 is replace with the valie True or False

Screenshots

Versions (please complete the following information):

  • OS: Ubuntu
  • K9s 0.12.0
  • K8s v1.14.7-gke.23

Additional context
I needed that to execute a bash that switch between True and False strings. I workaround that using two plugins:

  suspendCronsSwitch:
    shortCut: Ctrl-S
    scopes:
    - cj
    description: Suspend
    command: kubectl
    background: true
    args:
    - patch
    - cronjobs
    - $COL0
    - -p
    - '{"spec" : {"suspend" : true }}'
  enableCronsSwitch:
    shortCut: Ctrl-E
    scopes:
    - cj
    description: Enable
    command: kubectl
    background: true
    args:
    - patch
    - cronjobs
    - $COL0
    - -p
    - '{"spec" : {"suspend" : false }}'
bug

All 2 comments

@joskfg - Thank you!! Great catch and excellent report! I'll fix in the next drop...

@joskfg - Should be all betta in v0.13.2. Thank you!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pgoodjohn picture pgoodjohn  路  4Comments

krysopath picture krysopath  路  3Comments

RothAndrew picture RothAndrew  路  3Comments

stk0vrfl0w picture stk0vrfl0w  路  3Comments

mimizone picture mimizone  路  4Comments