Fix TOML syntax in Kubernetes documentation
What does this MR do?
It fixes an incorrect syntax in the runners.kubernetes.dns_config
section of the Kubernetes documentation.
Why was this MR needed?
Users following this documentation would not get the desired configuration.
What's the best way to test this MR?
The correct syntax was already thoroughly tested in !2473 (merged).
The difference in behavior between the invalid syntax and the correct syntax can be tested through a simple change to a unit test:
diff --git a/commands/register_test.go b/commands/register_test.go
index 3e267c613..e226cad13 100644
--- a/commands/register_test.go
+++ b/commands/register_test.go
@@ -139,7 +139,12 @@ var (
[[runners.kubernetes.volumes.empty_dir]]
name = "empty_dir"
mount_path = "/path/to/empty_dir"
- medium = "Memory"`
+ medium = "Memory"
+ [runners.kubernetes.dns_config]
+ nameservers = ["8.8.8.8"]
+ [[runners.kubernetes.dns_config.options]]
+ name = "ndots"
+ value = "2"`
configTemplateMergeToBaseConfiguration = &common.RunnerConfig{
RunnerCredentials: common.RunnerCredentials{
@@ -199,6 +204,12 @@ func TestConfigTemplate_MergeTo(t *testing.T) {
assert.Equal(t, "empty_dir", emptyDir.Name)
assert.Equal(t, "/path/to/empty_dir", emptyDir.MountPath)
assert.Equal(t, "Memory", emptyDir.Medium)
+
+ require.Len(t, k8s.DNSConfig.Nameservers, 1)
+ assert.Equal(t, "8.8.8.8", k8s.DNSConfig.Nameservers[0])
+ require.Len(t, k8s.DNSConfig.Options, 1)
+ assert.Equal(t, "ndots", k8s.DNSConfig.Options[0].Name)
+ assert.Equal(t, "2", *k8s.DNSConfig.Options[0].Value)
},
expectedError: nil,
},
$ go test -run TestConfigTemplate_MergeTo -count 1 ./commands
ok gitlab.com/gitlab-org/gitlab-runner/commands 0.337s
If instead, we use the current state ([dns_config]
):
--- FAIL: TestConfigTemplate_MergeTo (0.00s)
--- FAIL: TestConfigTemplate_MergeTo/template_adds_additional_content (0.00s)
register_test.go:205:
Error Trace: register_test.go:205
register_test.go:234
Error: "[]" should have 1 item(s), but has 0
Test: TestConfigTemplate_MergeTo/template_adds_additional_content
FAIL
FAIL gitlab.com/gitlab-org/gitlab-runner/commands 0.447s
FAIL
What are the relevant issue numbers?
Closes #27772 (closed)
Edited by Pedro Pombeiro