Merge branch 'master' of github.com-derailed:derailed/k9s
commit
a0342516e9
|
|
@ -39,4 +39,4 @@ k9s:
|
|||
|
||||
---
|
||||
|
||||
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2020 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2021 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package view
|
|||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
|
@ -20,6 +21,12 @@ func (e Env) Substitute(arg string) (string, error) {
|
|||
return arg, nil
|
||||
}
|
||||
|
||||
// To prevent the substitution starts with the shorter environment variable,
|
||||
// sort with the length of the found environment variables.
|
||||
sort.Slice(kk, func (i, j int) bool {
|
||||
return len(kk[i]) > len(kk[j])
|
||||
})
|
||||
|
||||
for _, k := range kk {
|
||||
key, inverse := k[1:], false
|
||||
if key[0] == '!' {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ func TestEnvReplace(t *testing.T) {
|
|||
}{
|
||||
"no-args": {arg: "blee blah", e: "blee blah"},
|
||||
"simple": {arg: "$A", e: "10"},
|
||||
"substring": {arg: "$A and $AA", e: "10 and 20"},
|
||||
"with-text": {arg: "Something $A", e: "Something 10"},
|
||||
"noMatch": {arg: "blah blah and $BLEE", err: errors.New(`no environment matching key "$BLEE":"BLEE"`), e: ""},
|
||||
"lower": {arg: "And then $b happened", e: "And then blee happened"},
|
||||
|
|
@ -27,6 +28,7 @@ func TestEnvReplace(t *testing.T) {
|
|||
|
||||
e := Env{
|
||||
"A": "10",
|
||||
"AA": "20",
|
||||
"B": "blee",
|
||||
"COL0": "fred",
|
||||
"FRED": "fred",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
# $HOME/.k9s/plugin.yml
|
||||
# move selected line to chosen resource in K9s, then:
|
||||
# Shift-T (with confirmation) to toggle helm releases or kustomizations suspend and resume
|
||||
# Shift-R (no confirmation) to reconcile a git source or a helm release or a kustomization
|
||||
plugin:
|
||||
toggle-helmrelease:
|
||||
shortCut: Shift-T
|
||||
confirm: true
|
||||
scopes:
|
||||
- helmreleases
|
||||
description: Toggle to suspend or resume a HelmRelease
|
||||
command: sh
|
||||
background: false
|
||||
args:
|
||||
- -c
|
||||
- "flux $([ $(kubectl get helmreleases -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1) = \"true\" ] && echo \"resume\" || echo \"suspend\") helmrelease -n $NAMESPACE $NAME | less"
|
||||
toggle-kustomization:
|
||||
shortCut: Shift-T
|
||||
confirm: true
|
||||
scopes:
|
||||
- kustomizations
|
||||
description: Toggle to suspend or resume a Kustomization
|
||||
command: sh
|
||||
background: false
|
||||
args:
|
||||
- -c
|
||||
- "flux $([ $(kubectl get kustomizations -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1) = \"true\" ] && echo \"resume\" || echo \"suspend\") kustomization -n $NAMESPACE $NAME | less"
|
||||
reconcile-git:
|
||||
shortCut: Shift-R
|
||||
confirm: false
|
||||
description: Flux reconcile
|
||||
scopes:
|
||||
- gitrepositories
|
||||
command: sh
|
||||
background: false
|
||||
args:
|
||||
- -c
|
||||
- "flux reconcile source git -n $NAMESPACE $NAME | less"
|
||||
reconcile-hr:
|
||||
shortCut: Shift-R
|
||||
confirm: false
|
||||
description: Flux reconcile
|
||||
scopes:
|
||||
- helmreleases
|
||||
command: sh
|
||||
background: false
|
||||
args:
|
||||
- -c
|
||||
- "flux reconcile helmrelease -n $NAMESPACE $NAME | less"
|
||||
reconcile-ks:
|
||||
shortCut: Shift-R
|
||||
confirm: false
|
||||
description: Flux reconcile
|
||||
scopes:
|
||||
- kustomizations
|
||||
command: sh
|
||||
background: false
|
||||
args:
|
||||
- -c
|
||||
- "flux reconcile kustomization -n $NAMESPACE $NAME | less"
|
||||
|
|
@ -8,8 +8,8 @@ k9s:
|
|||
bgColor: black
|
||||
suggestColor: dodgerblue
|
||||
info:
|
||||
fgColor: white
|
||||
sectionColor: dodgerblue
|
||||
fgColor: orange
|
||||
sectionColor: white
|
||||
dialog:
|
||||
fgColor: dodgerblue
|
||||
bgColor: black
|
||||
|
|
|
|||
Loading…
Reference in New Issue