class Bindings::ConfigTreeBinding
An implementation of Bindings::Binding
that reads files from a volume mounted Kubernetes Secret: kubernetes.io/docs/concepts/configuration/secret/#using-secrets
Public Class Methods
new(root)
click to toggle source
Creates a new instance.
@param [String] root the root of the volume mounted Kubernetes Secret
# File lib/binding.rb, line 123 def initialize(root) @root = root end
Public Instance Methods
get_as_bytes(key)
click to toggle source
Returns the contents of a binding entry in its raw bytes form.
@param [String] key the key of the entry to retrieve @return [Array<Integer>] the contents of a binding entry if it exists @return [nil]
# File lib/binding.rb, line 132 def get_as_bytes(key) return nil unless Bindings.valid_secret_key?(key) p = File.join(@root, key) return nil unless File.exist?(p) && File.file?(p) File.read(p, mode: "rb").bytes end
name()
click to toggle source
Returns the name of the binding
@return [String] the name of the binding
# File lib/binding.rb, line 145 def name File.basename(@root) end