pfab 0.56.0 → 0.57.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 +4 -4
- data/lib/pfab/templates/base.rb +8 -1
- data/lib/pfab/templates/daemon.rb +3 -5
- data/lib/pfab/templates/long_running_process.rb +68 -0
- data/lib/pfab/templates/web.rb +4 -35
- data/lib/pfab/version.rb +1 -1
- data/lib/pfab.rb +1 -0
- data/pfab.gemspec +4 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76bad8d13c4a3686060931bb8350acd807b155fbf9053e49ef88b78da658f9fc
|
4
|
+
data.tar.gz: 8673276f9288bb2f7f1ce47c747c766140ac3df4266f64940eb66937a892426f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ee62382acaec3c387c5eecbee1237c371b7709213ccf0d662a72d92802b6ae4f6aa15e01fafdc1deec28226884851682cef72974eed067db18b795930b47607
|
7
|
+
data.tar.gz: 4dabd5de2842cbd12e052af63994f6b77c1733aef0a287a45dc0c37b515c9a8e03eb23f6eee8fbcf20033a08aeab14d496a070cf20c30ba72c55c89248903db8
|
data/lib/pfab/templates/base.rb
CHANGED
@@ -95,7 +95,14 @@ module Pfab
|
|
95
95
|
|
96
96
|
# load env overrides
|
97
97
|
load_env_vars(env_vars, @data.dig("application_yaml", @data["env"], :environment))
|
98
|
-
|
98
|
+
|
99
|
+
#load more env overrides first at app
|
100
|
+
load_env_vars(env_vars, app_vars[:environment])
|
101
|
+
load_secrets(env_vars, app_vars[:env_secrets])
|
102
|
+
# then app/environment
|
103
|
+
load_env_vars(env_vars, app_vars.dig(@data["env"], :environment))
|
104
|
+
load_secrets(env_vars, app_vars.dig(@data["env"], :env_secrets))
|
105
|
+
|
99
106
|
|
100
107
|
env_vars.map do |k, v|
|
101
108
|
{ name: k }.merge(v)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Pfab
|
2
2
|
module Templates
|
3
|
-
class Daemon <
|
3
|
+
class Daemon < LongRunningProcess
|
4
4
|
def write_to(f)
|
5
5
|
f << StyledYAML.dump(deployment.deep_stringify_keys)
|
6
6
|
end
|
@@ -33,9 +33,7 @@ module Pfab
|
|
33
33
|
"deployed-name" => @data['deployed_name'],
|
34
34
|
},
|
35
35
|
},
|
36
|
-
strategy:
|
37
|
-
type: "Recreate"
|
38
|
-
},
|
36
|
+
strategy: rolling_update_strategy(),
|
39
37
|
revisionHistoryLimit: 5,
|
40
38
|
template: {
|
41
39
|
metadata: {
|
@@ -59,7 +57,7 @@ module Pfab
|
|
59
57
|
envFrom: env_from,
|
60
58
|
resources: resources,
|
61
59
|
ports: container_ports()
|
62
|
-
}
|
60
|
+
}.merge(probes()).compact
|
63
61
|
]
|
64
62
|
}.compact,
|
65
63
|
},
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
|
4
|
+
module Pfab
|
5
|
+
module Templates
|
6
|
+
class LongRunningProcess < Pfab::Templates::Base
|
7
|
+
def default_probe
|
8
|
+
{
|
9
|
+
httpGet: {
|
10
|
+
path: get("health_check_path") || "/",
|
11
|
+
port: get("port"),
|
12
|
+
},
|
13
|
+
initialDelaySeconds: 15,
|
14
|
+
timeoutSeconds: 3
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def livenessProbe
|
19
|
+
get("livenessProbe") || default_probe
|
20
|
+
end
|
21
|
+
|
22
|
+
def readinessProbe
|
23
|
+
get("readinessProbe") || default_probe
|
24
|
+
end
|
25
|
+
|
26
|
+
def startupProbe
|
27
|
+
get("startupProbe") || default_probe
|
28
|
+
end
|
29
|
+
|
30
|
+
def probes
|
31
|
+
|
32
|
+
if application_type == "web" || get("probesEnabled")
|
33
|
+
return {
|
34
|
+
livenessProbe: livenessProbe,
|
35
|
+
readinessProbe: readinessProbe,
|
36
|
+
startupProbe: startupProbe,
|
37
|
+
}
|
38
|
+
end
|
39
|
+
puts "probes are disabled, set `probesEnabled: true` to enable"
|
40
|
+
return {
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def rolling_update_strategy(max_surge=1,max_unavailable=0)
|
48
|
+
{
|
49
|
+
type: "RollingUpdate",
|
50
|
+
rollingUpdate: {
|
51
|
+
maxSurge: max_surge,
|
52
|
+
maxUnavailable: max_unavailable,
|
53
|
+
}
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
data/lib/pfab/templates/web.rb
CHANGED
@@ -3,7 +3,7 @@ require "rubygems/safe_yaml"
|
|
3
3
|
module Pfab
|
4
4
|
LABEL_DEPLOY_UNIQUE_ID = "deploy-unique-id"
|
5
5
|
module Templates
|
6
|
-
class Web <
|
6
|
+
class Web < LongRunningProcess
|
7
7
|
def write_to(f)
|
8
8
|
if ingres_enabled? && get("host").nil?
|
9
9
|
puts "No host to configure ingress for #{@data['deployed_name']}. Skipping deployment. add a host or generateIngressEnabled:false"
|
@@ -136,33 +136,11 @@ module Pfab
|
|
136
136
|
h
|
137
137
|
end
|
138
138
|
|
139
|
-
def default_probe
|
140
|
-
{
|
141
|
-
httpGet: {
|
142
|
-
path: get("health_check_path") || "/",
|
143
|
-
port: get("port"),
|
144
|
-
},
|
145
|
-
initialDelaySeconds: 15,
|
146
|
-
timeoutSeconds: 3
|
147
|
-
}
|
148
|
-
end
|
149
|
-
|
150
|
-
def livenessProbe
|
151
|
-
get("livenessProbe") || default_probe
|
152
|
-
end
|
153
|
-
|
154
|
-
def readinessProbe
|
155
|
-
get("readinessProbe") || default_probe
|
156
|
-
end
|
157
|
-
|
158
|
-
def startupProbe
|
159
|
-
get("startupProbe") || default_probe
|
160
|
-
end
|
161
|
-
|
162
139
|
def lifecycle
|
163
140
|
get("lifecycle")
|
164
141
|
end
|
165
142
|
|
143
|
+
|
166
144
|
def application_type
|
167
145
|
"web"
|
168
146
|
end
|
@@ -341,13 +319,7 @@ module Pfab
|
|
341
319
|
"deployed-name" => @data['deployed_name'],
|
342
320
|
},
|
343
321
|
},
|
344
|
-
strategy:
|
345
|
-
type: "RollingUpdate",
|
346
|
-
rollingUpdate: {
|
347
|
-
maxSurge: 1,
|
348
|
-
maxUnavailable: 0,
|
349
|
-
}
|
350
|
-
},
|
322
|
+
strategy: rolling_update_strategy(),
|
351
323
|
revisionHistoryLimit: 5,
|
352
324
|
progressDeadlineSeconds: 120,
|
353
325
|
template: {
|
@@ -374,12 +346,9 @@ module Pfab
|
|
374
346
|
envFrom: env_from,
|
375
347
|
resources: resources,
|
376
348
|
ports: ports,
|
377
|
-
livenessProbe: livenessProbe,
|
378
|
-
readinessProbe: readinessProbe,
|
379
|
-
startupProbe: startupProbe,
|
380
349
|
lifecycle: lifecycle,
|
381
350
|
volumeMounts: volume_mounts
|
382
|
-
}.compact
|
351
|
+
}.merge(probes()).compact
|
383
352
|
],
|
384
353
|
topologySpreadConstraints: topology_spread_constraints,
|
385
354
|
volumes: volumes
|
data/lib/pfab/version.rb
CHANGED
data/lib/pfab.rb
CHANGED
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.
|
5
|
+
# stub: pfab 0.57.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "pfab".freeze
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.57.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-
|
14
|
+
s.date = "2024-07-17"
|
15
15
|
s.description = "k8s helper".freeze
|
16
16
|
s.email = "jdwyer@prefab.cloud".freeze
|
17
17
|
s.executables = ["pfab".freeze]
|
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/pfab/templates/cron.rb",
|
37
37
|
"lib/pfab/templates/daemon.rb",
|
38
38
|
"lib/pfab/templates/job.rb",
|
39
|
+
"lib/pfab/templates/long_running_process.rb",
|
39
40
|
"lib/pfab/templates/web.rb",
|
40
41
|
"lib/pfab/version.rb",
|
41
42
|
"lib/pfab/yamls.rb",
|
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.
|
4
|
+
version: 0.57.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-
|
11
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/pfab/templates/cron.rb
|
162
162
|
- lib/pfab/templates/daemon.rb
|
163
163
|
- lib/pfab/templates/job.rb
|
164
|
+
- lib/pfab/templates/long_running_process.rb
|
164
165
|
- lib/pfab/templates/web.rb
|
165
166
|
- lib/pfab/version.rb
|
166
167
|
- lib/pfab/yamls.rb
|