diff --git a/pkg/kubectl/plugins/examples/aging/aging.rb b/pkg/kubectl/plugins/examples/aging/aging.rb index ed9a87fffc6..3a60e94c431 100755 --- a/pkg/kubectl/plugins/examples/aging/aging.rb +++ b/pkg/kubectl/plugins/examples/aging/aging.rb @@ -22,7 +22,8 @@ class Numeric end end -pods_json = `kubectl get pods -o json` +namespace = ENV['KUBECTL_PLUGINS_CURRENT_NAMESPACE'] || 'default' +pods_json = `kubectl --namespace #{namespace} get pods -o json` pods_parsed = JSON.parse(pods_json) puts "The Magnificent Aging Plugin." diff --git a/pkg/kubectl/plugins/examples/aging/plugin.yaml b/pkg/kubectl/plugins/examples/aging/plugin.yaml index 07dc2022a68..87275dc095b 100644 --- a/pkg/kubectl/plugins/examples/aging/plugin.yaml +++ b/pkg/kubectl/plugins/examples/aging/plugin.yaml @@ -2,7 +2,4 @@ name: "aging" shortDesc: "Aging shows pods by age" longDesc: > Aging shows pods from the current namespace by age. - Once we have plugin support for global flags through - env vars (planned for V1) we'll be able to switch - between namespaces using the --namespace flag. command: ./aging.rb