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

Unable to specify CA for Helm OCI repository #3417

Closed
1 task done
mnaser opened this issue Dec 17, 2022 · 8 comments
Closed
1 task done

Unable to specify CA for Helm OCI repository #3417

mnaser opened this issue Dec 17, 2022 · 8 comments
Labels
area/helm Helm related issues and pull requests area/oci OCI related issues and pull requests

Comments

@mnaser
Copy link

mnaser commented Dec 17, 2022

Describe the bug

At the moment, there is no possibility of using a custom certificate authority against a HelmRepository of type oci. While authentication makes sense to implement later down the line, the ability of trusting a CA should be something that is needed.

Steps to reproduce

  1. Create HelmRepository against internal CA OCI repository
  2. Use secretRef with caFile set
  3. HelmChart build will fail:
openstack-ceph-provisioners           ceph-provisioners           0.1.8     HelmRepository   atmosphere             7m46s   False   chart pull error: failed to download chart for remote reference: failed to do request: Head "https://atmosphere.openstack:5000/v2/charts/ceph-provisioners/manifests/0.1.8": x509: certificate signed by unknown authority

Expected behavior

I expect that it will accept it since I provided a CA file.

Screenshots and recordings

N/A

OS / Distro

N/A

Flux version

v0.37.0

Flux check

root@ctl1:~# flux check
► checking prerequisites
✔ Kubernetes 1.22.17 >=1.20.6-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.27.0
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.31.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.29.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.32.1
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta1
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1beta2
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1beta2
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta1
✔ receivers.notification.toolkit.fluxcd.io/v1beta1
✔ all checks passed

Git provider

N/A

Container Registry provider

Distribution (formerly Docker Registry)

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@souleb souleb added area/helm Helm related issues and pull requests area/oci OCI related issues and pull requests labels Dec 19, 2022
@souleb
Copy link
Member

souleb commented Dec 19, 2022

This is blocked upstream. We are working with the helm maintainer to fix it.

In the meantime, what you can do is patch the source-controller deployment to add your certificate in the pod's trusted root certificate store.

@souleb souleb added the blocked/upstream Blocked by an upstream dependency or issue label Dec 19, 2022
@kingdonb
Copy link
Member

@joelcomp1
Copy link

any updates on this? Trying to migrate my local instances to use OCI in Harbor but having the same issue as mentioned here.

@hiddeco
Copy link
Member

hiddeco commented Feb 15, 2023

As mentioned:

This is blocked upstream. We are working with the helm maintainer to fix it.

See helm/helm#11711

@souleb
Copy link
Member

souleb commented Mar 14, 2023

This will be resolved by fluxcd/source-controller#723

@mfilotto
Copy link

mfilotto commented Mar 15, 2023

A satisfaying workaround is to mount CA in source controller using method 3 of this tip

kind: Kustomization
resources:
- gotk-components.yaml
- gotk-sync.yaml
# Mount custom certificat in source controller
patches:
  - patch: |
      - op: add
        path: /spec/template/spec/volumes/-
        value:
          name: ca-pemstore
          configMap:
            name: ca-pemstore
      - op: add
        path: /spec/template/spec/containers/0/volumeMounts/-
        value:
          name: ca-pemstore
          mountPath: /etc/ssl/certs/my-cert.pem
          subPath: my-cert.pem
          readOnly: true
    target:
      kind: Deployment
      name: source-controller

@makkes
Copy link
Member

makkes commented Mar 17, 2023

Great you found that. Paulo also suggested this in #2921 (comment). I suppose we should add it as an item to the FAQ page.

@souleb
Copy link
Member

souleb commented Feb 22, 2024

fixed in fluxcd/source-controller#1097

@souleb souleb closed this as completed Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm Helm related issues and pull requests area/oci OCI related issues and pull requests
Projects
None yet
Development

No branches or pull requests

7 participants