Module: Kubes::Compiler::Layering
- Included in:
- Strategy::Base, Strategy::Erb
- Defined in:
- lib/kubes/compiler/layering.rb
Instance Method Summary collapse
Instance Method Details
#add_exts(*layers) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/kubes/compiler/layering.rb', line 50 def add_exts(*layers) layers.flatten.map do |layer| [ "#{layer}.rb", "#{layer}.yaml", "#{layer}.yml", ] end.flatten end |
#post_layers ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/kubes/compiler/layering.rb', line 24 def post_layers return [] if Kubes.kustomize? ext = File.extname(@path) kind_path = @path.sub(ext,'') layers = [ "base", Kubes.env.to_s ] if Kubes.app layers += [ Kubes.app, "#{Kubes.app}/base", "#{Kubes.app}/#{Kubes.env}", ] end layers = add_exts(layers) layers.map! do |layer| "#{kind_path}/#{layer}" end layers.select { |layer| File.exist?(layer) } end |
#pre_layers ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kubes/compiler/layering.rb', line 3 def pre_layers return [] if Kubes.kustomize? ext = File.extname(@path) kind = File.basename(@path).sub(ext,'') # IE: deployment kind = kind.pluralize if @block_form role = @path.split('/')[-2] # .kubes/resources/web/deployment.yaml layers = [ "base/all", "base/all/#{Kubes.env}", "base/#{kind}", "base/#{kind}/#{Kubes.env}", "#{role}/all", ] layers = add_exts(layers) layers.map! do |layer| "#{Kubes.root}/.kubes/resources/#{layer}" end layers.select { |layer| File.exist?(layer) } end |