debian-mirror-gitlab/lib/gitlab/kubernetes/config_map.rb

38 lines
686 B
Ruby
Raw Normal View History

2018-03-27 19:54:05 +05:30
module Gitlab
module Kubernetes
class ConfigMap
2018-11-18 11:00:15 +05:30
def initialize(name, files)
2018-03-27 19:54:05 +05:30
@name = name
2018-11-18 11:00:15 +05:30
@files = files
2018-03-27 19:54:05 +05:30
end
def generate
resource = ::Kubeclient::Resource.new
resource.metadata = metadata
2018-11-18 11:00:15 +05:30
resource.data = files
2018-03-27 19:54:05 +05:30
resource
end
2018-11-18 11:00:15 +05:30
def config_map_name
"values-content-configuration-#{name}"
end
2018-03-27 19:54:05 +05:30
private
2018-11-18 11:00:15 +05:30
attr_reader :name, :files
2018-03-27 19:54:05 +05:30
def metadata
{
name: config_map_name,
namespace: namespace,
labels: { name: config_map_name }
}
end
def namespace
Gitlab::Kubernetes::Helm::NAMESPACE
end
end
end
end