Bug 1845557 - [CNV-2.4] template validator webhook fails with certification issues
Summary: [CNV-2.4] template validator webhook fails with certification issues
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: SSP
Version: 2.4.0
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: 2.4.0
Assignee: Andrej Krejcir
QA Contact: Ruth Netser
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-09 14:04 UTC by Lukas Bednar
Modified: 2020-07-28 19:10 UTC (History)
3 users (show)

Fixed In Version: kubevirt-ssp-operator-container-v2.4.0-50
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-28 19:10:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github MarSik kubevirt-ssp-operator pull 183 0 None closed Fix cert rotation for OCP 4.4 and later 2020-08-25 11:56:33 UTC
Red Hat Product Errata RHSA-2020:3194 0 None None None 2020-07-28 19:10:43 UTC

Description Lukas Bednar 2020-06-09 14:04:46 UTC
Description of problem:

When creating VM from template, I am getting following error

15:50:31 HTTP response headers: HTTPHeaderDict({'Audit-Id': 'f19416d1-ad5a-4958-a23d-8a59721a492a', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '77f18fcd-d82e-461c-b144-4d0b0d22604a', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'b909d5d0-6fcd-4954-8cec-858e7622a419', 'Date': 'Tue, 09 Jun 2020 13:50:33 GMT', 'Content-Length': '609'})
15:50:31 HTTP response body: b'{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Internal error occurred: failed calling webhook \\"virt-template-admission.kubevirt.io\\": Post https://virt-template-validator.openshift-cnv.svc:443/virtualmachine-template-validate?timeout=30s: x509: certificate signed by unknown authority","reason":"InternalError","details":{"causes":[{"message":"failed calling webhook \\"virt-template-admission.kubevirt.io\\": Post https://virt-template-validator.openshift-cnv.svc:443/virtualmachine-template-validate?timeout=30s: x509: certificate signed by unknown authority"}]},"code":500}\n'

Here I provide logs from template validator pods

[cloud-user@ocp-ipi-2-executor ~]$ oc logs -n openshift-cnv virt-template-validator-854c69fbff-9rpgd
{"component":"kubevirt-template-validator","level":"info","msg":"kubevirt-template-validator v0.6.6 (revision: ) starting","pos":"app.go:75","timestamp":"2020-06-09T13:42:53.159415Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"kubevirt-template-validator using kubevirt client-go (v0.0.0-master+$Format:%h$ $Format:%H$ 1970-01-01T00:00:00Z)","pos":"app.go:76","timestamp":"2020-06-09T13:42:53.159615Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"certificate from /etc/webhook/certs with common name 'virt-template-validator.openshift-cnv.svc' retrieved.","pos":"tlsinfo.go:131","timestamp":"2020-06-09T13:42:53.160573Z"}
W0609 13:42:53.159754       1 client_config.go:549] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
{"component":"kubevirt-template-validator","level":"info","msg":"validator app: started informers","pos":"app.go:97","timestamp":"2020-06-09T13:42:53.187210Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"validator app: synched informers","pos":"app.go:102","timestamp":"2020-06-09T13:42:53.490365Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"validator app: running with TLSInfo.CertsDirectory/etc/webhook/certs","pos":"app.go:105","timestamp":"2020-06-09T13:42:53.490477Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"validator app: TLS configured, serving over HTTPS on 0.0.0.0:8443","pos":"app.go:113","timestamp":"2020-06-09T13:42:53.490512Z"}
I0609 13:50:33.314749       1 server.go:3055] http: TLS handshake error from 10.130.0.1:42508: remote error: tls: bad certificate
W0609 13:52:35.525695       1 reflector.go:270] github.com/fromanirh/kubevirt-template-validator/pkg/template-validator/app.go:96: watch of *v1.Template ended with: The resourceVersion for the provided watch is too old.
[cloud-user@ocp-ipi-2-executor ~]$ oc logs -n openshift-cnv virt-template-validator-854c69fbff-k6dwt
{"component":"kubevirt-template-validator","level":"info","msg":"kubevirt-template-validator v0.6.6 (revision: ) starting","pos":"app.go:75","timestamp":"2020-06-09T13:42:53.150349Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"kubevirt-template-validator using kubevirt client-go (v0.0.0-master+$Format:%h$ $Format:%H$ 1970-01-01T00:00:00Z)","pos":"app.go:76","timestamp":"2020-06-09T13:42:53.150476Z"}
W0609 13:42:53.150665       1 client_config.go:549] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
{"component":"kubevirt-template-validator","level":"info","msg":"certificate from /etc/webhook/certs with common name 'virt-template-validator.openshift-cnv.svc' retrieved.","pos":"tlsinfo.go:131","timestamp":"2020-06-09T13:42:53.153328Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"validator app: started informers","pos":"app.go:97","timestamp":"2020-06-09T13:42:53.172202Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"validator app: synched informers","pos":"app.go:102","timestamp":"2020-06-09T13:42:53.474686Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"validator app: running with TLSInfo.CertsDirectory/etc/webhook/certs","pos":"app.go:105","timestamp":"2020-06-09T13:42:53.474868Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"validator app: TLS configured, serving over HTTPS on 0.0.0.0:8443","pos":"app.go:113","timestamp":"2020-06-09T13:42:53.474953Z"}
W0609 13:52:35.539181       1 reflector.go:270] github.com/fromanirh/kubevirt-template-validator/pkg/template-validator/app.go:96: watch of *v1.Template ended with: The resourceVersion for the provided watch is too old.



Version-Release number of selected component (if applicable):
OCP-4.5
HCO v2.3.0-302


How reproducible: 100


Steps to Reproduce:
1. Deploy CNV
2. Try to create VM from template
3.

Actual results: validation of template fails on certificate error


Expected results: VM is created


Additional info:

Comment 1 Lukas Bednar 2020-06-09 19:21:50 UTC
It happens in HCO-v2.3.0-303 build too.

Comment 2 Andrej Krejcir 2020-06-10 11:39:33 UTC
The cause is that since OCP 4.4, the filename of the CA that is used has changed. I have tested this feature with OCP 4.3, so I missed it.

I'm working on a fix.

Comment 3 Lukas Bednar 2020-06-11 12:34:21 UTC
Working with HCO-v2.3.0-315

Comment 6 errata-xmlrpc 2020-07-28 19:10:31 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, 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-2020:3194


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