Class: RKSeal::Commands::Validate
- Inherits:
-
Object
- Object
- RKSeal::Commands::Validate
- Defined in:
- lib/rkseal/commands/validate.rb
Overview
Orchestrates the ‘rkseal validate <namespace> <secret-name>` flow (and its `–file <path>` variant).
Asks the controller whether a SealedSecret is well-formed and decryptable for its target, via ‘kubeseal –validate`. It does not decrypt or expose anything; it is a pre-flight check you can run before committing or applying. No editor, no workspace, no cluster Secret read, no file write.
Input is either the local ‘<name>.yaml` in the output directory, or an explicit file path (`file:`), which takes precedence and lets you validate any SealedSecret manifest regardless of name.
Instance Attribute Summary collapse
-
#file ⇒ String?
readonly
Explicit file path to validate, if given.
- #name ⇒ String? readonly
- #namespace ⇒ String? readonly
Instance Method Summary collapse
-
#call ⇒ String
Run the validation.
-
#initialize(namespace: nil, name: nil, file: nil, kubeseal: Kubeseal.new, output_dir: Dir.pwd) ⇒ Validate
constructor
A new instance of Validate.
Constructor Details
#initialize(namespace: nil, name: nil, file: nil, kubeseal: Kubeseal.new, output_dir: Dir.pwd) ⇒ Validate
Returns a new instance of Validate.
37 38 39 40 41 42 43 44 |
# File 'lib/rkseal/commands/validate.rb', line 37 def initialize(namespace: nil, name: nil, file: nil, kubeseal: Kubeseal.new, output_dir: Dir.pwd) @namespace = namespace @name = name @file = file @kubeseal = kubeseal @output_dir = output_dir end |
Instance Attribute Details
#file ⇒ String? (readonly)
Returns explicit file path to validate, if given.
27 28 29 |
# File 'lib/rkseal/commands/validate.rb', line 27 def file @file end |
#name ⇒ String? (readonly)
25 26 27 |
# File 'lib/rkseal/commands/validate.rb', line 25 def name @name end |
#namespace ⇒ String? (readonly)
23 24 25 |
# File 'lib/rkseal/commands/validate.rb', line 23 def namespace @namespace end |
Instance Method Details
#call ⇒ String
Run the validation.
54 55 56 57 58 59 |
# File 'lib/rkseal/commands/validate.rb', line 54 def call @kubeseal.ensure_available! path = target_path @kubeseal.validate(read_sealed(path)) path end |