Skip to content

Commit b01608b

Browse files
committed
fix: linter
1 parent 03c7f81 commit b01608b

File tree

4 files changed

+55
-55
lines changed

4 files changed

+55
-55
lines changed

docs/content/http-proxy.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@ spec:
4040
- http://no-proxy-2.example.com
4141
```
4242
43-
The `additionalNo` list will be added to default pre-calculated values that apply on k8s networking.
44-
45-
```
46-
localhost,127.0.0.1,<POD CIDRS>,<SERVICE CIDRS>,kubernetes,.svc,.svc.cluster,.svc.cluster.local
47-
```
43+
The `additionalNo` list will be added to default pre-calculated values that apply on k8s networking
44+
`localhost,127.0.0.1,<POD CIDRS>,<SERVICE CIDRS>,kubernetes,.svc,.svc.cluster,.svc.cluster.local`.
4845

4946
Applying this configuration will result in new bootstrap files on the `KubeadmControlPlaneTemplate`
5047
and `KubeadmConfigTemplate`.

pkg/handlers/httpproxy/inject.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ func (h *httpProxyPatchHandler) detectNoProxy(
145145
clusterKey := types.NamespacedName{}
146146

147147
for _, item := range req.Items {
148-
if item.HolderReference.Kind == "Cluster" && item.HolderReference.APIVersion == capiv1.GroupVersion.String() {
148+
if item.HolderReference.Kind == "Cluster" &&
149+
item.HolderReference.APIVersion == capiv1.GroupVersion.String() {
149150
clusterKey.Name = item.HolderReference.Name
150151
clusterKey.Namespace = item.HolderReference.Namespace
151152
}
@@ -201,7 +202,7 @@ func generateNoProxy(cluster *capiv1.Cluster) []string {
201202

202203
// mapServiceDomain generates NO_PROXY values for service domain to allow use
203204
// of short service name in cluster.
204-
// Example: my.custom => [.svc, .svc.my, .svc.my.custom]
205+
// Example: my.custom => [.svc, .svc.my, .svc.my.custom].
205206
func mapServiceDomain(serviceDomain, svcName string) []string {
206207
mapped := []string{svcName}
207208
progress := svcName

pkg/handlers/httpproxy/inject_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ func TestGenerateNoProxy(t *testing.T) {
227227

228228
for _, tc := range testCases {
229229
t.Run(tc.name, func(tt *testing.T) {
230+
tt.Parallel()
230231
g.Expect(generateNoProxy(tc.cluster)).To(Equal(tc.expectedNoProxy))
231232
})
232233
}

pkg/handlers/httpproxy/systemd_proxy_config_test.go

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -18,80 +18,81 @@ func TestGenerateSystemdFiles(t *testing.T) {
1818
vars HTTPProxyVariables
1919
noProxy []string
2020
expectedContents string
21-
}{{
22-
name: "no proxy configuration",
23-
}, {
24-
name: "all vars set",
25-
vars: HTTPProxyVariables{
26-
HTTP: "http://example.com",
27-
HTTPS: "https://example.com",
28-
AdditionalNO: []string{
29-
"https://no-proxy.example.com",
21+
}{
22+
{
23+
name: "no proxy configuration",
24+
}, {
25+
name: "all vars set",
26+
vars: HTTPProxyVariables{
27+
HTTP: "http://example.com",
28+
HTTPS: "https://example.com",
29+
AdditionalNO: []string{
30+
"https://no-proxy.example.com",
31+
},
3032
},
31-
},
32-
expectedContents: `[Service]
33+
expectedContents: `[Service]
3334
Environment="HTTP_PROXY=http://example.com"
3435
Environment="http_proxy=http://example.com"
3536
Environment="HTTPS_PROXY=https://example.com"
3637
Environment="https_proxy=https://example.com"
3738
Environment="NO_PROXY=https://no-proxy.example.com"
3839
Environment="no_proxy=https://no-proxy.example.com"
3940
`,
40-
}, {
41-
name: "http only",
42-
vars: HTTPProxyVariables{
43-
HTTP: "http://example.com",
44-
},
45-
expectedContents: `[Service]
41+
}, {
42+
name: "http only",
43+
vars: HTTPProxyVariables{
44+
HTTP: "http://example.com",
45+
},
46+
expectedContents: `[Service]
4647
Environment="HTTP_PROXY=http://example.com"
4748
Environment="http_proxy=http://example.com"
4849
`,
49-
}, {
50-
name: "https only",
51-
vars: HTTPProxyVariables{
52-
HTTPS: "https://example.com",
53-
},
54-
expectedContents: `[Service]
50+
}, {
51+
name: "https only",
52+
vars: HTTPProxyVariables{
53+
HTTPS: "https://example.com",
54+
},
55+
expectedContents: `[Service]
5556
Environment="HTTPS_PROXY=https://example.com"
5657
Environment="https_proxy=https://example.com"
5758
`,
58-
}, {
59-
name: "no proxy only",
60-
vars: HTTPProxyVariables{
61-
AdditionalNO: []string{
62-
"https://no-proxy.example.com",
59+
}, {
60+
name: "no proxy only",
61+
vars: HTTPProxyVariables{
62+
AdditionalNO: []string{
63+
"https://no-proxy.example.com",
64+
},
6365
},
64-
},
65-
expectedContents: `[Service]
66+
expectedContents: `[Service]
6667
Environment="NO_PROXY=https://no-proxy.example.com"
6768
Environment="no_proxy=https://no-proxy.example.com"
6869
`,
69-
}, {
70-
name: "multiple no proxy only",
71-
vars: HTTPProxyVariables{
72-
AdditionalNO: []string{
73-
"https://no-proxy.example.com",
74-
"https://no-proxy-1.example.com",
70+
}, {
71+
name: "multiple no proxy only",
72+
vars: HTTPProxyVariables{
73+
AdditionalNO: []string{
74+
"https://no-proxy.example.com",
75+
"https://no-proxy-1.example.com",
76+
},
7577
},
76-
},
77-
expectedContents: `[Service]
78+
expectedContents: `[Service]
7879
Environment="NO_PROXY=https://no-proxy.example.com,https://no-proxy-1.example.com"
7980
Environment="no_proxy=https://no-proxy.example.com,https://no-proxy-1.example.com"
8081
`,
81-
}, {
82-
name: "default no proxy values",
83-
vars: HTTPProxyVariables{
84-
AdditionalNO: []string{
85-
"https://no-proxy.example.com",
86-
"https://no-proxy-1.example.com",
82+
}, {
83+
name: "default no proxy values",
84+
vars: HTTPProxyVariables{
85+
AdditionalNO: []string{
86+
"https://no-proxy.example.com",
87+
"https://no-proxy-1.example.com",
88+
},
8789
},
88-
},
89-
noProxy: []string{"localhost", "127.0.0.1"},
90-
expectedContents: `[Service]
90+
noProxy: []string{"localhost", "127.0.0.1"},
91+
expectedContents: `[Service]
9192
Environment="NO_PROXY=localhost,127.0.0.1,https://no-proxy.example.com,https://no-proxy-1.example.com"
9293
Environment="no_proxy=localhost,127.0.0.1,https://no-proxy.example.com,https://no-proxy-1.example.com"
9394
`,
94-
},
95+
},
9596
}
9697

9798
for idx := range tests {

0 commit comments

Comments
 (0)