kube_cluster 0.9.1 → 0.10.0

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: 612bfaf35673ef4d8eafca1a4c08760d2561b0f68d105fc845cfaaef9a08b649
4
- data.tar.gz: dd784e188cf30368c95827b988e00d2b2673fff6935986d1ccc9d8afc6bc2aff
3
+ metadata.gz: 32be3af77f3bccfbae533150de67954f7830f00c06f0be3c1b67b14a14dc5df0
4
+ data.tar.gz: c55c32cbe6d5d613e818e15af4c88edb29a4fc5509a6713b3eb1c8889de025a6
5
5
  SHA512:
6
- metadata.gz: 8efb5ae223fa5a51d729e96a0c0dc33fa030ee0cb200562d7abafc90e4acf5e306c5629ef6cc0b6dde0e14afe093a43261a017e47638b7a1410165b679fd3061
7
- data.tar.gz: 0ee4ec3a3dd13793fb4b5c9771e27f8d42de3401eed42c85f1682017d6d9b1c175871b51a00d4c9064742e1a5e4d82b6a70a3e4f9bdf1574d014d146f3cd0051
6
+ metadata.gz: 910bfcff299cc94a90793078aae2d758c1efac25d82d9bec8c1627a399b01d3cff913c531dfa0de65a24e493364abaf1df2539d9c07841e67fec6bb657ce848a
7
+ data.tar.gz: 4cac04a6d8915fabbd978dd74f9a69631510b2981653de2ab18c262dd5d0bc7e0bb7dc5ac352f3d9b8ea4945f31091c904db111654240a159976aaecd7408618
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kube_cluster (0.9.1)
4
+ kube_cluster (0.10.0)
5
5
  activesupport (~> 8.0)
6
6
  kube_kubectl (~> 2.0)
7
7
  kube_schema (~> 1.5)
@@ -13,6 +13,7 @@ module Kube
13
13
  port:,
14
14
  namespace: 'default',
15
15
  env: {},
16
+ command: nil,
16
17
  security_context: nil,
17
18
  pod_security_context: nil,
18
19
  volume_mounts: {},
@@ -50,6 +51,7 @@ module Kube
50
51
  ports: [{ name: 'http', containerPort: port, protocol: 'TCP' }],
51
52
  env: processed_env
52
53
  }
54
+ container[:command] = command if command
53
55
  container[:securityContext] = security_context if security_context
54
56
  container[:volumeMounts] = processed_volumes[:volume_mounts] unless processed_volumes[:volume_mounts].empty?
55
57
 
@@ -7,6 +7,8 @@ module Kube
7
7
  module Cluster
8
8
  module Standard
9
9
  class Secret < Kube::Cluster["Secret"]
10
+ KeyRef = Struct.new(:secret, :key_name)
11
+
10
12
  def initialize(name:, **data, &block)
11
13
  super() {
12
14
  metadata.name = name
@@ -14,6 +16,14 @@ module Kube
14
16
  instance_exec(&block) if block_given?
15
17
  }
16
18
  end
19
+
20
+ def secret_name
21
+ to_h.dig(:metadata, :name)
22
+ end
23
+
24
+ def key(key_name)
25
+ KeyRef.new(self, key_name)
26
+ end
17
27
  end
18
28
  end
19
29
  end
@@ -25,6 +25,26 @@ module Kube
25
25
 
26
26
  input.each do |mount_path, source|
27
27
  case source
28
+ when Secret::KeyRef
29
+ secret_name = source.secret.secret_name
30
+ key = source.key_name
31
+ # Unique, DNS-1123-safe volume name per key so multiple keys from
32
+ # the same secret don't collide on the volume name.
33
+ vol = "#{secret_name}-#{key.tr('._', '--')}"
34
+ volumes << {
35
+ name: vol,
36
+ secret: {
37
+ secretName: secret_name,
38
+ items: [{ key: key, path: key }]
39
+ }
40
+ }
41
+ mounts << {
42
+ name: vol,
43
+ mountPath: mount_path,
44
+ subPath: key,
45
+ readOnly: true
46
+ }
47
+
28
48
  when ESO::ExternalSecret::KeyRef
29
49
  name = source.secret.secret_name
30
50
  key = source.key_name
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kube
4
4
  module Cluster
5
- VERSION = "0.9.1"
5
+ VERSION = "0.10.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kube_cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan K