Skip to content

Commit

Permalink
Ensure correct scheduler extra arguments passed to v1beta3 template (#…
Browse files Browse the repository at this point in the history
…670)

* Ensure correct scheduler extra arguments passed to v1beta3 template
* Add unit tests for scheduler extra arguments
  • Loading branch information
treydock authored Jan 10, 2024
1 parent 7bebd70 commit 396c903
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions spec/classes/config/kubeadm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -600,4 +600,20 @@
.with_content(%r{key: node-role.kubernetes.io/control-plane\n})
}
end

context 'when scheduler_extra_arguments is defined' do
let(:params) do
{
'kubernetes_version' => '1.26.0',
'scheduler_extra_arguments' => ['bind-address: 0.0.0.0']
}
end

let(:config_yaml) { YAML.load_stream(catalogue.resource('file', '/etc/kubernetes/config.yaml').send(:parameters)[:content]) }

it 'has scheduler extra arguments' do
cluster_config = config_yaml.find { |c| c['kind'] == 'ClusterConfiguration' }
expect(cluster_config['scheduler']['extraArgs']['bind-address']).to eq('0.0.0.0')
end
end
end
4 changes: 2 additions & 2 deletions templates/v1beta3/config_kubeadm.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ controllerManager:
<%- end -%>
<%- end -%>
scheduler:
<%- if @scheduler_merged_extra_arguments -%>
<%- if @scheduler_extra_arguments -%>
extraArgs:
<%- @scheduler_merged_extra_arguments.each do |arg| -%>
<%- @scheduler_extra_arguments.each do |arg| -%>
<%= arg %>
<%- end -%>
<%- end -%>
Expand Down

0 comments on commit 396c903

Please sign in to comment.