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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcff42c07b2f1f5459a125e70a3b4916334d88e800bc3643bd0d790a31a5f088
4
- data.tar.gz: d7c7cf1a62b4f2cab950d6d1d99ec95b54731731bc1043bc3d6cdd17b6068443
3
+ metadata.gz: 7a3a9e76c9e4e3f469c82e2fd41b493bf45917d42c84aacad5895734e2783e8d
4
+ data.tar.gz: 07ab490a0332b29118f40a8057e7c9d6cccf56dfbc7de6e9e42f81ab8319e27c
5
5
  SHA512:
6
- metadata.gz: dae3a79a2848c146214cb6f8dfbf5c108de165d82690e1c67a1d7b7aaa77670e72c5e11a0a4bf5fbfd50168041e52d394b3e7a7ccb11378bdb6832c152696501
7
- data.tar.gz: 6686baffa1435ccc281efbcae47aeb94a9f7c158c92eaad63ab69c1ad69be57bf3f00735852607d878bce50a09256d3828d8f28528061640e29294ab51789cf9
6
+ metadata.gz: 2a7610dff798df54775d9e3d12b5a21552af5073c0ff5e5a59c9e8f3b7904e94e72691642f22c426d6cb4692f701f59e7f9732406f2c3a0eb6a1f8c949de65f1
7
+ data.tar.gz: f50abc6feebe908074ea7685999500e55659e4f7f0e981abee2a45c3cde778fb6a700a24a5aef142ccae61d173745a1837d1d3660796c54c7d28170e952a3b86
@@ -1,3 +1,6 @@
1
+ ## 0.3.1
2
+ * Add a unique hash of the configuration options to the kubeconfig path (#3, @pandwoter)
3
+
1
4
  ## 0.3.0
2
5
  * Accept `environment` instead of `definition` instances.
3
6
 
@@ -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
@@ -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
- @kubeconfig_path ||= File.join(
20
- kubeconfig_dir, "#{environment.app_name.downcase}-kubeconfig.yaml"
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
@@ -1,5 +1,5 @@
1
1
  module Kuby
2
2
  module EKS
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.3.1'.freeze
4
4
  end
5
5
  end
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.0
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-08-30 00:00:00.000000000 Z
11
+ date: 2020-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kube-dsl