pfab 0.52.0 → 0.53.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: e19f6543864483d014f040e4d0ba5c2e8322bb20ca5604f351c13a36f53b20cd
4
- data.tar.gz: 1d1afb9c39e0e6d69f5849bd171e2a659174ec747c601239c6e9cc051da92d6f
3
+ metadata.gz: 06aa820e3141930ca45a670075b6824a23010f5f3568aa3c81edd1825ea452c2
4
+ data.tar.gz: 9d43a1c6d16ac3e44f057817fa50f0143d7e3ce6d9b9ca0446735ae060144dfe
5
5
  SHA512:
6
- metadata.gz: c402604e6fd169342b2aff975ecb79b15b59cf67399c91a57c15597df3b7629d0a0eb84c5df14e784c09ca4612fafdad60e620bae52a76f1da269030c05d9fa4
7
- data.tar.gz: 569c405d1a4be90a456ef7dbb8f5e3cadf842b475644dbb79e85fc6d2765dc557e75b147dba2c58ae88c67ef37d0cab5f45bf9c000983ccb69535597c1a42d40
6
+ metadata.gz: 9e42f6a07719549799f99885888d33218dd69b0211e07ea7d927bf22b4d6d39984a4d246aa7f1c99afa8ccdd273eb2d96292363cb167b0a7c1c09e7ecff73464
7
+ data.tar.gz: 655b9ecb7007a4c19e27591a6edbe2acefcbce8a374ade1b1fb2e97985089503ae875d156cf269d969984f02e1dc148ca1e86a7702c444aab8e5b33fd65bc288
data/Gemfile.lock CHANGED
@@ -18,11 +18,12 @@ GIT
18
18
  GEM
19
19
  remote: https://rubygems.org/
20
20
  specs:
21
- activesupport (5.2.4.3)
21
+ activesupport (6.1.7.5)
22
22
  concurrent-ruby (~> 1.0, >= 1.0.2)
23
- i18n (>= 0.7, < 2)
24
- minitest (~> 5.1)
25
- tzinfo (~> 1.1)
23
+ i18n (>= 1.6, < 2)
24
+ minitest (>= 5.1)
25
+ tzinfo (~> 2.0)
26
+ zeitwerk (~> 2.3)
26
27
  addressable (2.8.0)
27
28
  public_suffix (>= 2.0.2, < 5.0)
28
29
  builder (3.2.4)
@@ -30,7 +31,7 @@ GEM
30
31
  coderay (1.1.3)
31
32
  commander (4.4.6)
32
33
  highline (~> 1.7.2)
33
- concurrent-ruby (1.1.9)
34
+ concurrent-ruby (1.2.3)
34
35
  descendants_tracker (0.0.4)
35
36
  thread_safe (~> 0.3, >= 0.3.1)
36
37
  docile (1.3.1)
@@ -64,27 +65,27 @@ GEM
64
65
  oauth2 (~> 1.0)
65
66
  hashie (3.6.0)
66
67
  highline (1.7.10)
67
- i18n (1.8.11)
68
+ i18n (1.14.5)
68
69
  concurrent-ruby (~> 1.0)
69
70
  json (1.8.6)
70
71
  jwt (2.3.0)
71
72
  kamelcase (0.0.2)
72
73
  semver2 (~> 3)
73
74
  method_source (1.0.0)
74
- mini_portile2 (2.8.0)
75
- minitest (5.15.0)
75
+ mini_portile2 (2.8.6)
76
+ minitest (5.22.3)
76
77
  multi_json (1.15.0)
77
78
  multi_xml (0.6.0)
78
79
  multipart-post (2.1.1)
79
- nokogiri (1.13.6)
80
- mini_portile2 (~> 2.8.0)
80
+ nokogiri (1.16.5)
81
+ mini_portile2 (~> 2.8.2)
81
82
  racc (~> 1.4)
82
- oauth2 (1.4.7)
83
- faraday (>= 0.8, < 2.0)
83
+ oauth2 (1.4.11)
84
+ faraday (>= 0.17.3, < 3.0)
84
85
  jwt (>= 1.0, < 3.0)
85
86
  multi_json (~> 1.3)
86
87
  multi_xml (~> 0.5)
87
- rack (>= 1.2, < 3)
88
+ rack (>= 1.2, < 4)
88
89
  power_assert (1.1.3)
89
90
  pry (0.14.2)
90
91
  coderay (~> 1.1)
@@ -94,8 +95,8 @@ GEM
94
95
  pry (>= 0.13, < 0.15)
95
96
  psych (4.0.2)
96
97
  public_suffix (4.0.6)
97
- racc (1.6.0)
98
- rack (2.2.3)
98
+ racc (1.7.3)
99
+ rack (3.0.11)
99
100
  rake (13.0.6)
100
101
  rchardet (1.8.0)
101
102
  rdoc (3.12.2)
@@ -111,8 +112,9 @@ GEM
111
112
  test-unit (3.2.9)
112
113
  power_assert
113
114
  thread_safe (0.3.6)
114
- tzinfo (1.2.9)
115
- thread_safe (~> 0.1)
115
+ tzinfo (2.0.6)
116
+ concurrent-ruby (~> 1.0)
117
+ zeitwerk (2.6.14)
116
118
 
117
119
  PLATFORMS
118
120
  ruby
data/lib/pfab/cli.rb CHANGED
@@ -4,6 +4,7 @@ require "yaml"
4
4
  require "json"
5
5
  require 'active_support/core_ext/hash/indifferent_access'
6
6
  require 'styled_yaml'
7
+ require 'digest'
7
8
 
8
9
  module Pfab
9
10
  class CLI
@@ -16,6 +17,7 @@ module Pfab
16
17
 
