Skip to content

Commit ad14db4

Browse files
committed
Add .spec.insecureSkipVerify to HelmRepository for type: oci
Signed-off-by: Unai Arrien <[email protected]>
1 parent e1972b3 commit ad14db4

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

api/v1beta2/helmrepository_types.go

+6
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ type HelmRepositorySpec struct {
9898
// +optional
9999
Insecure bool `json:"insecure,omitempty"`
100100

101+
// InsecureSkipVerify allows connecting to a HTTPS container registry without
102+
// verifying the server's certificate chain and host name.
103+
// This field is only taken into account if the .spec.type field is set to 'oci'.
104+
// +optional
105+
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
106+
101107
// Timeout is used for the index fetch operation for an HTTPS helm repository,
102108
// and for remote OCI Repository operations like pulling for an OCI helm
103109
// chart by the associated HelmChart.

config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@ spec:
318318
registry. This field is only taken into account if the .spec.type
319319
field is set to 'oci'.
320320
type: boolean
321+
insecureSkipVerify:
322+
description: Insecure allows connecting to a HTTPS container registry
323+
without verifying the server's certificate chain and host name.
324+
This field is only taken into account if the .spec.type field is set to 'oci'.
325+
type: boolean
321326
interval:
322327
description: Interval at which the HelmRepository URL is checked for
323328
updates. This interval is approximate and may be subject to jitter

docs/api/v1beta2/source.md

+28
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,20 @@ This field is only taken into account if the .spec.type field is set to &lsquo;o
887887
</tr>
888888
<tr>
889889
<td>
890+
<code>insecureskipverify</code><br>
891+
<em>
892+
bool
893+
</em>
894+
</td>
895+
<td>
896+
<em>(Optional)</em>
897+
<p>InsecureSkipVerify allows connecting to a HTTPS container registry without
898+
verifying the server&rsquo;s certificate chain and host name.
899+
This field is only taken into account if the .spec.type field is set to &lsquo;oci&rsquo;.</p>
900+
</td>
901+
</tr>
902+
<tr>
903+
<td>
890904
<code>timeout</code><br>
891905
<em>
892906
<a href="https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration">
@@ -2619,6 +2633,20 @@ This field is only taken into account if the .spec.type field is set to &lsquo;o
26192633
</tr>
26202634
<tr>
26212635
<td>
2636+
<code>insecureskipverify</code><br>
2637+
<em>
2638+
bool
2639+
</em>
2640+
</td>
2641+
<td>
2642+
<em>(Optional)</em>
2643+
<p>InsecureSkipVerify allows connecting to a HTTPS container registry without
2644+
verifying the server&rsquo;s certificate chain and host name.
2645+
This field is only taken into account if the .spec.type field is set to &lsquo;oci&rsquo;.</p>
2646+
</td>
2647+
</tr>
2648+
<tr>
2649+
<td>
26222650
<code>timeout</code><br>
26232651
<em>
26242652
<a href="https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration">

docs/spec/v1beta2/helmrepositories.md

+9
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,15 @@ denying insecure non-TLS connections when fetching Helm chart OCI artifacts.
354354
**Note**: The insecure field is supported only for Helm OCI repositories.
355355
The `spec.type` field must be set to `oci`.
356356

357+
### InsecureSkipVerify
358+
359+
`.spec.insecureSkipVerify` is an optional field to allow connecting to a secure (HTTPS)
360+
container registry server without verifying the server's certificate chain and host name,
361+
if set to `true`. The default value is `false`,
362+
363+
**Note**: The insecureSkipVerify field is supported only for Helm OCI repositories.
364+
The `spec.type` field must be set to `oci`.
365+
357366
### Interval
358367

359368
**Note:** This field is ineffectual for [OCI Helm

internal/helm/getter/client_opts.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ func GetClientOpts(ctx context.Context, c client.Client, obj *helmv1.HelmReposit
8888
err error
8989
)
9090
// Check `.spec.certSecretRef` first for any TLS auth data.
91-
if obj.Spec.CertSecretRef != nil {
91+
if obj.Spec.InsecureSkipVerify {
92+
hrOpts.TlsConfig = &tls.Config{
93+
InsecureSkipVerify: true,
94+
}
95+
} else if obj.Spec.CertSecretRef != nil {
9296
certSecret, err = fetchSecret(ctx, c, obj.Spec.CertSecretRef.Name, obj.GetNamespace())
9397
if err != nil {
9498
return nil, "", fmt.Errorf("failed to get TLS authentication secret '%s/%s': %w", obj.GetNamespace(), obj.Spec.CertSecretRef.Name, err)

0 commit comments

Comments
 (0)