kubewarden / kubewarden-controller

Manage admission policies in your Kubernetes cluster with ease
https://kubewarden.io
Apache License 2.0
189 stars 33 forks source link

Handle certificate rotation #7

Closed flavio closed 11 hours ago

flavio commented 3 years ago

Description

Our controller uses two different CA roots:

  1. the one generated by cert-manager, which generates the CRD webhook leaf certificate
  2. The one generated by the PolicyServerController reconciliation loop the first time a policy server is created, which is used to generate the policy servers' TLS certificate.

There are a few problems with this approach:

  1. it creates a dependency on cert-manager, see: kubewarden/kubewarden-controller#422
  2. we don't rotate policy server certificates, therefore they will eventually expire.
  3. both cert-manager and our implementation on the PolicyServer side do not rotate the CA root (see https://github.com/cert-manager/cert-manager/issues/2478)

Solution

We need to implement our certificate rotation logic inside the controller. Specifically, we need to:

Tasks

flavio commented 3 years ago

Worth a look, something we could leverage: https://github.com/open-policy-agent/cert-controller

kkaempf commented 3 years ago

I always wonder why every project (like kucero for CaaSP) has to re-implement certificate handling. This should be built into Kubernetes.

fabriziosestito commented 1 month ago

Worth a look, something we could leverage: https://github.com/open-policy-agent/cert-controller

We decided not to leverage https://github.com/open-policy-agent/cert-controller since it does not support zero-downtime CA rotation. Also, we will need to fork it to adapt it to our use case, as we configure policy webhooks dynamically. Finally, it does not fully support leader election due to this bug.

flavio commented 11 hours ago

Closing, all the mandatory tasks have been done.