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

CA secrets distributed by operator in all namespace causing errors in Cert Manager Ca Injector #124

Open
kumarBiplab1987 opened this issue Jun 5, 2023 · 3 comments
Labels
kind/enhancement Categorizes issue or PR as related to an improvement. lifecycle/keep Denotes an issue or PR that should be preserved from going stale.

Comments

@kumarBiplab1987
Copy link

Describe the bug:
We are using cert manager to manage the certificates of all vault services in our kubernetes cluster.
When we are trying to create a namespace for our services, Banzai is automatically creating secret includes ca cert in that namespace, which is having cert manager annotations in the metadata of the secret resource and cert manager CA injector pod is complains that associated certificates resource with the secret is not present in that namespace.

cert-manager/secret-for-certificate-mapper "msg"="unable to fetch certificate that owns the secret" "error"="Certificate.cert-manager.io "vault" not found" "certificate"={"Namespace":"infra","Name":"vault"} "secret"={"Namespace":"infra","Name":"vault-tls"}

Expected behaviour:
When distributing CA certs through operator it should not copy the cert manager annotations in the vault tls secrets.

Steps to reproduce the bug:

  1. Install Banzai vault operator.
  2. Use Cert manager to generate vault certificates.
  3. Use "existingTlsSecretName: vault-tls" in the crd when bringing up the vault services.

Additional context:
Add any other context about the problem here.

Environment details:

  • Kubernetes versionv1.21.5
  • bank-vaults version 1.13.0
  • Install method helm
  • Logs from the cert manager CA injector
    cert-manager/secret-for-certificate-mapper "msg"="unable to fetch certificate that owns the secret" "error"="Certificate.cert-manager.io "vault" not found" "certificate"={"Namespace":"infra","Name":"vault"} "secret"={"Namespace":"infra","Name":"vault-tls"}

/kind bug

@suhastm19
Copy link

The problem here is the code logic. Operator removes few entries from TLS secret and creates an opaque CA secret in other namespaces. But it would have been better if just ca.crt entry is taken from the TLS secret instead of deleting other entries and just keeping ca.crt entry.

// We need the CA certificate only
if currentSecret.Type == corev1.SecretTypeTLS {
    currentSecret.Type = corev1.SecretTypeOpaque
    delete(currentSecret.Data, corev1.TLSCertKey)
    delete(currentSecret.Data, corev1.TLSPrivateKeyKey)
    if err := controllerutil.SetControllerReference(v, &currentSecret, r.scheme); err != nil {
	    return fmt.Errorf("failed to set current secret controller reference: %v", err)
    }
} else {
    delete(currentSecret.StringData, "server.crt")
    delete(currentSecret.StringData, "server.key")
    delete(currentSecret.StringData, "ca.key")
    delete(currentSecret.Data, "server.crt")
    delete(currentSecret.Data, "server.key")
    delete(currentSecret.Data, "ca.key")
}

@akijakya akijakya transferred this issue from bank-vaults/bank-vaults Jul 20, 2023
@akijakya akijakya added the kind/enhancement Categorizes issue or PR as related to an improvement. label Jul 20, 2023
@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Dec 10, 2023
@ramizpolic ramizpolic removed the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Dec 21, 2023
@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Feb 25, 2024
@ramizpolic ramizpolic removed the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Feb 26, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot Feb 26, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot Feb 26, 2024
@ramizpolic
Copy link
Member

Hi @kumarBiplab1987, could you try recreating this issue with the latest releases of Bank-Vaults tools? Let us know if the problem persists so we can resolve this.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Apr 28, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
@reshproy
Copy link

Hi @kumarBiplab1987, could you try recreating this issue with the latest releases of Bank-Vaults tools? Let us know if the problem persists so we can resolve this.

The issue still persists with vault operator v1.22.1 and bank-vaults v1.31.0

@csatib02 csatib02 reopened this May 24, 2024
@csatib02 csatib02 removed the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label May 24, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot May 24, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot May 24, 2024
@ramizpolic ramizpolic changed the title Banazai operator : CA secrets distributed by operator in all namespace causing errors in Cert Manager Ca Injector CA secrets distributed by operator in all namespace causing errors in Cert Manager Ca Injector Jun 11, 2024
@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Aug 11, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot Aug 11, 2024
@csatib02 csatib02 added lifecycle/keep Denotes an issue or PR that should be preserved from going stale. and removed lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. labels Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Categorizes issue or PR as related to an improvement. lifecycle/keep Denotes an issue or PR that should be preserved from going stale.
Projects
Status: 📋 Backlog
Development

No branches or pull requests

6 participants