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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
717 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
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