|
55 | 55 | it { is_expected.to contain_file('/etc/systemd/system/etcd.service') } |
56 | 56 | it { is_expected.to contain_file('/etc/systemd/system/etcd.service').with_content(%r{.*--initial-cluster *}) } |
57 | 57 | it { is_expected.to contain_file('/etc/systemd/system/etcd.service').without_content(%r{.*--discovery-srv.*}) } |
| 58 | + it { is_expected.to contain_file('/etc/systemd/system/etcd.service').without_content(%r{.*--listen-metrics-urls.*}) } |
58 | 59 | it { is_expected.not_to contain_file('/etc/default/etcd') } |
59 | 60 | it { is_expected.to contain_file('/etc/kubernetes/config.yaml') } |
60 | 61 | it { is_expected.to contain_file('/etc/kubernetes/config.yaml').with_content(%r{foo:\n- bar\n- baz}) } |
61 | 62 | it { is_expected.to contain_file('/etc/kubernetes/config.yaml').with_content(%r{kubeletConfiguration:\n baseConfig:\n baz:\n - bar\n - foo}) } |
| 63 | + |
| 64 | + context 'with etcd_listen_metric_urls defined' do |
| 65 | + let(:params) do |
| 66 | + { |
| 67 | + 'manage_etcd' => true, |
| 68 | + 'kubeadm_extra_config' => { 'foo' => ['bar', 'baz'] }, |
| 69 | + 'kubelet_extra_config' => { 'baz' => ['bar', 'foo'] }, |
| 70 | + 'kubelet_extra_arguments' => ['foo'], |
| 71 | + 'etcd_listen_metric_urls' => 'http://0.0.0.0:2381', |
| 72 | + } |
| 73 | + end |
| 74 | + |
| 75 | + it { is_expected.to contain_file('/etc/systemd/system/etcd.service').with_content(%r{.*--listen-metrics-urls http://0.0.0.0:2381.*}) } |
| 76 | + end |
62 | 77 | end |
63 | 78 |
|
64 | 79 | context 'with manage_etcd => true and delegated_pki => true' do |
|
94 | 109 | it { is_expected.to contain_file('/etc/systemd/system/etcd.service').with_content(%r{.*--initial-cluster *}) } |
95 | 110 | it { is_expected.to contain_file('/etc/systemd/system/etcd.service').with_content(%r{.*--auto-compaction-mode*}) } |
96 | 111 | it { is_expected.to contain_file('/etc/systemd/system/etcd.service').without_content(%r{.*--discovery-srv.*}) } |
| 112 | + it { is_expected.to contain_file('/etc/systemd/system/etcd.service').without_content(%r{.*--listen-metrics-urls.*}) } |
97 | 113 | it { is_expected.not_to contain_file('/etc/default/etcd') } |
98 | 114 | it { is_expected.to contain_file('/etc/kubernetes/config.yaml') } |
99 | 115 | it { is_expected.to contain_file('/etc/kubernetes/config.yaml').with_content(%r{foo:\n- bar\n- baz}) } |
|
150 | 166 | it { is_expected.to contain_file('/etc/default/etcd').with_content(%r{.*ETCD_INITIAL_CLUSTER=.*}) } |
151 | 167 | it { is_expected.to contain_file('/etc/default/etcd').with_content(%r{.*ETCD_AUTO_COMPACTION_MODE=.*}) } |
152 | 168 | it { is_expected.to contain_file('/etc/default/etcd').without_content(%r{.*ETCD_DISCOVERY_SRV=.*}) } |
| 169 | + it { is_expected.to contain_file('/etc/default/etcd').without_content(%r{.*ETCD_LISTEN_METRICS_URLS=.*}) } |
| 170 | + |
| 171 | + context 'with etcd_listen_metric_urls defined' do |
| 172 | + let(:params) do |
| 173 | + { |
| 174 | + 'etcd_install_method' => 'package', |
| 175 | + 'kubeadm_extra_config' => { 'foo' => ['bar', 'baz'] }, |
| 176 | + 'kubelet_extra_config' => { 'baz' => ['bar', 'foo'] }, |
| 177 | + 'kubelet_extra_arguments' => ['foo'], |
| 178 | + 'manage_etcd' => true, |
| 179 | + 'etcd_version' => '3.3.0', |
| 180 | + 'etcd_listen_metric_urls' => 'http://0.0.0.0:2381', |
| 181 | + } |
| 182 | + end |
| 183 | + |
| 184 | + it { is_expected.to contain_file('/etc/default/etcd').with_content(%r{.*ETCD_LISTEN_METRICS_URLS="http://0.0.0.0:2381".*}) } |
| 185 | + end |
153 | 186 | end |
154 | 187 |
|
155 | 188 | context 'manage_etcd => true and etcd_install_method => package and etcd_discovery_srv => etcd-autodiscovery' do |
|
0 commit comments