Sha256: 231fb0fd23011ffa6e12fbba647110687dfb9c404656ac027b74088355fab4e7
Contents?: true
Size: 1.56 KB
Versions: 4
Compression:
Stored size: 1.56 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 delete_secret(name) kubernetes.client.delete_secret name, namespace 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
4 entries across 4 versions & 1 rubygems