17
18
  if File.exist? "application.yaml"
18
19
  @application_yaml = YAML.load(File.read("application.yaml")).with_indifferent_access
20
+ @application_yaml_hash = Digest::SHA256.hexdigest(@application_yaml.to_json)
19
21
  else
20
22
  raise "I need to be run in a directory with a application.yaml"
21
23
  end
@@ -291,6 +293,7 @@ module Pfab
291
293
  def yy
292
294
  Pfab::Yamls.new(apps: all_runnables,
293
295
  application_yaml: @application_yaml,
296
+ application_yaml_hash: @application_yaml_hash,
294
297
  env: $env,
295
298
  sha: get_current_sha,
296
299
  image_name: image_name,
@@ -1,3 +1,5 @@
1
+ require 'securerandom'
2
+
1
3
  module Pfab
2
4
  module Templates
3
5
  class Base
@@ -63,6 +65,10 @@ module Pfab
63
65
  "#{@data['application']}.#{application_type}.#{@data['deployed_name']}"
64
66
  end
65
67
 
68
+ def deploy_unique_id
69
+ @data['sha'] + "-" + @data['application_yaml_hash'][0,8]
70
+ end
71
+
66
72
  def env_from
67
73
  env_from = []
68
74
  env_from << @data.dig("application_yaml", :env_from)
@@ -14,7 +14,9 @@ module Pfab
14
14
  puts "skipping ingress because ingress_disabled = #{@data['generateIngressEnabled']}"
15
15
  end
16
16
  f << StyledYAML.dump(deployment.deep_stringify_keys)
17
- f << StyledYAML.dump(pod_disruption_budget.deep_stringify_keys)
17
+ if get("replicas") || 1 > 1
18
+ f << StyledYAML.dump(pod_disruption_budget.deep_stringify_keys)
19
+ end
18
20
  end
19
21
  end
20
22
 
@@ -187,10 +189,7 @@ module Pfab
187
189
  def anti_affinity
188
190
  p = host_anti_affinity
189
191
  z = zone_anti_affinity
190
- printf("host anti affinity: %s\n", p)
191
- printf("zone anti affinity: %s\n", z)
192
192
  m = merge_anti_affinity(p, z)
193
- printf("merged anti affinity: %s\n", m)
194
193
  return m
195
194
  end
196
195
 
@@ -239,9 +238,22 @@ module Pfab
239
238
  affinitySelector = {
240
239
  topologyKey: topology_key,
241
240
  labelSelector: {
242
- matchLabels: {
243
- "deployed-name" => @data['deployed_name'],
244
- },
241
+ matchExpressions: [
242
+ {
243
+ key: "deployed-name",
244
+ operator: "In",
245
+ values: [
246
+ @data['deployed_name']
247
+ ]
248
+ },
249
+ {
250
+ key: "deployment-unique-id",
251
+ operator: "In",
252
+ values: [
253
+ StyledYAML.double_quoted(deploy_unique_id)
254
+ ]
255
+ }
256
+ ]
245
257
  },
246
258
  }
247
259
 
@@ -316,6 +328,7 @@ module Pfab
316
328
  "deployed-name" => @data['deployed_name'],
317
329
  "application-type" => application_type,
318
330
  "deploy-id" => deploy_id,
331
+ "deploy-unique-id" => StyledYAML.double_quoted(deploy_unique_id),
319
332
  "tags.datadoghq.com/env": @data['env'],
320
333
  "tags.datadoghq.com/service": @data['deployed_name'],
321
334
  "tags.datadoghq.com/version": StyledYAML.double_quoted(@data['sha'])
@@ -343,6 +356,7 @@ module Pfab
343
356
  application: @data['application'],
344
357
  "deployed-name" => @data['deployed_name'],
345
358
  "application-type" => "web",
359
+ "deploy-unique-id" => StyledYAML.double_quoted(deploy_unique_id),
346
360
  "tags.datadoghq.com/env": @data['env'],
347
361
  "tags.datadoghq.com/service": @data['deployed_name'],
348
362
  "tags.datadoghq.com/version": StyledYAML.double_quoted(@data['sha'])
data/lib/pfab/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Pfab
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 52
4
+ MINOR = 53
5
5
  PATCH = 0
6
6
  BUILD = nil
7
7
 
data/lib/pfab/yamls.rb CHANGED
@@ -2,7 +2,7 @@ require 'pry'
2
2
  module Pfab
3
3
  class Yamls
4
4
 
5
- def initialize(apps:, application_yaml:, image_name:, env:, sha:, config:)
5
+ def initialize(apps:, application_yaml:, image_name:, env:, sha:, config:, application_yaml_hash:)
6
6
  @apps = apps
7
7
  namespace = application_yaml.dig(env.to_s, "namespace") || application_yaml["namespace"]
8
8
  raise "No namespace founds" unless namespace
@@ -15,6 +15,7 @@ module Pfab
15
15
  'application' => application_yaml["name"],
16
16
  'application_yaml' => application_yaml,
17
17
  'namespace' => namespace,
18
+ 'application_yaml_hash' => application_yaml_hash
18
19
  }
19
20
  end
20
21
 
data/pfab.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: pfab 0.52.0 ruby lib
5
+ # stub: pfab 0.53.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pfab".freeze
9
- s.version = "0.52.0"
9
+ s.version = "0.53.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Jeff Dwyer".freeze]
14
- s.date = "2024-05-13"
14
+ s.date = "2024-05-14"
15
15
  s.description = "k8s helper".freeze
16
16
  s.email = "jdwyer@prefab.cloud".freeze
17
17
  s.executables = ["pfab".freeze]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.52.0
4
+ version: 0.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dwyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2024-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander