Unverified Commit e43aae79 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents f14c0382 f130ed98
...@@ -22,7 +22,8 @@ class Numeric ...@@ -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" ...@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment