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

cert-manager: add trusted internal ca when configured #8135

Conversation

infra-monkey
Copy link
Contributor

@infra-monkey infra-monkey commented Oct 27, 2021

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test

/kind feature

/kind flake

What this PR does / why we need it:
In order to use an acme issuer with an internal authority, the CA of the authority must be trusted by cert-manager.
If not, the issuer with throw errors saying the certificate of the acme uri is unknown.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
I tried to keep it simple.
One additional variable in the addon inventory to specify the trusted internal ca.
A configmap is create with the content of the ca.
This configmap is mounted in the cert-manager container in /etc/ssl/certs in order to be trusted.
As not everyone will use acme with an internal authority, the cm and mount are not defined if the variable is not defined.

Does this PR introduce a user-facing change?:

Add a new option `cert_manager_trusted_internal_ca` to specify trusted internal ca of cert_manager.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 27, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @infra-monkey. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 27, 2021
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 27, 2021
@oomichi
Copy link
Contributor

oomichi commented Oct 28, 2021

Hi @infra-monkey
Could you provide some link to know the configuration is valid on cert-manager?

@infra-monkey
Copy link
Contributor Author

infra-monkey commented Oct 29, 2021

@oomichi Hi,
So I inspired this change from https://smallstep.com/docs/tutorials/kubernetes-acme-ca
I ran a cluster update on my k8s cluster from this branch and it works with the latest change.
Here are some outputs of the state of my cluster after applying this change:
describe-cm.txt
describe-deployment.txt
describe-clusterissuer.txt

Extracted from the issuer crd definition (https://github.com/jetstack/cert-manager/blob/master/deploy/crds/crd-issuers.yaml#L141):

skipTLSVerify:
  description: Enables or disables validation of the ACME server TLS certificate. If true, requests to the ACME server will not have their TLS certificate validated (i.e. insecure connections will be allowed). Only enable this option in development environments. The cert-manager system installed roots will be used to verify connections to the ACME server if this is false. Defaults to false.
  type: boolean

This is the only "official" reference I could find about this feature.

@oomichi
Copy link
Contributor

oomichi commented Oct 29, 2021

@infra-monkey Thank you so much for your explanation, I got it.
This additional option doesn't break the existing features by default.
So I feel it is fine to add it and get feedback if any problem.

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 29, 2021
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 29, 2021
@infra-monkey
Copy link
Contributor Author

@oomichi thank you for the approval.
Indeed my initial description was light.

I put "none" for the user facing change. As there is a new option in the inventory, should I specifiy it there?

@oomichi
Copy link
Contributor

oomichi commented Oct 29, 2021

@oomichi thank you for the approval. Indeed my initial description was light.

I put "none" for the user facing change. As there is a new option in the inventory, should I specifiy it there?

That is a nice point.
It would be better to write a release note instead of NONE like

Add a new option cert_manager_trusted_internal_ca to specify internal ca of cert_manager

or something.

@infra-monkey
Copy link
Contributor Author

@oomichi a vagrant job failed in the pipeline. How can I restart the tests?

@cristicalin
Copy link
Contributor

@infra-monkey would you mid updating https://github.com/kubernetes-sigs/kubespray/blob/master/docs/cert_manager.md with some details on the new variable and the intended purpose?

@infra-monkey
Copy link
Contributor Author

@infra-monkey would you mid updating https://github.com/kubernetes-sigs/kubespray/blob/master/docs/cert_manager.md with some details on the new variable and the intended purpose?

Great point. I'll do that. I hope my english will be good enough.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 1, 2021
@cristicalin
Copy link
Contributor

It might be a good idea to rebase your branch on latest master since the CI job is complaining about failing to merge your doc changes.

@infra-monkey
Copy link
Contributor Author

@cristicalin Rebased from master. It bring a lot of changes from master that have nothing to do with this change.
Sorry I'm not a git guru.

CI fails, but because it can't pull containers.

@cristicalin
Copy link
Contributor

cristicalin commented Nov 2, 2021

The relevant failure on the CI is this:

Using index info to reconstruct a base tree...
M	docs/cert_manager.md
Falling back to patching base and 3-way merge...
Auto-merging docs/cert_manager.md
CONFLICT (content): Merge conflict in docs/cert_manager.md
Patch failed at 0004 Update documentation
Use 'git am --show-current-patch' to see the failed patch
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
error: Failed to merge in the changes.
Uploading artifacts for failed job 00:00
Uploading artifacts...
WARNING: cluster-dump/: no matching files          
ERROR: No files to upload                          

https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/-/jobs/1735187854#L40

Your PR now brings is some changes from the master branch which means the rebase was somehow broken. Usually, the way I do this is like this:

git remote set-url origin https://github.com/cristicalin/kubespray.git
git pull origin
git checkout <my_local_branch>
git rebase -i origin master  # ensure only my commits show up

@infra-monkey infra-monkey force-pushed the cert_manager_trusted_internal_ca branch from e54924f to d81e0e1 Compare November 2, 2021 18:57
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 2, 2021
@cristicalin
Copy link
Contributor

Unfortunately it seems our CI python was pushed to 3.10 and is now breaking in interesting ways. I pushed a fix #8153 but there may be other breakage.

@infra-monkey infra-monkey force-pushed the cert_manager_trusted_internal_ca branch from 520dc40 to e67652c Compare November 3, 2021 10:14
@infra-monkey
Copy link
Contributor Author

Unfortunately it seems our CI python was pushed to 3.10 and is now breaking in interesting ways. I pushed a fix #8153 but there may be other breakage.

I just saw that. I'll wait for you PR to be merged in master and include it here.
Thank you for looking into it

@floryut
Copy link
Member

floryut commented Nov 3, 2021

Unfortunately it seems our CI python was pushed to 3.10 and is now breaking in interesting ways. I pushed a fix #8153 but there may be other breakage.

I just saw that. I'll wait for you PR to be merged in master and include it here. Thank you for looking into it

Merged now you can rebase 👍

@infra-monkey
Copy link
Contributor Author

I cherry picked the CI fix.

@infra-monkey
Copy link
Contributor Author

@oomichi @cristicalin @floryut Seems the pipeline fails on a timeout downloading a file.
I don't see how my changes could influence this part.
How should I proceed?

@floryut
Copy link
Member

floryut commented Nov 4, 2021

@oomichi @cristicalin @floryut Seems the pipeline fails on a timeout downloading a file. I don't see how my changes could influence this part. How should I proceed?

yup there is an issue with calico release, I've submitted a PR and I'm trying to get in touch with Calico maintainers to understands what the f** happened

@infra-monkey
Copy link
Contributor Author

infra-monkey commented Nov 4, 2021

yup there is an issue with calico release, I've submitted a PR and I'm trying to get in touch with Calico maintainers to understands what the f** happened

I have seen your PR. Indeed it is strange that the hash would change without a version change.
I'll wait for your go before rebasing the fix.
Bad timing for me but at least the ci failures are caught early

@cristicalin
Copy link
Contributor

@infra-monkey #8157 just merged, please rebase and lets try this run one more time.

@infra-monkey
Copy link
Contributor Author

YEAH ! It finally passed!

@oomichi
Copy link
Contributor

oomichi commented Nov 5, 2021

YEAH ! It finally passed!

Current pull request is not rebased yet, it just contains necessary commits in the pull request.
Please rebase this pull request like

git checkout master
git remote add upstream https://github.com/kubernetes-sigs/kubespray.git
git fetch upstream
git merge upstream/master
git checkout <your branch>
git rebase master
git push -f origin <your branch>

@infra-monkey infra-monkey force-pushed the cert_manager_trusted_internal_ca branch from 0265fe3 to aab7952 Compare November 5, 2021 06:34
@infra-monkey
Copy link
Contributor Author

@oomichi I didn't think you wanted a full rebase before merge. I misunderstood the request to rebase.
It is done now. CI running

@cristicalin
Copy link
Contributor

@infra-monkey it is the norm to have only your commits in a PR unless you are doing backports to older branches. This is needed to keep the git commit history clean and also to avoid issues when github squashes the commits in the final merge.

@cristicalin
Copy link
Contributor

/approve

Copy link
Member

@floryut floryut left a comment

Choose a reason for hiding this comment

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

@infra-monkey Thank you for the PR 👍

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cristicalin, floryut, infra-monkey

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2021
@infra-monkey
Copy link
Contributor Author

@infra-monkey Thank you for the PR +1

Thank you all for the guidance and patience :)

@cristicalin
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 5, 2021
@k8s-ci-robot k8s-ci-robot merged commit b7eb1cf into kubernetes-sigs:master Nov 5, 2021
@floryut floryut mentioned this pull request Dec 21, 2021
sakuraiyuta pushed a commit to sakuraiyuta/kubespray that referenced this pull request Apr 16, 2022
…s#8135)

* cert-manager: add trusted internal ca when configured

* wrong check for inventory variable

* Update documentation
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jun 28, 2023
…s#8135)

* cert-manager: add trusted internal ca when configured

* wrong check for inventory variable

* Update documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants