Skip to content

Commit

Permalink
Add missing tolerations in seeder-job (#116)
Browse files Browse the repository at this point in the history
* Add missing tolerations in seeder-job

* Add spec

* Add changeset

---------

Co-authored-by: Oliver Günther <[email protected]>
  • Loading branch information
harrison-seow-develab and oliverguenther authored Jul 22, 2024
1 parent 6be6b9c commit a0fd7c3
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rude-mirrors-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openproject/helm-charts": minor
---

Allow tolerations on seeder job
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.3
3.3.3
4 changes: 4 additions & 0 deletions charts/openproject/templates/seeder-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ spec:
spec:
{{- include "openproject.imagePullSecrets" . | indent 6 }}
{{- include "openproject.podSecurityContext" . | indent 6 }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | nindent 8 | trim }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | nindent 8 | trim }}
Expand Down
46 changes: 46 additions & 0 deletions spec/charts/openproject/tolerations_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true
require 'spec_helper'

describe 'tolerations' do
let(:template) { HelmTemplate.new(default_values) }

let(:definitions) {
{
/optest-openproject-seeder/ => 'seeder'
}
}

context 'when setting tolerations' do
let(:default_values) do
HelmTemplate.with_defaults(<<~YAML
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
YAML
)
end

it 'adds that secret ref to relevant deployments', :aggregate_failures do
definitions.each do |item, _|
spec = template.template_spec(item)
expect(spec['tolerations']).to be_a(Array)
expect(spec['tolerations'].first['key']).to eq 'key1'
end
end
end

context 'when setting no tolerations' do
let(:default_values) do
{}
end

it 'adds the default secrets', :aggregate_failures do
definitions.each do |item, _|
spec = template.template_spec(item)
expect(spec['tolerations']).to be_nil
end
end
end
end

0 comments on commit a0fd7c3

Please sign in to comment.