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

Use a custom CA file for r10k control repo #212

Merged
merged 4 commits into from
Mar 29, 2024

Conversation

cpiment
Copy link
Contributor

@cpiment cpiment commented Mar 28, 2024

In my use case the control repo is in a private repository which is cloned via HTTPS. The Gitlab instance where the repo lives is behind a reverse proxy which serves the repositories, and that reverser proxy has a certificate issued by an internal CA.

In order for r10k to retrieve the repository, I have had to configure the netrc file, which was already present in the chart but not documented (#211), and find a way for r10k to handle the custom CA of my Gitlab instance.

This PR adds two new configuration settings:

  • r10k.code.viaHttps.customCa.cert.value: A multiline file where the custom CA certificate chain can be stored in PEM format. This certificate is stored inside the r10k-code-secret within the cert key.
  • r10k.code.viaHttps.customCa.existingSecret: A secret reference which must store the certificate chain in PEM format inside the cert key

The certificate is mounted as ~/code-certs/ca.pem file in the container where r10k is running and then this command is launched in the entry point of the container:

git config --global http."{{ template "r10k.code.viaHttps.customCa.repoUrl" .}}".sslCAInfo ~/code-certs/ca.pem

The template r10k.code.viaHttps.customCa.repoUrl extracts the base URL from the puppetserver.puppeturl, so git can check if the TLS certificate from the HTTPS repository matches the custom CA.

I have bumped the version and changelog of the chart, but it you need more changes or me to modify anything, please contact me.

Copy link
Contributor

@Xtigyro Xtigyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpiment Truly awesome PR! Thank you! 🥇

@Xtigyro Xtigyro merged commit 38e041a into puppetlabs:master Mar 29, 2024
3 checks passed
@cpiment cpiment deleted the feature/r10k-custom-cert branch March 29, 2024 13:45
@cpiment
Copy link
Contributor Author

cpiment commented Mar 29, 2024

@cpiment Truly awesome PR! Thank you! 🥇

Thank you for the chart!

@Xtigyro
Copy link
Contributor

Xtigyro commented Mar 30, 2024

@cpiment Wanna be one of the official maintainers? We're a team of three people at present.

@cpiment
Copy link
Contributor Author

cpiment commented Mar 30, 2024

Hi @Xtigyro! Thanks for the offering, I'm really flattered! However, I've never used helm before this chart and I don't know many things about developing and testing charts so I don't know if I would be a very good maintainer. I think I will try to contribute and learn for some time before taking that step, if that's OK with you.

@Xtigyro
Copy link
Contributor

Xtigyro commented Apr 1, 2024

@cpiment Sure - and thank you once more!

@vibe
Copy link

vibe commented Apr 3, 2024

@cpiment @Xtigyro
This PR breaks the chart even if viaHTTPS (for example when using viaSsh instead) is not provided due to default values.

r10k-code.config.yaml needs to be updated, line 54.

{{- if or .Values.r10k.code.viaHttps.customCa.existingSecret .Values.r10k.code.viaHttps.customCa.cert.value }}

@Xtigyro
Copy link
Contributor

Xtigyro commented Apr 3, 2024

@vibe Thanks!

@cpiment Could you please fix that?

FYI: @ldaneliukas @davidphay

cpiment pushed a commit to cpiment/puppetserver-helm-chart that referenced this pull request Apr 3, 2024
@cpiment
Copy link
Contributor Author

cpiment commented Apr 3, 2024

Sorry about the bug, I tested the suggested change in my environment and it seems to work fine, thanks for reporting!

cpiment added a commit to cpiment/puppetserver-helm-chart that referenced this pull request Apr 3, 2024
Xtigyro pushed a commit that referenced this pull request Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants