rhelm 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7387ddbbde2fe7a0e905f9c5c2f699188774afcfa8d32ff7b70798077721e9cb
4
- data.tar.gz: 9c6ee0ec1d6c9f19bea8a7cad4dcf58e6d08828f0abe2113b16a2867e77b3969
3
+ metadata.gz: 7b847e5174335329207c6ed5730347b11f49c3ef219eefa485d23654a6accb5a
4
+ data.tar.gz: 605dfc7020e39c8429deb094463283146e59efa6b540fb8a8dee698e89957bc1
5
5
  SHA512:
6
- metadata.gz: b4d0329dd823f0b929dfbae5f93cb85bc2b74a9d2ce21d9ef373495ce81eb4d1fbec2a28c8e0050bdda39dac3de57101a8fe6d0bdee6aba26ec94b573d600a35
7
- data.tar.gz: b435f1ff6bb3cba0ea76c00337e2a310cf71f3ea64cc672f595ed21bc150c4a6054cbb38cfcb2655165db68042aaf049f5662db8861a938cfe4e51ef5243b464
6
+ metadata.gz: 87a3d069fe7529b0105417544944a2acf1fbb0554ad0dab66f1d513468ed440697c701a5bddde38c9c071a3a79e206932a3744f1ed0e27dee9495df034da8549
7
+ data.tar.gz: 82d252c1f4bbf66cfc912f42e497c48be6e4a7195b1634fbc0c6e10cc8b643ec47951b9809e52df29549ccfd0a05f4809a584efdb1b8eec90f106af62eac0ed2
data/Gemfile CHANGED
@@ -1,8 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in helm.gemspec
4
3
  gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "minitest", "~> 5.0"
8
- gem "pry-byebug"
data/lib/rhelm/client.rb CHANGED
@@ -6,7 +6,7 @@ module Rhelm
6
6
  class Error < StandardError; end
7
7
 
8
8
  SUBCOMMANDS = %i(
9
- dependency env history install pull rollback
9
+ dependency env history install lint list pull rollback
10
10
  status test uninstall upgrade verify version
11
11
  )
12
12
  SUBCOMMANDS.each { |s| require_relative "subcommand/#{s}" }
@@ -67,7 +67,10 @@ module Rhelm
67
67
  end
68
68
 
69
69
  def report_failure(lines, status, and_raise: true)
70
- preamble = "#{full_cli_call} failed with exit status #{status}. Output follows:"
70
+ sanitized_full_cli_call = full_cli_call
71
+ kube_token_index = sanitized_full_cli_call.find_index("--kube-token")
72
+ sanitized_full_cli_call[kube_token_index + 1] = "[REDACTED]" if kube_token_index
73
+ preamble = "#{sanitized_full_cli_call} failed with exit status #{status}. Output follows:"
71
74
  if @client.logger
72
75
  client.logger.error(preamble)
73
76
  client.logger.error(lines)
@@ -75,7 +78,7 @@ module Rhelm
75
78
  STDERR.puts premable
76
79
  STDERR.puts lines
77
80
  end
78
- raise(Error, "#{full_cli_call} failed with exit_status #{status}") if and_raise
81
+ raise(Error, "#{sanitized_full_cli_call} failed with exit_status #{status}") if and_raise
79
82
  end
80
83
  end
81
84
  end
@@ -22,6 +22,7 @@ module Rhelm
22
22
  :name_template,
23
23
  :no_hooks,
24
24
  :output,
25
+ :pass_credentials,
25
26
  :password,
26
27
  :post_renderer,
27
28
  :release,
@@ -37,7 +38,8 @@ module Rhelm
37
38
  :values,
38
39
  :verify,
39
40
  :version,
40
- :wait
41
+ :wait,
42
+ :wait_for_jobs
41
43
 
42
44
  def initialize(release, chart, options = {})
43
45
  super(options)
@@ -60,6 +62,7 @@ module Rhelm
60
62
  @name_template = options[:name_template]
61
63
  @no_hooks = options[:no_hooks]
62
64
  @output = options[:output]
