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

fix(step-certificates): Secrets are mounted event if we don't need them #174

Open
twistyWater opened this issue Feb 28, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working needs triage Waiting for discussion / prioritization by team

Comments

@twistyWater
Copy link

twistyWater commented Feb 28, 2024

Subject of the issue

In templates/ca.yaml volumes spec, {{ include "step-certificates.fullname" . }}-secrets is always mounted as a secret or configmap and cause secret doesn't exists when using inject.enabled=true and bootstrap.secret=false. I don't need any secret as I generate my own root certificate so the only key I need is the intermediate key, which is added via azure keyvault in the config file.

Your environment

  • OS - Ubuntu
  • Version - 22.04

Steps to reproduce

Create a values.yaml

existingSecrets:
  enabled: false
  ca: false
  issuer: false
  certsAsSecret: false
  configAsSecret: false
  sshHostCa: false
  sshUserCa: false

bootstrap:
  secrets: false
  enabled: false
  configmaps: false

inject:
  enabled: true
  config:
    files:
      ca.json:
        key: azurekms:name=my-intermediate-ca-key;vault=my-keyvault?version=12345
        kms:
          type: azurekms
  certificates:
    root_ca: |
      -----BEGIN CERTIFICATE-----
      something
      -----END CERTIFICATE-----

    intermediate_ca: |
      -----BEGIN CERTIFICATE-----
      something
      -----END CERTIFICATE-----

Expected behaviour

pod is created without the volume {{ include "step-certificates.fullname" . }}-secrets

Actual behaviour

The volume is created and pod is in error state, "secret doesn't exists"

Additional context

For the deployment to work, I need to set bootstrap.secrets=true and set a dummy value in inject.secrets.ssh.user_ca_key="unusable"

Validations should be added in template/ca.yaml to create the volume only if values exists like it is done for all other secrets, something like

{{- if and (or .Values.inject.enabled .Values.existingSecrets.enabled) (or (not (eq .Values.inject.secrets.certificate_issuer.key "") _and so on_)) }}
  secret:
    secretName: {{ include "step-certificates.fullname" . }}-secrets
{{- else }}
  configMap:
    name: {{ include "step-certificates.fullname" . }}-secrets
{{- end }}
@twistyWater twistyWater added bug Something isn't working needs triage Waiting for discussion / prioritization by team labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Waiting for discussion / prioritization by team
Projects
None yet
Development

No branches or pull requests

2 participants