Add custom labels
This commit is contained in:
@@ -11,6 +11,14 @@ class Mrsk::Configuration::Role
|
||||
@hosts ||= extract_hosts_from_config
|
||||
end
|
||||
|
||||
def labels
|
||||
if name.web?
|
||||
default_labels.merge(traefik_labels).merge(custom_labels)
|
||||
else
|
||||
default_labels.merge(custom_labels)
|
||||
end
|
||||
end
|
||||
|
||||
def label_args
|
||||
argumentize "--label", labels
|
||||
end
|
||||
@@ -31,14 +39,6 @@ class Mrsk::Configuration::Role
|
||||
end
|
||||
end
|
||||
|
||||
def labels
|
||||
if name.web?
|
||||
default_labels.merge(traefik_labels)
|
||||
else
|
||||
default_labels
|
||||
end
|
||||
end
|
||||
|
||||
def default_labels
|
||||
{ "service" => config.service, "role" => name }
|
||||
end
|
||||
@@ -53,6 +53,13 @@ class Mrsk::Configuration::Role
|
||||
}
|
||||
end
|
||||
|
||||
def custom_labels
|
||||
Hash.new.tap do |labels|
|
||||
labels.merge!(config.labels) if config.labels.present?
|
||||
labels.merge!(specializations["labels"]) if specializations["labels"].present?
|
||||
end
|
||||
end
|
||||
|
||||
def specializations
|
||||
if config.servers.is_a?(Array) || config.servers[name].is_a?(Array)
|
||||
{ }
|
||||
|
||||
Reference in New Issue
Block a user