Sha256: 22142dd277e3b8b9ea28860e1325eb92f869d291401b510a6f7e70fbba175e53
Contents?: true
Size: 1.46 KB
Versions: 6
Compression:
Stored size: 1.46 KB
Contents
require 'picsolve_docker_builder/base' require 'securerandom' module PicsolveDockerBuilder module Composer module Requirements # Base class for requirements class Base include PicsolveDockerBuilder::Base attr_reader :name, :config def initialize(name, config, context) @name = name @config = config @context = context end def environment(_kubernetes) [] end def stage @context.kubernetes.stage end def kubernetes @context.kubernetes end def namespace @context.namespace end def container @context.container end def gen_password(length = 16) SecureRandom.urlsafe_base64(length) end def create_secret(name, obj) secret = Kubeclient::Secret.new secret.metadata = { name: name, namespace: namespace } secret.data = {} obj.each do |key, value| secret.data[key.to_sym] = Base64.encode64(value).delete("\n") end kubernetes.client.create_secret secret end def get_secret(name) obj = kubernetes.client.get_secret(name, namespace) hash = {} obj.data.to_hash.each do |key, value| hash[key.to_s] = Base64.decode64(value) end hash end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems