Sha256: 52ecfe0eac2e6e53597820b9d88642f4b5b19d38af8e74b43fcbe08d8f4e5a73
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
module KubeAutoAnalyzer def self.dump_config @log.debug("Entering the config dumper module") target = @options.target_server @log.debug("dumping the config for #{target}") @results[target][:config] = Hash.new pods = @client.get_pods services = @client.get_services docker_images = Array.new #Specific requirement here in that it's useful to know what Docker images are in use on the cluster. pods.each do |pod| docker_images << pod.status[:containerStatuses][0][:image] end @log.debug("logged #{docker_images.length} docker images") @results[target][:config][:docker_images] = docker_images.uniq @results[target][:config][:pod_info] = Array.new #Lets record some information about each pod pods.each do |pod| currpod = Hash.new currpod[:name] = pod.metadata[:name] currpod[:namespace] = pod.metadata[:namespace] currpod[:service_account] = pod.spec[:serviceAccount] currpod[:host_ip] = pod[:status][:hostIP] currpod[:pod_ip] = pod[:status][:podIP] @results[target][:config][:pod_info] << currpod end @results[target][:config][:service_info] = Array.new services.each do |service| currserv = Hash.new currserv[:name] = service.metadata[:name] currserv[:cluster_ip] = service.spec[:clusterIP] if service.spec[:externalIP] currserv[:external_ip] = service.spec[:externalIP] else currserv[:external_ip] = "None" end if service.spec[:ports] currserv[:ports] = Array.new service.spec[:ports].each do |port| currserv[:ports] << "#{port[:port]}/#{port[:protocol]}:#{port[:targetPort]}/#{port[:protocol]}" end else currserv[:ports] = "None" end @results[target][:config][:service_info] << currserv end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kube_auto_analyzer-0.0.17 | lib/kube_auto_analyzer/api_checks/config_dumper.rb |
kube_auto_analyzer-0.0.16 | lib/kube_auto_analyzer/api_checks/config_dumper.rb |