Skip to content

Commit 441aad2

Browse files
committed
Adapting setupRegistryServer to be able to use https with the docker
registryClient Signed-off-by: Soule BA <[email protected]>
1 parent 00a70b1 commit 441aad2

File tree

7 files changed

+9
-88
lines changed

7 files changed

+9
-88
lines changed

api/v1beta2/helmrepository_types.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ type HelmRepositorySpec struct {
8787
// +optional
8888
Timeout *metav1.Duration `json:"timeout,omitempty"`
8989

90-
// InsecureSkipTLSVerify skips the validation of the TLS certificate of the
91-
// OCI registry endpoint.
92-
// +optional
93-
InsecureSkipTLSVerify bool `json:"insecureSkipTLSverify,omitempty"`
94-
9590
// Suspend tells the controller to suspend the reconciliation of this
9691
// HelmRepository.
9792
// +optional

docs/api/v1beta2/source.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -861,19 +861,6 @@ Its default value is 60s.</p>
861861
</tr>
862862
<tr>
863863
<td>
864-
<code>insecureSkipTLSverify</code><br>
865-
<em>
866-
bool
867-
</em>
868-
</td>
869-
<td>
870-
<em>(Optional)</em>
871-
<p>InsecureSkipTLSverify skips the validation of the TLS certificate of the
872-
OCI registry endpoint.</p>
873-
</td>
874-
</tr>
875-
<tr>
876-
<td>
877864
<code>suspend</code><br>
878865
<em>
879866
bool
@@ -2558,19 +2545,6 @@ Its default value is 60s.</p>
25582545
</tr>
25592546
<tr>
25602547
<td>
2561-
<code>insecureSkipTLSverify</code><br>
2562-
<em>
2563-
bool
2564-
</em>
2565-
</td>
2566-
<td>
2567-
<em>(Optional)</em>
2568-
<p>InsecureSkipTLSverify skips the validation of the TLS certificate of the
2569-
OCI registry endpoint.</p>
2570-
</td>
2571-
</tr>
2572-
<tr>
2573-
<td>
25742548
<code>suspend</code><br>
25752549
<em>
25762550
bool

internal/controller/helmchart_controller_test.go

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,16 +2241,15 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_authStrategy(t *testing.T) {
22412241
}
22422242

22432243
tests := []struct {
2244-
name string
2245-
url string
2246-
registryOpts registryOptions
2247-
secretOpts secretOptions
2248-
insecureSkipTLSVerify bool
2249-
provider string
2250-
providerImg string
2251-
want sreconcile.Result
2252-
wantErr bool
2253-
assertConditions []metav1.Condition
2244+
name string
2245+
url string
2246+
registryOpts registryOptions
2247+
secretOpts secretOptions
2248+
provider string
2249+
providerImg string
2250+
want sreconcile.Result
2251+
wantErr bool
2252+
assertConditions []metav1.Condition
22542253
}{
22552254
{
22562255
name: "HTTP without basic auth",
@@ -2346,22 +2345,6 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_authStrategy(t *testing.T) {
23462345
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: pulled 'helmchart' chart with version '0.1.0'"),
23472346
},
23482347
},
2349-
{
2350-
name: "HTTPS With InsecureSkipTLSVerify",
2351-
want: sreconcile.ResultSuccess,
2352-
registryOpts: registryOptions{
2353-
withBasicAuth: true,
2354-
},
2355-
secretOpts: secretOptions{
2356-
username: testRegistryUsername,
2357-
password: testRegistryPassword,
2358-
},
2359-
insecureSkipTLSVerify: true,
2360-
assertConditions: []metav1.Condition{
2361-
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: pulled 'helmchart' chart with version '0.1.0'"),
2362-
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: pulled 'helmchart' chart with version '0.1.0'"),
2363-
},
2364-
},
23652348
}
23662349

23672350
for _, tt := range tests {
@@ -2412,8 +2395,6 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_authStrategy(t *testing.T) {
24122395
repo.Spec.URL = tt.providerImg
24132396
}
24142397

2415-
repo.Spec.InsecureSkipTLSVerify = tt.insecureSkipTLSVerify
2416-
24172398
var secret *corev1.Secret
24182399
if tt.secretOpts.username != "" && tt.secretOpts.password != "" {
24192400
secret = &corev1.Secret{

internal/controller/helmrepository_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,6 @@ func (r *HelmRepositoryReconciler) reconcileSource(ctx context.Context, sp *patc
414414
}
415415
}
416416

417-
if obj.Spec.InsecureSkipTLSVerify {
418-
tlsConfig.InsecureSkipVerify = true
419-
}
420-
421417
// Construct Helm chart repository with options and download index
422418
newChartRepo, err := repository.NewChartRepository(obj.Spec.URL, "", r.Getters, clientOpts.TlsConfig, clientOpts.GetterOpts...)
423419
if err != nil {

internal/controller/helmrepository_controller_oci.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,6 @@ func (r *HelmRepositoryOCIReconciler) reconcile(ctx context.Context, sp *patch.S
352352
}
353353
}
354354

355-
if tlsConfig == nil {
356-
tlsConfig = &tls.Config{}
357-
}
358-
359-
tlsConfig.InsecureSkipVerify = obj.Spec.InsecureSkipTLSVerify
360-
361355
loginOpt, err := makeLoginOption(authenticator, keychain, obj.Spec.URL)
362356
if err != nil {
363357
conditions.MarkFalse(obj, meta.ReadyCondition, sourcev1.AuthenticationFailedReason, err.Error())

internal/controller/helmrepository_controller_oci_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ func TestHelmRepositoryOCIReconciler_authStrategy(t *testing.T) {
207207
url string
208208
registryOpts registryOptions
209209
secretOpts secretOptions
210-
insecureSkipTLSVerify bool
211210
provider string
212211
providerImg string
213212
want ctrl.Result
@@ -307,21 +306,6 @@ func TestHelmRepositoryOCIReconciler_authStrategy(t *testing.T) {
307306
*conditions.TrueCondition(meta.ReadyCondition, meta.SucceededReason, "Helm repository is ready"),
308307
},
309308
},
310-
{
311-
name: "HTTPS With InsecureSkipTLSVerify",
312-
want: ctrl.Result{RequeueAfter: interval},
313-
registryOpts: registryOptions{
314-
withBasicAuth: true,
315-
},
316-
secretOpts: secretOptions{
317-
username: testRegistryUsername,
318-
password: testRegistryPassword,
319-
},
320-
insecureSkipTLSVerify: true,
321-
assertConditions: []metav1.Condition{
322-
*conditions.TrueCondition(meta.ReadyCondition, meta.SucceededReason, "Helm repository is ready"),
323-
},
324-
},
325309
}
326310

327311
for _, tt := range tests {
@@ -364,8 +348,6 @@ func TestHelmRepositoryOCIReconciler_authStrategy(t *testing.T) {
364348
obj.Spec.URL = tt.providerImg
365349
}
366350

367-
obj.Spec.InsecureSkipTLSVerify = tt.insecureSkipTLSVerify
368-
369351
var secret *corev1.Secret
370352
if tt.secretOpts.username != "" && tt.secretOpts.password != "" {
371353
secret = &corev1.Secret{

internal/controller/suite_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ func setupRegistryServer(ctx context.Context, workspaceDir string, opts registry
163163
if err != nil {
164164
return nil, fmt.Errorf("failed to get free port: %s", err)
165165
}
166-
167166
server.registryHost = fmt.Sprintf("localhost:%d", port)
168167

169168
// Change the registry host to a host which is not localhost and

0 commit comments

Comments
 (0)