kuby-eks 0.3.0 → 0.3.1
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 +3 -0
- data/lib/kuby/eks/config.rb +20 -0
- data/lib/kuby/eks/provider.rb +12 -6
- data/lib/kuby/eks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a3a9e76c9e4e3f469c82e2fd41b493bf45917d42c84aacad5895734e2783e8d
|
4
|
+
data.tar.gz: 07ab490a0332b29118f40a8057e7c9d6cccf56dfbc7de6e9e42f81ab8319e27c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a7610dff798df54775d9e3d12b5a21552af5073c0ff5e5a59c9e8f3b7904e94e72691642f22c426d6cb4692f701f59e7f9732406f2c3a0eb6a1f8c949de65f1
|
7
|
+
data.tar.gz: f50abc6feebe908074ea7685999500e55659e4f7f0e981abee2a45c3cde778fb6a700a24a5aef142ccae61d173745a1837d1d3660796c54c7d28170e952a3b86
|
data/CHANGELOG.md
CHANGED
data/lib/kuby/eks/config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'kube-dsl'
|
2
|
+
require 'digest'
|
2
3
|
|
3
4
|
module Kuby
|
4
5
|
module EKS
|
@@ -6,6 +7,25 @@ module Kuby
|
|
6
7
|
extend ::KubeDSL::ValueFields
|
7
8
|
|
8
9
|
value_fields :region, :credentials, :cluster_name
|
10
|
+
|
11
|
+
# Double .credentials call here to convert instance into
|
12
|
+
# a Credentials object, which contains an access key ID
|
13
|
+
# and a secret access key. All the various credentials
|
14
|
+
# objects respond to this method, including
|
15
|
+
# SharedCredentials, InstanceProfileCredentials, etc.
|
16
|
+
#
|
17
|
+
# See: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Credentials.html
|
18
|
+
#
|
19
|
+
def hash_value
|
20
|
+
parts = [
|
21
|
+
region,
|
22
|
+
cluster_name,
|
23
|
+
credentials.credentials.secret_access_key,
|
24
|
+
credentials.credentials.access_key_id,
|
25
|
+
]
|
26
|
+
|
27
|
+
Digest::SHA256.hexdigest(parts.join(':'))
|
28
|
+
end
|
9
29
|
end
|
10
30
|
end
|
11
31
|
end
|
data/lib/kuby/eks/provider.rb
CHANGED
@@ -3,6 +3,7 @@ require 'aws-sdk-eks'
|
|
3
3
|
require 'aws-iam-authenticator-rb'
|
4
4
|
require 'tmpdir'
|
5
5
|
require 'yaml'
|
6
|
+
require 'digest'
|
6
7
|
|
7
8
|
module Kuby
|
8
9
|
module EKS
|
@@ -16,8 +17,9 @@ module Kuby
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def kubeconfig_path
|
19
|
-
|
20
|
-
kubeconfig_dir,
|
20
|
+
File.join(
|
21
|
+
kubeconfig_dir,
|
22
|
+
"#{environment.app_name.downcase}-#{config.hash_value}-kubeconfig.yaml"
|
21
23
|
)
|
22
24
|
end
|
23
25
|
|
@@ -33,14 +35,18 @@ module Kuby
|
|
33
35
|
refresh_kubeconfig
|
34
36
|
end
|
35
37
|
|
38
|
+
def kubernetes_cli
|
39
|
+
@kubernetes_cli ||= ::KubernetesCLI.new(kubeconfig_path).tap do |cli|
|
40
|
+
cli.before_execute do
|
41
|
+
refresh_kubeconfig
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
36
46
|
private
|
37
47
|
|
38
48
|
def after_initialize
|
39
49
|
@config = Config.new
|
40
|
-
|
41
|
-
kubernetes_cli.before_execute do
|
42
|
-
refresh_kubeconfig
|
43
|
-
end
|
44
50
|
end
|
45
51
|
|
46
52
|
# Double .credentials call here to convert instance into
|
data/lib/kuby/eks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuby-eks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kube-dsl
|