lib/krane/kubernetes_resource/daemon_set.rb in kubernetes-deploy-0.31.1 vs lib/krane/kubernetes_resource/daemon_set.rb in kubernetes-deploy-1.0.0.pre.1
- old
+ new
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require 'krane/kubernetes_resource/pod_set_base'
+require "krane/kubernetes_resource/pod_set_base"
module Krane
class DaemonSet < PodSetBase
TIMEOUT = 5.minutes
attr_reader :pods
@@ -76,11 +76,15 @@
.slice("updatedNumberScheduled", "desiredNumberScheduled", "numberReady")
end
def parent_of_pod?(pod_data)
return false unless pod_data.dig("metadata", "ownerReferences")
+
+ template_generation = @instance_data.dig("spec", "templateGeneration") ||
+ @instance_data.dig("metadata", "annotations", "deprecated.daemonset.template.generation")
+ return false unless template_generation.present?
+
pod_data["metadata"]["ownerReferences"].any? { |ref| ref["uid"] == @instance_data["metadata"]["uid"] } &&
- pod_data["metadata"]["labels"]["pod-template-generation"].to_i ==
- @instance_data["spec"]["templateGeneration"].to_i
+ pod_data["metadata"]["labels"]["pod-template-generation"].to_i == template_generation.to_i
end
end
end