class KubernetesAnnotationsTagAppender
Attributes
annotations[R]
Public Class Methods
new(annotations)
click to toggle source
# File lib/kubernetes_annotations_tag_appender.rb, line 6 def initialize(annotations) @annotations = annotations end
Public Instance Methods
append(tag, data, container_name)
click to toggle source
# File lib/kubernetes_annotations_tag_appender.rb, line 10 def append(tag, data, container_name) matches = annotations.select do | annotation | json = data[annotation] || "[]" JSON.parse(json)&.include? container_name end # Don't re-add tags if they're already present: orig_tags = tag.split(".") # Unique with order preservation: uniqs = orig_tags + ["annotated"] + matches.reject { |x| orig_tags.include? x } return uniqs.join(".") end