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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/kubes_aws/helpers.rb +4 -0
- data/lib/kubes_aws/iam_role.rb +20 -1
- data/lib/kubes_aws/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51843bf4cdbc25ea7fa4b3242db97e60cb064f25b6f338025978f415a89f0100
|
4
|
+
data.tar.gz: 118be0962ba9aff6428c8438780fe21991be278eeab0a9f5b6646fe94de74d5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/kubes_aws/helpers.rb
CHANGED
data/lib/kubes_aws/iam_role.rb
CHANGED
@@ -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
|
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)
|
data/lib/kubes_aws/version.rb
CHANGED
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.
|
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:
|
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.
|
202
|
+
rubygems_version: 3.2.32
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: Kubes AWS Helpers Library
|