mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #55258 from jojje/kubectl-aging-example-namespace-support
Automatic merge from submit-queue (batch tested with PRs 54460, 55258, 54858, 55506, 55510). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. 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 **What this PR does / why we need it**: **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note ```
This commit is contained in:
commit
e43aae79e9
@ -22,7 +22,8 @@ class Numeric
|
|||||||
end
|
end
|
||||||
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)
|
pods_parsed = JSON.parse(pods_json)
|
||||||
|
|
||||||
puts "The Magnificent Aging Plugin."
|
puts "The Magnificent Aging Plugin."
|
||||||
|
@ -2,7 +2,4 @@ name: "aging"
|
|||||||
shortDesc: "Aging shows pods by age"
|
shortDesc: "Aging shows pods by age"
|
||||||
longDesc: >
|
longDesc: >
|
||||||
Aging shows pods from the current namespace by age.
|
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
|
command: ./aging.rb
|
||||||
|
Loading…
Reference in New Issue
Block a user