Sha256: 00411c74ad3b946b1901817793d2483b72a63d5d99b9efb56d71f8c7560bd5ad
Contents?: true
Size: 1.5 KB
Versions: 13
Compression:
Stored size: 1.5 KB
Contents
require 'picsolve_docker_builder/helpers/kubernetes/resource' module PicsolveDockerBuilder module Helpers module Kubernetes # A generic kuberntes resource class Service < Resource def config # workaround a bug on updating TODO: remove when fixed upstream @service.name = @image.name # configure the service @service.metadata = {} unless @service.metadata @service.metadata.name = @image.name @service.metadata.namespace = @image.composer.namespace @service.metadata.labels = template_labels @service.spec = {} unless @service.spec @service.spec.ports = @image.ports @service.spec.selector = { 'name' => @image.name } end def deploy @existing = false begin @service = client.get_service @image.name, @image.composer.namespace @existing = true rescue KubeException @service = Kubeclient::Service.new end # config service config if @existing log.debug \ "update service '#{@image.composer.namespace}/#{@image.name}' " \ 'on kubernetes' client.update_service @service else log.debug \ "create service '#{@image.composer.namespace}/#{@image.name}' " \ 'on kubernetes' client.create_service @service end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems