kubes_aws 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dabb9b7a32947b504463ae436580a4b7fa9805407d891e75849fe5489b5109b7
4
- data.tar.gz: 9ca7e70b971166cd13b8f2cbc314e2603ce5d29ae2516b051c69f615a10c1c3f
3
+ metadata.gz: 51843bf4cdbc25ea7fa4b3242db97e60cb064f25b6f338025978f415a89f0100
4
+ data.tar.gz: 118be0962ba9aff6428c8438780fe21991be278eeab0a9f5b6646fe94de74d5e
5
5
  SHA512:
6
- metadata.gz: 5413f7decb18560c46e5d16dbb58d084d658c33322d21845d2f9548de6d1e0bb42ea4b1cf65ab5203d7eb1cfa45d88c25b9c9cafcccffc04766e5364f2a9916a
7
- data.tar.gz: 2a42b344b9122a24b5a6c892b0ace49d83ca9de21c94ed5015cd482a261e7feb97eb19ade94cefa9cdfc21c1e3342c5bff1c7daa7520dd22bb134cee38a0abfe
6
+ metadata.gz: 9633e441c03d375c306a4081d4c7c71ccd0cf14c976cb1986599749d15161de0647fc2cda9e4d58916f13cc2560d9777e61f34e6b3055bbb978b54655de8aeea
7
+ data.tar.gz: c1b5bb8c8349e1fff848ce0dd266fc8a0db7cd60ab0625b21f81aa948f813b503d39ccc04fde23d544ff083ddb71880f0f385386e297d03fca652122f4eeaca3
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.3.2] - 2022-02-16
7
+ - [#5](https://github.com/boltops-tools/kubes_aws/pull/5) aws_secret_data helper
8
+ - improve iam role infer_cluster
9
+
6
10
  ## [0.3.1] - 2020-11-12
7
11
  - [#3](https://github.com/boltops-tools/kubes_aws/pull/3) rename secrets.base64 option
8
12
 
@@ -12,5 +12,9 @@ module KubesAws
12
12
  fetcher = SSM::Fetcher.new(options)
13
13
  fetcher.fetch(name)
14
14
  end
15
+
16
+ def aws_secret_data(name, options={})
17
+ generic_secret_data(:aws_secret, name, options)
18
+ end
15
19
  end
16
20
  end
@@ -11,13 +11,14 @@ module KubesAws
11
11
 
12
12
  # public method to keep: role_name
13
13
  attr_reader :role_name
14
- def initialize(app:, cluster:, namespace:nil, managed_policies: [], inline_policies: [], role_name: nil, ksa: nil)
14
+ def initialize(app:, cluster:nil, namespace:nil, managed_policies: [], inline_policies: [], role_name: nil, ksa: nil)
15
15
  @app, @cluster, @managed_policies, @inline_policies = app, cluster, managed_policies, inline_policies
16
16
 
17
17
  # conventional names
18
18
  @ksa = ksa || @app # convention: app
19
19
  @namespace = namespace || "#{@app}-#{Kubes.env}" # convention: app-env
20
20
  @role_name = role_name || "#{@app}-#{Kubes.env}" # convention: app-env
21
+ @cluster ||= infer_cluster
21
22
  end
22
23
 
23
24
  def call
@@ -27,6 +28,24 @@ module KubesAws
27
28
  add_inline_policies
28
29
  end
29
30
 
31
+ # Attempts to infer the EKS cluster name using kubectl
32
+ def infer_cluster
33
+ command = "kubectl config view --minify --output 'jsonpath={..contexts..context.cluster}'"
34
+ out = `#{command}`
35
+ success = $?.success?
36
+ name = out.split('/').last
37
+ if !success or name.blank?
38
+ logger.error <<~EOL.color(:red)
39
+ ERROR: unable to determine EKS cluster name. Please specify it in:
40
+
41
+ KubesAws::IamRole.new
42
+
43
+ EOL
44
+ exit 1
45
+ end
46
+ name
47
+ end
48
+
30
49
  def add_inline_policies
31
50
  @inline_policies.each do |policy|
32
51
  params = normalize_inline_policy(policy)
@@ -1,3 +1,3 @@
1
1
  module KubesAws
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubes_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-12 00:00:00.000000000 Z
11
+ date: 2022-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubygems_version: 3.1.4
202
+ rubygems_version: 3.2.32
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: Kubes AWS Helpers Library