mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Fix namespace support in kubectl aging plugin
The example plugin's comments mentioned the namespace support limitation, awaiting kubectl to implement environment variable propagation. Now that 1.8 is out, the requirement is satisfied. This commit adds use of the conveyed namespace information to the plugin example. Fixes #55255
This commit is contained in:
parent
45bdf707f0
commit
f130ed9837
@ -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."
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user