65
+ @pass_credentials = options[:pass_credentials]
63
66
  @password = options[:password]
64
67
  @post_renderer = options[:post_renderer]
65
68
  @render_subchart_notes = options[:render_subchart_notes]
@@ -75,6 +78,7 @@ module Rhelm
75
78
  @verify = options[:verify]
76
79
  @version = options[:version]
77
80
  @wait = options[:wait]
81
+ @wait_for_jobs = options[:wait_for_jobs]
78
82
  end
79
83
 
80
84
  def subcommand_name
@@ -99,6 +103,7 @@ module Rhelm
99
103
  args << ['--name-template', name_template] if name_template
100
104
  args << '--no-hooks' if no_hooks
101
105
  args << ['--output', output] if output
106
+ args << '--pass-credentials' if pass_credentials
102
107
  args << ['--password', password] if password
103
108
  args << ['--post-renderer', post_renderer] if post_renderer
104
109
  args << '--render-subchart-notes' if render_subchart_notes
@@ -146,8 +151,9 @@ module Rhelm
146
151
  end
147
152
 
148
153
  args << '--verify' if verify
149
- args << ['version', version] if version
154
+ args << ['--version', version] if version
150
155
  args << '--wait' if wait
156
+ args << '--wait-for-jobs' if wait_for_jobs
151
157
 
152
158
  args << release
153
159
  args << chart
@@ -0,0 +1,78 @@
1
+ require_relative 'base'
2
+
3
+ module Rhelm
4
+ module Subcommand
5
+ ## Helm lint subcommand: `helm lint PATH [flags]`.
6
+ ## docs: https://helm.sh/docs/helm/helm_lint/
7
+ class Lint < Base
8
+ attr_reader :path,
9
+ :set,
10
+ :set_file,
11
+ :set_string,
12
+ :strict,
13
+ :values,
14
+ :with_subcharts
15
+
16
+ def initialize(path, options = {})
17
+ super(options)
18
+
19
+ @path = path
20
+ @set = options[:set]
21
+ @set_file = options[:set_file]
22
+ @set_string = options[:set_string]
23
+ @strict = options[:strict]
24
+ @values = options[:values]
25
+ @with_subcharts = options[:with_subcharts]
26
+ end
27
+
28
+ def subcommand_name
29
+ 'lint'
30
+ end
31
+
32
+ def cli_args
33
+ super.tap do |args|
34
+ if set && !set.empty?
35
+ case set
36
+ when Hash
37
+ args << set.map { |key, value| ['--set', "#{key}=#{value}" ] }.flatten
38
+ else
39
+ args << ['--set', set]
40
+ end
41
+ end
42
+
43
+ if set_file && !set_file.empty?
44
+ case set_file
45
+ when Hash
46
+ args << set_file.map { |key, value| ['--set-file', "#{key}=#{value}" ] }.flatten
47
+ else
48
+ args << ['--set-file', set_file]
49
+ end
50
+ end
51
+
52
+ if set_string && !set_string.empty?
53
+ case set_string
54
+ when Hash
55
+ args << set_string.map { |key, value| ['--set-string', "#{key}=#{value}" ] }.flatten
56
+ else
57
+ args << ['--set-string', set_string]
58
+ end
59
+ end
60
+
61
+ if values && !values.empty?
62
+ case values
63
+ when Array
64
+ args << values.map { |values_file| ['--values', values_file ] }.flatten
65
+ else
66
+ args << ['--values', values]
67
+ end
68
+ end
69
+
70
+ args << '--with-subcharts' if with_subcharts
71
+ args << '--strict' if strict
72
+
73
+ args << path
74
+ end.flatten
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,78 @@
1
+ require_relative 'base'
2
+
3
+ module Rhelm
4
+ module Subcommand
5
+ ## Helm list subcommand: `helm list [flags]`.
6
+ ## docs: https://helm.sh/docs/helm/helm_list/
7
+ class List < Base
8
+ attr_reader :all,
9
+ :all_namespaces,
10
+ :date,
11
+ :deployed,
12
+ :failed,
13
+ :filter,
14
+ :help,
15
+ :max,
16
+ :offset,
17
+ :output,
18
+ :pending,
19
+ :reverse,
20
+ :selector,
21
+ :short,
22
+ :superseded,
23
+ :time_format,
24
+ :uninstalled,
25
+ :uninstalling
26
+
27
+ def initialize(options = {})
28
+ super(options)
29
+
30
+ @all = options[:all]
31
+ @all_namespaces = options[:all_namespaces]
32
+ @date = options[:date]
33
+ @deployed = options[:deployed]
34
+ @failed = options[:failed]
35
+ @filter = options[:filter]
36
+ @help = options[:help]
37
+ @max = options[:max]
38
+ @offset = options[:offset]
39
+ @output = options[:output]
40
+ @pending = options[:pending]
41
+ @reverse = options[:reverse]
42
+ @selector = options[:selector]
43
+ @short = options[:short]
44
+ @superseded = options[:superseded]
45
+ @time_format = options[:time_format]
46
+ @uninstalled = options[:uninstalled]
47
+ @uninstalling = options[:uninstalling]
48
+ end
49
+
50
+ def subcommand_name
51
+ 'ls'
52
+ end
53
+
54
+ def cli_args
55
+ super.tap do |args|
56
+ args << '--all' if all
57
+ args << '--all-namespaces' if all_namespaces
58
+ args << '--date' if date
59
+ args << '--deployed' if deployed
60
+ args << '--failed' if failed
61
+ args << ['--filter', filter] if filter
62
+ args << '--help' if help
63
+ args << ['--max', max] if max
64
+ args << ['--offset', offset] if offset
65
+ args << ['--output', output] if output
66
+ args << '--pending' if pending
67
+ args << '--reverse' if reverse
68
+ args << ['--selector', selector] if selector
69
+ args << '--short' if short
70
+ args << '--superseded' if superseded
71
+ args << ['--time-format', time_format] if time_format
72
+ args << '--uninstalled' if uninstalled
73
+ args << '--uninstalling' if uninstalling
74
+ end.flatten
75
+ end
76
+ end
77
+ end
78
+ end
@@ -13,6 +13,7 @@ module Rhelm
13
13
  :insecure_skip_tls_verify,
14
14
  :key_file,
15
15
  :keyring,
16
+ :pass_credentials,
16
17
  :password,
17
18
  :prov,
18
19
  :repo,
@@ -33,7 +34,9 @@ module Rhelm
33
34
  @insecure_skip_tls_verify = !!options[:insecure_skip_tls_verify]
34
35
  @key_file = options[:key_file]
35
36
  @keyring = options[:keyring]
37
+ @pass_credentials = options[:pass_credentials]
36
38
  @password = options[:password]
39
+ @prov = options[:prov]
37
40
  @repo = options[:repo]
38
41
  @untar = !!options[:untar]
39
42
  @untardir = options[:untardir]
@@ -55,7 +58,9 @@ module Rhelm
55
58
  args << '--insecure-skip-tls-verify' if insecure_skip_tls_verify
56
59
  args << ['--key-file', key_file] if key_file
57
60
  args << ['--keyring', keyring] if keyring
61
+ args << '--pass-credentials' if pass_credentials
58
62
  args << ['--password', password] if password
63
+ args << '--prov' if prov
59
64
  args << ['--repo', repo] if repo
60
65
  args << '--untar' if untar
61
66
  args << ['--untardir', untardir] if untardir
@@ -1,26 +1,44 @@
1
- require_relative "base"
1
+ require_relative 'base'
2
2
 
3
3
  module Rhelm
4
4
  module Subcommand
5
5
  ## Helm uninstall subcommand: `helm uninstall RELEASE_NAME [...] [flags]`.
6
6
  ## docs: https://helm.sh/docs/helm/helm_uninstall/
7
7
  class Uninstall < Base
8
- attr_reader :release_name
8
+ attr_reader :release_name,
9
+ :description,
10
+ :dry_run,
11
+ :help,
12
+ :keep_history,
13
+ :no_hooks,
14
+ :timeout
9
15
 
10
16
  def initialize(release_name, options = {})
11
17
  super(options)
12
18
 
13
19
  @release_name = release_name
20
+ @description = options[:description]
21
+ @dry_run = options[:dry_run]
22
+ @help = options[:help]
23
+ @keep_history = options[:keep_history]
24
+ @no_hooks = options[:no_hooks]
25
+ @timeout = options[:timeout]
14
26
  end
15
27
 
16
28
  def subcommand_name
17
- "uninstall"
29
+ 'uninstall'
18
30
  end
19
31
 
20
32
  def cli_args
21
33
  super.tap do |args|
34
+ args << ['--description', description] if description
35
+ args << '--dry-run' if dry_run
36
+ args << '--help' if help
37
+ args << '--keep-history' if keep_history
38
+ args << '--no-hooks' if no_hooks
39
+ args << ['--timeout', timeout] if timeout
22
40
  args << release_name
23
- end
41
+ end.flatten
24
42
  end
25
43
  end
26
44
  end
@@ -12,7 +12,6 @@ module Rhelm
12
12
  :cert_file,
13
13
  :cleanup_on_fail,
14
14
  :create_namespace,
15
- :dependency_update,
16
15
  :description,
17
16
  :devel,
18
17
  :disable_openapi_validation,
@@ -26,6 +25,7 @@ module Rhelm
26
25
  :keyring,
27
26
  :no_hooks,
28
27
  :output,
28
+ :pass_credentials,
29
29
  :password,
30
30
  :post_renderer,
31
31
  :render_subchart_notes,
@@ -41,8 +41,8 @@ module Rhelm
41
41
  :values,
42
42
  :verify,
43
43
  :version,
44
- :wait
45
-
44
+ :wait,
45
+ :wait_for_jobs
46
46
 
47
47
  def initialize(release, chart, options = {})
48
48
  super(options)
@@ -53,7 +53,7 @@ module Rhelm
53
53
  @ca_file = options[:ca_file]
54
54
  @cert_file = options[:cert_file]
55
55
  @cleanup_on_fail = !!options[:cleanup_on_fail]
56
- @dependency_update = !!options[:dependency_update]
56
+ @create_namespace = !!options[:create_namespace]
57
57
  @description = options[:description]
58
58
  @devel = !!options[:devel]
59
59
  @disable_openapi_validation = !!options[:disable_openapi_validation]
@@ -67,6 +67,7 @@ module Rhelm
67
67
  @keyring = options[:keyring]
68
68
  @no_hooks = !!options[:no_hooks]
69
69
  @output = options[:output]
70
+ @pass_credentials = options[:pass_credentials]
70
71
  @password = options[:password]
71
72
  @post_renderer = options[:post_renderer]
72
73
  @render_subchart_notes = !!options[:render_subchart_notes]
@@ -83,6 +84,7 @@ module Rhelm
83
84
  @verify = !!options[:verify]
84
85
  @version = options[:version]
85
86
  @wait = !!options[:wait]
87
+ @wait_for_jobs = !!options[:wait_for_jobs]
86
88
  end
87
89
 
88
90
  def subcommand_name
@@ -95,7 +97,7 @@ module Rhelm
95
97
  args << ['--ca-file', ca_file] if ca_file
96
98
  args << ['--cert-file', cert_file] if cert_file
97
99
  args << '--cleanup-on-fail' if cleanup_on_fail
98
- args << '--dependency-update' if dependency_update
100
+ args << '--create-namespace' if create_namespace
99
101
  args << ['--description', description] if description
100
102
  args << '--devel' if devel
101
103
  args << '--disable-openapi-validation' if disable_openapi_validation
@@ -109,6 +111,7 @@ module Rhelm
109
111
  args << ['--keyring', keyring] if keyring
110
112
  args << '--no-hooks' if no_hooks
111
113
  args << ['--output', output] if output
114
+ args << '--pass-credentials' if pass_credentials
112
115
  args << ['--password', password] if password
