pfab 0.53.0 → 0.54.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pfab/templates/web.rb +42 -51
- data/lib/pfab/version.rb +1 -1
- data/pfab.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6db80ed30cdab582adbf60a44b1cb80ffb32420898d07117b5e0fe81f0012ac
|
4
|
+
data.tar.gz: 818d93a741088cee1a7988273e6eb3389c013fee43227193d086f9cdaa8c01ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f53b2f212245784bd4d518c7058aa7a2bdad7c2bba7b4a1c956f86356e037ff429ec704c1f7210969ac05e2bfbc05e2273e7961cee9028941e0361d85aaaa618
|
7
|
+
data.tar.gz: 2d1e0b3cd52341158feea24b3f184b5ccd53c1dd1951b37b4cdcbed9d54d5e023c7bd772e27a7f86828f56ad86ccf1187c7ed7596a79acc5efc6457d525199cd
|
data/lib/pfab/templates/web.rb
CHANGED
@@ -187,10 +187,7 @@ module Pfab
|
|
187
187
|
|
188
188
|
|
189
189
|
def anti_affinity
|
190
|
-
|
191
|
-
z = zone_anti_affinity
|
192
|
-
m = merge_anti_affinity(p, z)
|
193
|
-
return m
|
190
|
+
return host_anti_affinity
|
194
191
|
end
|
195
192
|
|
196
193
|
|
@@ -198,63 +195,57 @@ module Pfab
|
|
198
195
|
anti_affinity_builder(ANTI_AFFINITY_MODE, ANTI_AFFINITY_PREFERRED_MODE_WEIGHT, "kubernetes.io/hostname")
|
199
196
|
end
|
200
197
|
|
201
|
-
def zone_anti_affinity
|
202
|
-
anti_affinity_builder(ZONE_ANTI_AFFINITY_MODE, ZONE_ANTI_AFFINITY_PREFERRED_MODE_WEIGHT, "topology.kubernetes.io/zone")
|
203
|
-
end
|
204
198
|
|
205
|
-
def
|
206
|
-
|
199
|
+
def topology_spread_constraints
|
200
|
+
waiveTopologySpreadConstraints = get("waiveTopologySpreadConstraints") || false
|
207
201
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
if pod_anti_affinity.dig(:podAntiAffinity, key) && zone_anti_affinity.dig(:podAntiAffinity, key)
|
222
|
-
merged[:podAntiAffinity][key] = pod_anti_affinity[:podAntiAffinity][key] + zone_anti_affinity[:podAntiAffinity][key]
|
223
|
-
elsif pod_anti_affinity.dig(:podAntiAffinity, key)
|
224
|
-
merged[:podAntiAffinity][key] = pod_anti_affinity[:podAntiAffinity][key]
|
225
|
-
elsif zone_anti_affinity.dig(:podAntiAffinity, key)
|
226
|
-
merged[:podAntiAffinity][key] = zone_anti_affinity[:podAntiAffinity][key]
|
227
|
-
end
|
228
|
-
end
|
229
|
-
end
|
202
|
+
schedulingRule = waiveTopologySpreadConstraints ? "ScheduleAnyway" : "DoNotSchedule"
|
203
|
+
|
204
|
+
zone_constraint = {
|
205
|
+
maxSkew: 1,
|
206
|
+
topologyKey: "topology.kubernetes.io/zone",
|
207
|
+
whenUnsatisfiable: schedulingRule,
|
208
|
+
labelSelector: labelSelector
|
209
|
+
}
|
210
|
+
host_constraint = {
|
211
|
+
maxSkew: 1,
|
212
|
+
topologyKey: "kubernetes.io/hostname",
|
213
|
+
whenUnsatisfiable: schedulingRule,
|
214
|
+
labelSelector: labelSelector
|
230
215
|
|
231
|
-
|
216
|
+
}
|
217
|
+
[zone_constraint, host_constraint]
|
232
218
|
end
|
233
219
|
|
234
220
|
|
221
|
+
|
222
|
+
def labelSelector
|
223
|
+
{
|
224
|
+
matchExpressions: [
|
225
|
+
{
|
226
|
+
key: "deployed-name",
|
227
|
+
operator: "In",
|
228
|
+
values: [
|
229
|
+
@data['deployed_name']
|
230
|
+
]
|
231
|
+
},
|
232
|
+
{
|
233
|
+
key: "deployment-unique-id",
|
234
|
+
operator: "In",
|
235
|
+
values: [
|
236
|
+
StyledYAML.double_quoted(deploy_unique_id)
|
237
|
+
]
|
238
|
+
}
|
239
|
+
]
|
240
|
+
}
|
241
|
+
end
|
242
|
+
|
235
243
|
def anti_affinity_builder(key, weight_key, topology_key)
|
236
244
|
antiAffinityMode = get(key) || "disabled"
|
237
245
|
if antiAffinityMode
|
238
246
|
affinitySelector = {
|
239
247
|
topologyKey: topology_key,
|
240
|
-
labelSelector:
|
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
|
-
]
|
257
|
-
},
|
248
|
+
labelSelector: labelSelector,
|
258
249
|
}
|
259
250
|
|
260
251
|
return case antiAffinityMode
|
@@ -381,7 +372,7 @@ module Pfab
|
|
381
372
|
volumeMounts: volume_mounts
|
382
373
|
}.compact
|
383
374
|
],
|
384
|
-
|
375
|
+
topologySpreadConstraints: topology_spread_constraints,
|
385
376
|
volumes: volumes
|
386
377
|
}.compact,
|
387
378
|
},
|
data/lib/pfab/version.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.54.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.54.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-
|
14
|
+
s.date = "2024-05-15"
|
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.
|
4
|
+
version: 0.54.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-
|
11
|
+
date: 2024-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|