Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Fix --flux flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dudo committed Nov 12, 2019
1 parent 7c3495b commit c086d96
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require 'octokit'
require 'fileutils'
require 'byebug'

require_relative 'templates/kustomization'
require_relative 'templates/flux'
Expand Down Expand Up @@ -210,12 +209,14 @@ def print_manifests # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
File.write "/tmp/#{t.path}", t.manifest.to_yaml
end

puts @templates.find(&:flux?)&.manifest&.to_yaml
@templates.map(&:directory).uniq.each do |dir|
next if dir.empty?

puts '---'
puts `kustomize build /tmp/#{dir.join('/')}`
end

puts "\n"
end
end
2 changes: 1 addition & 1 deletion templates/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def path
def method_missing(method_name, *args, &block)
super unless method_name.to_s.end_with?('?')

method_name.to_s.delete('?') == file_name
method_name.to_s.delete('?') == file_name.delete('.')
end

def respond_to_missing?(method_name, include_private = false)
Expand Down
8 changes: 7 additions & 1 deletion templates/flux.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

# https://docs.fluxcd.io/en/latest/references/fluxyaml-config-files.html

require_relative 'base'

module Templates
Expand All @@ -10,13 +12,17 @@ def manifest
{
'version' => 1,
'commandUpdated' => {
'generators' => options[:generators] || []
'generators' => generators
}
}
end

def directory
[]
end

def generators
options[:generators] || []
end
end
end
2 changes: 2 additions & 0 deletions templates/kustomization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def images
end
end

# https://github.com/kubernetes-sigs/kustomize/blob/master/examples/jsonpatch.md
def ingress_patch
{
'target' => {
Expand All @@ -59,6 +60,7 @@ def ingress_patch
}
end

# https://github.com/kubernetes-sigs/kustomize/blob/master/examples/image.md
def images_patch
img_tuple = options[:image].split(':')
{
Expand Down

0 comments on commit c086d96

Please sign in to comment.