113
116
  args << ['--post-renderer', post_renderer] if post_renderer
114
117
  args << '--render-subchart-notes' if render_subchart_notes
@@ -157,8 +160,9 @@ module Rhelm
157
160
  end
158
161
 
159
162
  args << '--verify' if verify
160
- args << ['version', version] if version
163
+ args << ['--version', version] if version
161
164
  args << '--wait' if wait
165
+ args << '--wait-for-jobs' if wait_for_jobs
162
166
 
163
167
  args << release
164
168
  args << chart
@@ -1,5 +1,4 @@
1
1
  require 'open3'
2
- require 'pry-byebug'
3
2
 
4
3
  module Rhelm
5
4
  class Client
data/lib/rhelm/version.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module Rhelm
3
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
4
3
  end
data/rhelm.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
 
10
10
  spec.summary = "A wrapper around helm3, including error detection and output parsing callback support"
11
11
  spec.description = "Invoke Helm 3.x commands from Ruby with easy result handling"
12
- spec.homepage = "https://github.com/avvo/ruby-helm"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.5")
12
+ spec.homepage = "https://github.com/internetbrands/rhelm"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7")
14
14
 
15
15
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
16
 
@@ -26,4 +26,10 @@ Gem::Specification.new do |spec|
26
26
  spec.bindir = "exe"
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency 'pry'
31
+ spec.add_development_dependency 'pry-byebug'
32
+ spec.add_development_dependency 'bundler'
33
+ spec.add_development_dependency 'rake', '>= 12'
34
+ spec.add_development_dependency 'minitest', '~> 5.0'
29
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhelm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Newton
@@ -9,8 +9,78 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-05-25 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2021-07-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pry
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: pry-byebug
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '12'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '12'
70
+ - !ruby/object:Gem::Dependency
71
+ name: minitest
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '5.0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '5.0'
14
84
  description: Invoke Helm 3.x commands from Ruby with easy result handling
15
85
  email:
16
86
  - jnewton@avvo.com
@@ -34,6 +104,8 @@ files:
34
104
  - lib/rhelm/subcommand/env.rb
35
105
  - lib/rhelm/subcommand/history.rb
36
106
  - lib/rhelm/subcommand/install.rb
107
+ - lib/rhelm/subcommand/lint.rb
108
+ - lib/rhelm/subcommand/list.rb
37
109
  - lib/rhelm/subcommand/pull.rb
38
110
  - lib/rhelm/subcommand/rollback.rb
39
111
  - lib/rhelm/subcommand/status.rb
@@ -45,13 +117,13 @@ files:
45
117
  - lib/rhelm/subcommand_proxy.rb
46
118
  - lib/rhelm/version.rb
47
119
  - rhelm.gemspec
48
- homepage: https://github.com/avvo/ruby-helm
120
+ homepage: https://github.com/internetbrands/rhelm
49
121
  licenses:
50
122
  - MIT
51
123
  metadata:
52
124
  allowed_push_host: https://rubygems.org
53
- homepage_uri: https://github.com/avvo/ruby-helm
54
- source_code_uri: https://github.com/avvo/ruby-helm
125
+ homepage_uri: https://github.com/internetbrands/rhelm
126
+ source_code_uri: https://github.com/internetbrands/rhelm
55
127
  post_install_message:
56
128
  rdoc_options: []
57
129
  require_paths:
@@ -60,14 +132,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
132
  requirements:
61
133
  - - ">="
62
134
  - !ruby/object:Gem::Version
63
- version: '2.5'
135
+ version: '2.7'
64
136
  required_rubygems_version: !ruby/object:Gem::Requirement
65
137
  requirements:
66
138
  - - ">="
67
139
  - !ruby/object:Gem::Version
68
140
  version: '0'
69
141
  requirements: []
70
- rubygems_version: 3.0.8
142
+ rubygems_version: 3.2.13
71
143
  signing_key:
72
144
  specification_version: 4
73
145
  summary: A wrapper around helm3, including error detection and output parsing callback