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

Reconsider error condition on empty secretnames in TLS hosts. #4235

Closed
jacobstr opened this issue Jul 20, 2021 · 4 comments
Closed

Reconsider error condition on empty secretnames in TLS hosts. #4235

jacobstr opened this issue Jul 20, 2021 · 4 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@jacobstr
Copy link

jacobstr commented Jul 20, 2021

Is your feature request related to a problem? Please describe.

Note: occurred to me after writing all of this that the underlying ask is to have some way to ignore a subset of hostnames in the TLS spec when the certificate-shim does it's thing.

In our cluster, we provide wildcard certificates via ingress-nginx's default certificate functionality. The documentation states:

The default certificate will also be used for ingress tls: sections that do not have a secretName option.

There appears to be some disagreement between nginx's interpretation of the Ingress spec and cert-manager here. One of our goals is to use the certificate shim to manage only a subset of the TLS hostnames - ideally, only those that have a secretName specified.

E.g. our hosts section typically looks like:

    tls:
    # These first two hosts will be handled by a wildcard cert for *.ingress.prod.k8s.example.com
    - hosts:
      - example.next.ingress.erb-01.staging.k8s.example.com
    - hosts:
      - erb-example.staging.example.com
      secretName: example-tls

This kinda/sorta works today - cert manager ignores the the TLS blocks with empty secretnames but does produce error logs / events. It doesn't inspire complete confidence that this behavior will be supported in the future and that this only works incidentally rather than being an explicit choice.

Describe the solution you'd like

  • Simply ignore TLS blocks with empty secret names instead of considering this an error condition.

Describe alternatives you've considered

If we do specify the secretName (e.g. cluster-wildcard-tls) like so:

    - hosts:
      - example.next.ingress.erb-01.staging.k8s.example.com # should present a *.erb-01.staging.k8s.example.com cert
      secretName: cluster-wildcard-tls

Cert-manager will try to create this certificate with the non-wildcard DNS name. To get around this in the past, we typically pre-provisioned the namespace with an explicit cluster-wildcard-tls certificate resource specifying our wildcard record before any ingresses were created. This had proven problematic - if, for whatever reason (e.g. a newly created namespace is created) this certificate doesn't exist and a new ingress appears cert manager will create it and "squat" on it with the wrong configuration.


Additionally, we tried omitting the tls block for the DNS name we want to map to the wildcard record entirely. In this case ingress-nginx simply omits TLS for the hostname entirely. Arguably, this is an issue with ingress-nginx.

Additional context

The wildcard hostnames are typically used to help service owners hit the ground running with a working hostname ASAP. Once a service is ready for prime time, folks typically create "vanity" DNS names that provide some additional indirection (e.g. we ellide the cluster name from this record).

  • Alternative would be having some way of opting-in to certificates for specific tls blocks. Appears an annotation could work, but whatever I come up with feels unergonomic.
cert-manager.io/ignored-secretNames: cluster-wildcard-tls,other-secrets
or
cert-manager.io/ignored-tls-hosts: example.next.ingress.erb-01.staging.k8s.example.com

Environment details (remove if not applicable):

  • Kubernetes version: 1.18
  • Cloud-provider/provisioner: gke
  • cert-manager version: 1.3.1
  • Install method: e.g. helm/static manifests static manifests

/kind feature

@jetstack-bot jetstack-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 20, 2021
@jetstack-bot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to jetstack.
/lifecycle stale

@jetstack-bot jetstack-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 18, 2021
@jetstack-bot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to jetstack.
/lifecycle rotten
/remove-lifecycle stale

@jetstack-bot jetstack-bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 18, 2021
@jetstack-bot
Copy link
Collaborator

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to jetstack.
/close

@jetstack-bot
Copy link
Collaborator

@jetstack-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to jetstack.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants