Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .spec.insecureSkipVerify to HelmRepository for type: oci #1345

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/v1beta2/helmrepository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ type HelmRepositorySpec struct {
// +optional
Insecure bool `json:"insecure,omitempty"`

// InsecureSkipVerify allows connecting to a HTTPS container registry without
// verifying the server's certificate chain and host name.
// This field is only taken into account if the .spec.type field is set to 'oci'.
// +optional
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`

// Timeout is used for the index fetch operation for an HTTPS helm repository,
// and for remote OCI Repository operations like pulling for an OCI helm
// chart by the associated HelmChart.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ spec:
registry. This field is only taken into account if the .spec.type
field is set to 'oci'.
type: boolean
insecureSkipVerify:
description: InsecureSkipVerify allows connecting to a HTTPS container registry
without verifying the server's certificate chain and host name.
This field is only taken into account if the .spec.type field is set to 'oci'.
type: boolean
interval:
description: Interval at which the HelmRepository URL is checked for
updates. This interval is approximate and may be subject to jitter
Expand Down
28 changes: 28 additions & 0 deletions docs/api/v1beta2/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,20 @@ This field is only taken into account if the .spec.type field is set to ‘o
</tr>
<tr>
<td>
<code>insecureSkipVerify</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>InsecureSkipVerify allows connecting to a HTTPS container registry without
verifying the server&rsquo;s certificate chain and host name.
This field is only taken into account if the .spec.type field is set to &lsquo;oci&rsquo;.</p>
</td>
</tr>
<tr>
<td>
<code>timeout</code><br>
<em>
<a href="https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration">
Expand Down Expand Up @@ -2619,6 +2633,20 @@ This field is only taken into account if the .spec.type field is set to &lsquo;o
</tr>
<tr>
<td>
<code>insecureSkipVerify</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>InsecureSkipVerify allows connecting to a HTTPS container registry without
verifying the server&rsquo;s certificate chain and host name.
This field is only taken into account if the .spec.type field is set to &lsquo;oci&rsquo;.</p>
</td>
</tr>
<tr>
<td>
<code>timeout</code><br>
<em>
<a href="https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration">
Expand Down
9 changes: 9 additions & 0 deletions docs/spec/v1beta2/helmrepositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,15 @@ denying insecure non-TLS connections when fetching Helm chart OCI artifacts.
**Note**: The insecure field is supported only for Helm OCI repositories.
The `spec.type` field must be set to `oci`.

### InsecureSkipVerify

`.spec.insecureSkipVerify` is an optional field to allow connecting to a secure (HTTPS)
container registry server without verifying the server's certificate chain and host name,
if set to `true`. The default value is `false`,

**Note**: The insecureSkipVerify field is supported only for Helm OCI repositories.
The `spec.type` field must be set to `oci`.

### Interval

**Note:** This field is ineffectual for [OCI Helm
Expand Down
6 changes: 5 additions & 1 deletion internal/helm/getter/client_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ func GetClientOpts(ctx context.Context, c client.Client, obj *helmv1.HelmReposit
err error
)
// Check `.spec.certSecretRef` first for any TLS auth data.
if obj.Spec.CertSecretRef != nil {
if obj.Spec.InsecureSkipVerify {
hrOpts.TlsConfig = &tls.Config{
InsecureSkipVerify: true,
}
} else if obj.Spec.CertSecretRef != nil {
certSecret, err = fetchSecret(ctx, c, obj.Spec.CertSecretRef.Name, obj.GetNamespace())
if err != nil {
return nil, "", fmt.Errorf("failed to get TLS authentication secret '%s/%s': %w", obj.GetNamespace(), obj.Spec.CertSecretRef.Name, err)
Expand Down