Skip to content

Commit

Permalink
Merge pull request #4060 from zendesk/grosser/rep
Browse files Browse the repository at this point in the history
podtemplate: allow setting 0 replicas
  • Loading branch information
grosser committed May 18, 2023
2 parents 4721ab5 + c291740 commit 0bba9e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plugins/kubernetes/app/models/kubernetes/template_filler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def to_hash(verification: false)
set_name
if ['Deployment', 'StatefulSet'].include?(kind)
set_replica_target
elsif kind == "PodTemplate"
# do nothing: the template has resources so setting to 0 is nice to make them not count in the math
else
validate_replica_target_is_supported
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,12 +823,18 @@ def secret_annotations(hash)
end

it "does not populate spec attribute" do
result.fetch(:spec, nil).must_be_nil
refute result.key? :spec
end

it "overrides image" do
container.fetch(:image).must_equal image
end

it "allows 0 replicas" do
doc.replica_target = 0
result
refute result.key? :spec
end
end

describe "pod" do
Expand Down

0 comments on commit 0bba9e9

Please sign in to comment.