diff --git a/app/components/k8s/container-section/template.hbs b/app/components/k8s/container-section/template.hbs index 5da215c62..d1c80a190 100644 --- a/app/components/k8s/container-section/template.hbs +++ b/app/components/k8s/container-section/template.hbs @@ -1,5 +1,5 @@ {{#if model.length}} - +
diff --git a/app/components/k8s/pod-row/template.hbs b/app/components/k8s/pod-row/template.hbs index a845db1fc..e9cb561c4 100644 --- a/app/components/k8s/pod-row/template.hbs +++ b/app/components/k8s/pod-row/template.hbs @@ -20,7 +20,7 @@ {{#if expanded}} - + diff --git a/app/components/modal-shell/component.js b/app/components/modal-shell/component.js index 73880f54c..802b2d92f 100644 --- a/app/components/modal-shell/component.js +++ b/app/components/modal-shell/component.js @@ -1,8 +1,13 @@ import Ember from 'ember'; +const DEFAULT_COMMAND = ["/bin/sh","-c",'TERM=xterm-256color; export TERM; [ -x /bin/bash ] && ([ -x /usr/bin/script ] && /usr/bin/script -q -c "/bin/bash" /dev/null || exec /bin/bash) || exec /bin/sh']; + export default Ember.Component.extend({ originalModel: null, instance: Ember.computed.alias('originalModel'), + command: null, // defaults to DEFAULT_COMMAND + showHeader: true, + showClose: true, status: 'Connecting...', socket: null, @@ -28,7 +33,7 @@ export default Ember.Component.extend({ attachStdin: true, attachStdout: true, tty: true, - command: ["/bin/sh","-c",'TERM=xterm-256color; export TERM; [ -x /bin/bash ] && ([ -x /usr/bin/script ] && /usr/bin/script -q -c "/bin/bash" /dev/null || exec /bin/bash) || exec /bin/sh'], + command: this.get('command') || DEFAULT_COMMAND, }; instance.doAction('execute',opt).then((exec) => { diff --git a/app/components/modal-shell/template.hbs b/app/components/modal-shell/template.hbs index 17306b607..f1dcd928c 100644 --- a/app/components/modal-shell/template.hbs +++ b/app/components/modal-shell/template.hbs @@ -1,7 +1,13 @@ +{{#if showHeader}}

Shell: {{instance.displayName}}

+{{else}} + {{yield}} +{{/if}}
diff --git a/app/components/tooltip-element/component.js b/app/components/tooltip-element/component.js index afea02b6d..e134e0eca 100644 --- a/app/components/tooltip-element/component.js +++ b/app/components/tooltip-element/component.js @@ -26,6 +26,11 @@ export default Ember.Component.extend({ }, show(node) { + if ( this._state === 'destroying' ) + { + return; + } + var svc = this.get('tooltipService'); this.set('showTimer', null); diff --git a/app/k8s-tab/kubectl/route.js b/app/k8s-tab/kubectl/route.js new file mode 100644 index 000000000..907094485 --- /dev/null +++ b/app/k8s-tab/kubectl/route.js @@ -0,0 +1,38 @@ +import Ember from 'ember'; +import C from 'ui/utils/constants'; + +export default Ember.Route.extend({ + k8s: Ember.inject.service(), + + model() { + return this.get('store').findAll('container').then((containers) => { + let inst = null; + for ( let i = 0 ; i < containers.get('length') ; i++) + { + let container = containers.objectAt(i); + if ( container.get('state') !== 'running' ) + { + continue; + } + + var labels = container.get('labels')||{}; + if ( labels[C.LABEL.K8S_KUBECTL]+'' === 'true' ) + { + inst = container; + break; + } + } + + if ( inst ) + { + return Ember.Object.create({ + instance: inst, + }); + } + else + { + return Ember.RSVP.reject('Unable to find an active kubectld container'); + } + }); + }, +}); diff --git a/app/k8s-tab/kubectl/template.hbs b/app/k8s-tab/kubectl/template.hbs new file mode 100644 index 000000000..dc6f19100 --- /dev/null +++ b/app/k8s-tab/kubectl/template.hbs @@ -0,0 +1,11 @@ +
+

kubectl

+

Use this shell to directly execute kubectl commands.

+
+
+ {{modal-shell + originalModel=model.instance + showHeader=false + showClose=false + }} +
diff --git a/app/k8s-tab/namespace/pods/pod/template.hbs b/app/k8s-tab/namespace/pods/pod/template.hbs index cd4dc2fa6..2784d4ae5 100644 --- a/app/k8s-tab/namespace/pods/pod/template.hbs +++ b/app/k8s-tab/namespace/pods/pod/template.hbs @@ -14,11 +14,11 @@
-
-
Container Name
{{k8s/container-section model=model.displayContainers}}