configgin 0.14.1 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57e22a993e395b62b0e774967bc18ae370ac25ad
4
- data.tar.gz: a7336574e707fdafd1f94700969a221cd9cd7fea
3
+ metadata.gz: c2a9f4d7934d6daf2749f6a8b3655fbe40bf5029
4
+ data.tar.gz: dd2fc1734da0c2c1cb9e5421c63cc97649bce6b0
5
5
  SHA512:
6
- metadata.gz: c8a346691d24d176cb5d3ab5baa34050467d60380acb30d1fd9116cf20a1c237bc0674174692ebb4edd8b12fc9427c938ac6ac732141f1639fbdd659ac977283
7
- data.tar.gz: 4621b053cc303f2c4aa82b9fe8b0007339fd2c78bd608b71d3b1843723e84bdb49ab9839f6386f4b534dbe1750573b5b32bb102ca544d37bc005dfee7af8f770
6
+ metadata.gz: '009e5dd0ca2b3a3e54317fba19f05c8ba64727dd73ce5f039d734236c55c6415258f6fd5107e80a9c7be060815dc779e8c333f1baf0794610c7de6206e7efb1d'
7
+ data.tar.gz: 7e6670ce466bba34c1d7284ad0788f7d7e0cbd8cf066afbcc98278f7f227cc45993a7a419c21cc776287ce2a53df850a4a4462676aca2f113409b7fa6130f4be
@@ -1,3 +1,3 @@
1
1
  module Configgin
2
- VERSION = '0.14.1'.freeze
2
+ VERSION = '0.15.0'.freeze
3
3
  end
@@ -46,8 +46,6 @@ module EnvironmentConfigTransmogrifier
46
46
  inject_value(base_config, key.split('.'), value, key)
47
47
  end
48
48
 
49
- base_config['bootstrap'] = (base_config['index'] || 0).zero?
50
-
51
49
  base_config
52
50
  end
53
51
 
data/lib/job.rb CHANGED
@@ -8,7 +8,12 @@ class Job
8
8
  @spec = spec
9
9
  @namespace = namespace
10
10
  @client = client
11
- @spec['links'] = KubeLinkSpecs.new(@spec, @namespace, @client, client_stateful_set)
11
+ links = @spec['links'] = KubeLinkSpecs.new(@spec, @namespace, @client, client_stateful_set)
12
+
13
+ # Figure out whether _this_ should bootstrap
14
+ pods = @client.get_pods(namespace: @namespace, label_selector: "skiff-role-name=#{self_role}")
15
+ pods_per_image = links.get_pods_per_image(pods)
16
+ @spec['bootstrap'] = pods_per_image[self_pod.metadata.uid] < 2
12
17
  end
13
18
 
14
19
  attr_reader :spec
@@ -31,6 +36,14 @@ class Job
31
36
  @exported_properties = exported_properties
32
37
  end
33
38
 
39
+ def self_pod
40
+ @self_pod ||= @client.get_pod(ENV['HOSTNAME'], @namespace)
41
+ end
42
+
43
+ def self_role
44
+ self_pod['metadata']['labels']['skiff-role-name']
45
+ end
46
+
34
47
  # Process the given template using a provided spec and output filename
35
48
  #
36
49
  # @param input_file_path [String] The input filepath for the template
@@ -20,7 +20,7 @@ class KubeLinkSpecs
20
20
  @spec['job']['name']
21
21
  end
22
22
 
23
- # pod_index returns a number for the given mod name. The number is expected to
23
+ # pod_index returns a number for the given pod name. The number is expected to
24
24
  # be unique across all pods for the role.
25
25
  def pod_index(name)
26
26
  index = name.rpartition('-').last
@@ -137,8 +137,7 @@ class KubeLinkSpecs
137
137
  provider = @spec['consumes'][key]
138
138
  unless provider
139
139
  $stderr.puts "No link provider found for #{key}"
140
- @links[key] = nil
141
- return @links[key]
140
+ return @links[key] = nil
142
141
  end
143
142
 
144
143
  if provider['role'] == this_name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configgin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SUSE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-09 00:00:00.000000000 Z
11
+ date: 2018-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler