-
Notifications
You must be signed in to change notification settings - Fork 455
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
fix: reload openshift csr-signer ca certificate in Operator trusted CA's #1742
fix: reload openshift csr-signer ca certificate in Operator trusted CA's #1742
Conversation
609fa94
to
1710578
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Few minor comments.
|
||
install_operator "certified-operators" "minio-operator" | ||
|
||
#destroy_crc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we enable this line before merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not for the moment, it was just causing disruption during development running on a personal device, github actions do not have enough power to run this therefore not automated.
Once we automatize the Openshift tests on the DC probably.
…the certificate in a local secret and reload the CA certificates * Add openshift test to deploy Operator from OperatorHub on minio-operator namespace * Add empty `securityContext` and `containerSecurityContext` in the Openshift kustomization example. * Fix to allow the tenant run with locally build operator image in crc test Signed-off-by: pjuarezd <[email protected]>
2c91aad
to
bae8e08
Compare
Thank you for your reviews @harshavardhana @shtripat, this is now ready to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fixes #1671 |
What is the problem?
In Openshift the certificates generated using CertificateSigningRequests (CSR) are signed by a Certificate Authority (CA) in the control plane. The CA is stored on
csr-signer
secret onopenshift-kube-controller-manager-operator
namespace, this CA certificate rotates every month.The certificates generated for the minio tenants when the
spec.requestAutocert: true
is set, are generated using CSR's, hence signed by thecsr-signer
in the cluster.Operator rotates the minio tenant certificates when they are about to expire (80% of usage), which is good and expected.
The problem consists in the Operator being unable to trust the certificate presented by the minio tenant on the healt check cycles because a newly rotated minio tenant certificate is signed by a new
csr-signer
CA, one that Operator doesn't know about.Operator was only loading the certificate when the pod was launched, so when the
csr-signer
was rotated, Operator was not aware of it.How the fix works
In the fix proposed in this PR, Operator will compare the certificate
tls.crt
in thecsr-signer
secret located in theopenshift-kube-controller-manager-operator
namespace with a copy of this certificate that we store in theopenshift-csr-signer-ca
secret in the operator namespace, if the certificate is different then we update the secret in the operator namespace.A layover specific only for Openshift will mount this secret in the operator deployment as an Optional secret and operator controller will load the CA on the pod start.
This approach have some benefits:
Mounting the secret will make sure that the deployment will restart the pods whenever the secret gets updated, therefore Operator will load the latest CA alwaysUpdate: Turns out that in practice the pods seemly are not being restarted when the secret gets modified (weird), so a a reload of the CA certificates whenever the secret changed was implemented.
We are planning to stop using CSR's to generate the tenant certificates and instead use
service-ca
to generate certificates using annotations as suggested in Securing service traffic using service serving certificate secrets docs, however... load the latestcsr-signer
CA certificate in Operator will make sure that any certificate issued within the cluster using CSR can be trusted, either a different minio instance or third party services.Closes #1688