77 "os"
88 "path/filepath"
99
10+ "github.com/openshift/library-go/pkg/certs/cert-inspection/certgraphapi"
11+
1012 g "github.com/onsi/ginkgo/v2"
1113 o "github.com/onsi/gomega"
1214 "github.com/openshift/library-go/pkg/certs/cert-inspection/certgraphanalysis"
@@ -33,6 +35,10 @@ var _ = g.Describe("[sig-arch][Late]", func() {
3335 currentPKIContent , err := certgraphanalysis .GatherCertsFromPlatformNamespaces (ctx , kubeClient )
3436 o .Expect (err ).NotTo (o .HaveOccurred ())
3537
38+ // the content here is good, but proxy-ca contains a lot of entries for system-trust that doesn't help
39+ // us visualize the OCP certs, so if we detect that condition snip it
40+ pruneSystemTrust (currentPKIContent )
41+
3642 jsonBytes , err := json .MarshalIndent (currentPKIContent , "" , " " )
3743 o .Expect (err ).NotTo (o .HaveOccurred ())
3844
@@ -44,3 +50,28 @@ var _ = g.Describe("[sig-arch][Late]", func() {
4450 })
4551
4652})
53+
54+ // pruneSystemTrust removes certificate metadata for proxy-ca for easier visualization
55+ func pruneSystemTrust (pkiList * certgraphapi.PKIList ) {
56+ for i := range pkiList .CertificateAuthorityBundles .Items {
57+ curr := pkiList .CertificateAuthorityBundles .Items [i ]
58+ if curr .LogicalName != "proxy-ca" {
59+ continue
60+ }
61+
62+ if len (curr .Spec .CertificateMetadata ) > 10 {
63+ pkiList .CertificateAuthorityBundles .Items [i ].Name = "proxy-ca"
64+ pkiList .CertificateAuthorityBundles .Items [i ].Spec .CertificateMetadata = []certgraphapi.CertKeyMetadata {
65+ {
66+ CertIdentifier : certgraphapi.CertIdentifier {
67+ CommonName : "synthetic-proxy-ca" ,
68+ SerialNumber : "0" ,
69+ Issuer : nil ,
70+ },
71+ },
72+ }
73+ return
74+ }
75+ }
76+
77+ }
0 commit comments