Skip to content

Non-namespaced Issuers #91

Closed
Closed

Description

@munnerz

Right now we only support namespaced Issuer, meaning in order to issue certificates in a given namespace, a new Issuer must be created first.

This means, for example with the ACME Issuer, multiple ACME registrations will exist (one per namespace).

This may be acceptable, however some users coming from kube-cert-manager and kube-lego may want to use a cluster-wide Issuer, be it ACME or otherwise.

Should we, and how should we, support a cluster-scoped Issuer?

Things to consider:

  • The codebase needs to make sure to use the correct namespace when making calls for resources (this should be the case anyway, and some tests for each issuer should verify this)
  • The API spec for a Certificate will need the issuerName field replacing with an issuerRef field, containing a namespace and name field (and potentially API version & group too)
  • How does this inter-play with 'default' issuers, or the upcoming tls-acme annotation

Activity

  1. munnerz commented on Sep 20, 2017

    @munnerz
    MemberAuthor

    @mikebryant how do you think this could be modelled in the API?

    Do we want to expose crossing namespace boundaries with this PR? I'm not sure that's something we want as it may serve as a gateway to unauthorised users obtaining certificates from issuers they shouldn't be able to.

    My first thought would be something like:

    type Certificate struct {
      ...
      issuerRef ObjectRef `json"issuerRef"`
      ...
    }
    
    type ObjectRef {
      Name string `json:"name"`
      Namespace *string `json:"namespace"`
    }

    This way, if a user does not specify a Namespace, the Namespace of the issuer can be used (and set by an Initializer). If the namespace specified is "", the ClusterIssuer would be used. If it is specified, we'd then need to build in a check to ensure certificate.spec.issuerRef.namespace == certificate.namespace and if it does not, print errors/reject creation of the resource in an initialiser.

    This has the advantage of keeping the mode of operation relatively simple (you should either not set Namespace which is the current mode of operation, or set it to "" for ClusterIssuers). On the other hand it does mean we need to build some support in for blocking cross-namespace issuance (unless of course we want to consider allowing cross-namespace issuance, but I fear this breaks the model we see elsewhere in K8s APIs)

  2. munnerz commented on Sep 21, 2017

    @munnerz
    MemberAuthor

    So I've started building this design out, and have got to the point of needing to use both a ClusterIssuer and Issuer within the same control loops (to save duplicating code).

    To do this, I can create an interface which described an 'Issuer-like' thing, which would have a Metadata, Spec and Status field, however that raises the question - will the ClusterIssuer and Issuer spec/status ever be different?

    If yes, we have a few ways of dealing with it:

    1. Implement fields in both. That way in one of the two resources, some fields will not apply/behave in a similar way. This becomes difficult quickly, as any code referencing a these fields needs to be aware of this distinction.

    2. duplicate code to support both structures, some parts of which could be done through interfaces/adapters

    I'm going to push up a version that attempts (1) to begin with, and see just how unruly the current code paths will be. We can then have some discussion there as to how we can make this cleaner.

    /cc @simonswine @mikebryant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions