Skip to content

Commit 26b02a0

Browse files
committed
Make go-getter use CABundles
Whether defined in secrets from Rancher or in a GitRepo resource, go-getter (`helm.chart` field of `fleet.yaml`) is supposed to use the certificates specified. First the certificate specified in the GitRepo resource, then the ones from Rancher. It also should honor `GitRepo.Spec.insecureSkipTLSVerify` (even when using the Rancher certificates). Refers to #3646
1 parent eb3169f commit 26b02a0

File tree

9 files changed

+452
-110
lines changed

9 files changed

+452
-110
lines changed

e2e/assets/gitrepo/gitrepo.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,17 @@ spec:
1010
targetNamespace: {{.TargetNamespace}}
1111
{{- end }}
1212
paths:
13+
{{- if .Path }}
14+
- {{.Path}}
15+
{{- else }}
1316
- examples
17+
{{- end }}
18+
{{- if .CABundle}}
19+
caBundle: {{.CABundle}}
20+
{{- end}}
21+
{{- if .HelmSecretName }}
22+
helmSecretName: {{.HelmSecretName}}
23+
{{- end }}
24+
{{- if .HelmSecretNameForPaths }}
25+
helmSecretNameForPaths: {{.HelmSecretNameForPaths}}
26+
{{- end }}

e2e/single-cluster/gitrepo_test.go

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ const (
3131
HTTPSPort = 4343
3232
)
3333

34+
type gitRepoTestValues struct {
35+
Name string
36+
Repo string
37+
Branch string
38+
PollingInterval string
39+
TargetNamespace string
40+
Path string
41+
CABundle string
42+
HelmSecretName string
43+
HelmSecretNameForPaths string
44+
}
45+
3446
var _ = Describe("Monitoring Git repos via HTTP for change", Label("infra-setup"), func() {
3547
var (
3648
tmpDir string
@@ -100,18 +112,12 @@ var _ = Describe("Monitoring Git repos via HTTP for change", Label("infra-setup"
100112
})
101113

102114
JustBeforeEach(func() {
103-
err := testenv.ApplyTemplate(k, testenv.AssetPath("gitrepo/gitrepo.yaml"), struct {
104-
Name string
105-
Repo string
106-
Branch string
107-
PollingInterval string
108-
TargetNamespace string
109-
}{
110-
gitrepoName,
111-
inClusterRepoURL,
112-
gh.Branch,
113-
"15s", // default
114-
targetNamespace, // to avoid conflicts with other tests
115+
err := testenv.ApplyTemplate(k, testenv.AssetPath("gitrepo/gitrepo.yaml"), gitRepoTestValues{
116+
Name: gitrepoName,
117+
Repo: inClusterRepoURL,
118+
Branch: gh.Branch,
119+
PollingInterval: "15s", // default
120+
TargetNamespace: targetNamespace, // to avoid conflicts with other tests
115121
})
116122
Expect(err).ToNot(HaveOccurred())
117123

@@ -157,18 +163,12 @@ var _ = Describe("Monitoring Git repos via HTTP for change", Label("infra-setup"
157163
})
158164

159165
JustBeforeEach(func() {
160-
err := testenv.ApplyTemplate(k, testenv.AssetPath("gitrepo/gitrepo.yaml"), struct {
161-
Name string
162-
Repo string
163-
Branch string
164-
PollingInterval string
165-
TargetNamespace string
166-
}{
167-
gitrepoName,
168-
inClusterRepoURL,
169-
gh.Branch,
170-
"15s", // default
171-
targetNamespace, // to avoid conflicts with other tests
166+
err := testenv.ApplyTemplate(k, testenv.AssetPath("gitrepo/gitrepo.yaml"), gitRepoTestValues{
167+
Name: gitrepoName,
168+
Repo: inClusterRepoURL,
169+
Branch: gh.Branch,
170+
PollingInterval: "15s", // default
171+
TargetNamespace: targetNamespace, // to avoid conflicts with other tests
172172
})
173173
Expect(err).ToNot(HaveOccurred())
174174

@@ -270,18 +270,12 @@ var _ = Describe("Monitoring Git repos via HTTP for change", Label("infra-setup"
270270
clone, err = gh.Create(clonedir, testenv.AssetPath("gitrepo/sleeper-chart"), "examples")
271271
Expect(err).ToNot(HaveOccurred())
272272

273-
err = testenv.ApplyTemplate(k, testenv.AssetPath("gitrepo/gitrepo.yaml"), struct {
274-
Name string
275-
Repo string
276-
Branch string
277-
PollingInterval string
278-
TargetNamespace string
279-
}{
280-
gitrepoName,
281-
inClusterRepoURL,
282-
gh.Branch,
283-
"24h", // prevent polling
284-
targetNamespace, // to avoid conflicts with other tests
273+
err = testenv.ApplyTemplate(k, testenv.AssetPath("gitrepo/gitrepo.yaml"), gitRepoTestValues{
274+
Name: gitrepoName,
275+
Repo: inClusterRepoURL,
276+
Branch: gh.Branch,
277+
PollingInterval: "24h", // prevent polling
278+
TargetNamespace: targetNamespace, // to avoid conflicts with other tests
285279
})
286280
Expect(err).ToNot(HaveOccurred())
287281
})

0 commit comments

Comments
 (0)