diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-04 00:09:04 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-04 00:09:04 +0000 |
commit | 27a18afc7dba4e09a5ec78e5c251c31216d7792a (patch) | |
tree | 5dcc015be79e00de4133a66defe10bf1463ff827 /app/models/clusters | |
parent | 71c9d577ad563572050335dc261ba7673e3e566f (diff) | |
download | gitlab-ce-27a18afc7dba4e09a5ec78e5c251c31216d7792a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/clusters')
-rw-r--r-- | app/models/clusters/platforms/kubernetes.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb index ae720065387..444368d0ef3 100644 --- a/app/models/clusters/platforms/kubernetes.rb +++ b/app/models/clusters/platforms/kubernetes.rb @@ -92,7 +92,10 @@ module Clusters def calculate_reactive_cache_for(environment) return unless enabled? - { pods: read_pods(environment.deployment_namespace) } + pods = read_pods(environment.deployment_namespace) + + # extract_relevant_pod_data avoids uploading all the pod info into ReactiveCaching + { pods: extract_relevant_pod_data(pods) } end def terminals(environment, data) @@ -203,6 +206,21 @@ module Clusters def nullify_blank_namespace self.namespace = nil if namespace.blank? end + + def extract_relevant_pod_data(pods) + pods.map do |pod| + { + 'metadata' => pod.fetch('metadata', {}) + .slice('name', 'generateName', 'labels', 'annotations', 'creationTimestamp'), + 'status' => pod.fetch('status', {}).slice('phase'), + 'spec' => { + 'containers' => pod.fetch('spec', {}) + .fetch('containers', []) + .map { |c| c.slice('name') } + } + } + end + end end end end |