Method: ConfigMaps#create_new_configmap
- Defined in:
- lib/ruby-kubernetes-controller/configmaps.rb
#create_new_configmap(namespace, config) ⇒ Object
Create new ConfigMap
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby-kubernetes-controller/configmaps.rb', line 12 def create_new_configmap(namespace, config) extension = "/api/v1/namespaces/#{namespace}/configmaps" uri = prepareURI(@endpoint, extension) request = prepareGenericRequest(uri, @bearer_token, "POST") request.content_type = "application/json" if @yaml request.body = yaml_file_to_json(config) else request.body = config end = prepareGenericRequestOptions(@ssl, uri) begin response = Net::HTTP.start(uri.hostname, uri.port, ) do |http| http.request(request) end return response.body rescue Errno::ECONNREFUSED raise "Connection for host #{uri.hostname} refused" end end |