diff options
author | Nick Thomas <nick@gitlab.com> | 2017-06-13 18:31:23 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-06-14 12:51:18 +0300 |
commit | fc6e3515a6a80788053ea943cb43eae2cadda21f (patch) | |
tree | dafc366f9760e33ba72e81b4794486d1692c2f7e /lib/gitlab | |
parent | fbfddd99d6a4846e807dc8c2dadd64d3d120fb23 (diff) |
Backport EE changes to the Kubernetes service
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/kubernetes.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/kubernetes.rb b/lib/gitlab/kubernetes.rb index 4a6091488c8..c56c1a4322f 100644 --- a/lib/gitlab/kubernetes.rb +++ b/lib/gitlab/kubernetes.rb @@ -8,13 +8,13 @@ module Gitlab ) # Filters an array of pods (as returned by the kubernetes API) by their labels - def filter_pods(pods, labels = {}) - pods.select do |pod| - metadata = pod.fetch("metadata", {}) - pod_labels = metadata.fetch("labels", nil) - next unless pod_labels + def filter_by_label(items, labels = {}) + items.select do |item| + metadata = item.fetch("metadata", {}) + item_labels = metadata.fetch("labels", nil) + next unless item_labels - labels.all? { |k, v| pod_labels[k.to_s] == v } + labels.all? { |k, v| item_labels[k.to_s] == v } end end |