diff --git a/CHANGELOG.md b/CHANGELOG.md index 757c6ec..8d4d8ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). This CHANGELOG follows the format listed [here ](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md) ## [Unreleased] +### Changed +- `check-kube-service-available.rb`: added `--ignore-evicted` which will ignore pods that are in the Evicted state (@dave-shawley) ## [5.0.2] - 2020-09-15 ### Fixed diff --git a/bin/check-kube-service-available.rb b/bin/check-kube-service-available.rb index 8836dec..0724730 100755 --- a/bin/check-kube-service-available.rb +++ b/bin/check-kube-service-available.rb @@ -29,6 +29,7 @@ # --token-file TOKEN-FILE File containing bearer token for authorization # -l, --list SERVICES List of services to check (required) # -p, --pending SECONDS Time (in seconds) a pod may be pending for and be valid +# --ignore-evicted Ignore evicted pods when calculating availability # # NOTES: # @@ -57,6 +58,12 @@ class AllServicesUp < Sensu::Plugins::Kubernetes::CLI default: 0, proc: proc(&:to_i) + option :ignoreEvicted, + description: 'Skip evicted pods when deciding if a service is available', + long: '--ignore-evicted', + boolean: true, + default: false + def run services = parse_list(config[:service_list]) failed_services = [] @@ -103,6 +110,8 @@ def run end break if pod_available end + when 'Evicted' + next if config[:ignoreEvicted] end failed_services << "#{p.metadata.namespace}.#{p.metadata.name}" if pod_available == false end