Skip to content

Commit

Permalink
Merge pull request #6 from powerhome/fvr/add-ingress-predeploy-support
Browse files Browse the repository at this point in the history
Add ingress predeploy support
  • Loading branch information
c-gerke authored Nov 29, 2024
2 parents 03124c0 + 941a18e commit 39abcad
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
17 changes: 17 additions & 0 deletions lib/krane/cluster_resource_discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/krane/deploy_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def predeploy_sequence
after_crs = %w(
Deployment
Service
Ingress
Pod
Job
).map { |r| [r, default_group] }
Expand Down
8 changes: 8 additions & 0 deletions lib/krane/kubernetes_resource/ingress.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/krane/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
module Krane
VERSION = "3.4.2-powerhrg-4"
VERSION = "3.4.2-powerhrg-5"
end

0 comments on commit 39abcad

Please sign in to comment.