Bug 1957521 - CDI Operator not interpreting custom cert params correctly
Summary: CDI Operator not interpreting custom cert params correctly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Storage
Version: 4.8.0
Hardware: All
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.8.0
Assignee: Michael Henriksen
QA Contact: Yan Du
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-05 23:33 UTC by Michael Henriksen
Modified: 2021-07-27 14:32 UTC (History)
4 users (show)

Fixed In Version: virt-cdi-operator v4.8.0-18
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-27 14:31:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt containerized-data-importer pull 1775 0 None closed [Bugfix] wrong interpretation of custom cert rotation params 2021-05-18 14:31:22 UTC
Github kubevirt containerized-data-importer pull 1792 0 None open [release-v1.34] [Bugfix] wrong interpretation of custom cert rotation params 2021-05-18 14:31:19 UTC
Red Hat Product Errata RHSA-2021:2920 0 None None None 2021-07-27 14:32:08 UTC

Description Michael Henriksen 2021-05-05 23:33:08 UTC
Description of problem:

We stole the idea of Duration and RenewBefore from cert-manager. See here for interpretation: https://github.com/kubevirt/containerized-data-importer/blob/main/pkg/apis/core/v1beta1/types.go#L388-L393

We were not handling RenewBefore correctly. It is supposed to be time before a cert's "not after." But we were treating it is time from "not before".

Conversion is easy and will be done automatically on all certs after upgrade.


Version-Release number of selected component (if applicable):


How reproducible:

100%


Steps to Reproduce:
1.  Set explicit params for certs like this:

k edit cdi cdi

and add:

spec:
  certConfig:
    ca:
      duration: 10h
      renewBefore: 2h
    server:
      duration: 5h
      renewBefore: 1h


2.


Actual results:

    Check following secrets/annotations:

cdi-apiserver-signer -> "operator.cdi.kubevirt.io/certConfig: '{"lifetime":"10h0m0s","refresh":"2h0m0s"}'"

cdi-uploadproxy-signer -> "operator.cdi.kubevirt.io/certConfig: '{"lifetime":"10h0m0s","refresh":"2h0m0s"}'"

cdi-apiserver-server-cert -> "operator.cdi.kubevirt.io/certConfig: '{"lifetime":"10h0m0s","refresh":"1h0m0s"}'"

cdi-uploadproxy-server-cert -> "operator.cdi.kubevirt.io/certConfig: '{"lifetime":"5h0m0s","refresh":"1h0m0s"}'"


Expected results:

    Check following secrets/annotations:

cdi-apiserver-signer -> "operator.cdi.kubevirt.io/certConfig: '{"lifetime":"10h0m0s","refresh":"8h0m0s"}'"

cdi-uploadproxy-signer -> "operator.cdi.kubevirt.io/certConfig: '{"lifetime":"10h0m0s","refresh":"8h0m0s"}'"

cdi-apiserver-server-cert -> "operator.cdi.kubevirt.io/certConfig: '{"lifetime":"10h0m0s","refresh":"4h0m0s"}'"

cdi-uploadproxy-server-cert -> "operator.cdi.kubevirt.io/certConfig: '{"lifetime":"5h0m0s","refresh":"4h0m0s"}'"


Additional info:

Notice the different refresh values

Comment 1 Yan Du 2021-06-02 11:51:25 UTC
Test on OCP4.8 with virt-cdi-operator-container-v4.8.0-19, issue have been fixed.

After setting params for certs in hco:

cdi-apiserver-signer -> operator.cdi.kubevirt.io/certConfig: '{"lifetime":"10h0m0s","refresh":"8h0m0s"}'

cdi-uploadproxy-signer -> operator.cdi.kubevirt.io/certConfig: '{"lifetime":"10h0m0s","refresh":"8h0m0s"}'

cdi-apiserver-server-cert -> operator.cdi.kubevirt.io/certConfig: '{"lifetime":"5h0m0s","refresh":"4h0m0s"}'

cdi-uploadproxy-server-cert -> operator.cdi.kubevirt.io/certConfig: '{"lifetime":"5h0m0s","refresh":"4h0m0s"}'

Comment 4 errata-xmlrpc 2021-07-27 14:31:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Virtualization 4.8.0 Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2920


Note You need to log in before you can comment on or make changes to this bug.