diff --git a/lib/krane/cluster_resource_discovery.rb b/lib/krane/cluster_resource_discovery.rb index fd98699f8..7b8b99b17 100644 --- a/lib/krane/cluster_resource_discovery.rb +++ b/lib/krane/cluster_resource_discovery.rb @@ -39,6 +39,13 @@ def jobs end end + def ingresses + @ingresses ||= fetch_ingresses.map do |ingress| + Ingress.new(namespace: namespace, context: context, logger: logger, + definition: ingress, statsd_tags: @namespace_tags) + end + end + def prunable_resources(namespaced:) black_list = %w(Namespace Node ControllerRevision Event) fetch_resources(namespaced: namespaced).map do |resource| @@ -149,6 +156,16 @@ def fetch_jobs end end + def fetch_ingresses + raw_json, err, st = kubectl.run("get", "Ingress", output: "json", attempts: 5, + use_namespace: false) + if st.success? + MultiJson.load(raw_json)["items"] + else + raise FatalKubeAPIError, "Error retrieving Ingress: #{err}" + end + end + def kubectl @kubectl ||= Kubectl.new(task_config: @task_config, log_failure_by_default: true) end diff --git a/lib/krane/deploy_task.rb b/lib/krane/deploy_task.rb index 0c57799a2..36b928f86 100644 --- a/lib/krane/deploy_task.rb +++ b/lib/krane/deploy_task.rb @@ -72,6 +72,7 @@ def predeploy_sequence after_crs = %w( Deployment Service + Ingress Pod Job ).map { |r| [r, default_group] } diff --git a/lib/krane/kubernetes_resource/ingress.rb b/lib/krane/kubernetes_resource/ingress.rb index e34f4231c..b94ef4df4 100644 --- a/lib/krane/kubernetes_resource/ingress.rb +++ b/lib/krane/kubernetes_resource/ingress.rb @@ -14,5 +14,13 @@ def deploy_succeeded? def deploy_failed? false end + + def predeployed? + krane_annotation_value("predeployed") == "true" + end + + def kind + @definition["kind"] + end end end diff --git a/lib/krane/version.rb b/lib/krane/version.rb index abb3bf6d1..3528c6437 100644 --- a/lib/krane/version.rb +++ b/lib/krane/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module Krane - VERSION = "3.4.2-powerhrg-4" + VERSION = "3.4.2-powerhrg-5" end