Skip to content

Commit c683847

Browse files
committed
make cert annotation collection automatic
1 parent 7e15319 commit c683847

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed

test/extended/operators/certs.go

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import (
88
"path/filepath"
99
"strings"
1010

11+
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadatadefaults"
12+
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadatainterfaces"
13+
1114
ensure_no_violation_regression "github.com/openshift/origin/pkg/cmd/update-tls-artifacts/ensure-no-violation-regression"
1215
"k8s.io/cli-runtime/pkg/genericclioptions"
1316

@@ -55,16 +58,20 @@ var _ = g.Describe("[sig-arch][Late]", func() {
5558
masters = append(masters, &nodeList.Items[i])
5659
}
5760

61+
annotationsToCollect := []string{annotations.OpenShiftComponent}
62+
for _, currRequirement := range tlsmetadatadefaults.GetDefaultTLSRequirements() {
63+
annotationRequirement, ok := currRequirement.(tlsmetadatainterfaces.AnnotationRequirement)
64+
if ok {
65+
annotationsToCollect = append(annotationsToCollect, annotationRequirement.GetAnnotationName())
66+
}
67+
}
68+
5869
currentPKIContent, err := certgraphanalysis.GatherCertsFromPlatformNamespaces(ctx, kubeClient,
5970
certgraphanalysis.SkipRevisioned,
6071
certgraphanalysis.SkipHashed,
6172
certgraphanalysis.ElideProxyCADetails,
6273
certgraphanalysis.RewriteNodeIPs(masters),
63-
certgraphanalysis.CollectAnnotations(
64-
annotations.OpenShiftComponent,
65-
annotations.OpenShiftDescription,
66-
AutoRegenerateAfterExpiryAnnotation,
67-
),
74+
certgraphanalysis.CollectAnnotations(annotationsToCollect...),
6875
)
6976
o.Expect(err).NotTo(o.HaveOccurred())
7077

@@ -172,28 +179,3 @@ var _ = g.Describe("[sig-arch][Late]", func() {
172179
})
173180

174181
})
175-
176-
// pruneSystemTrust removes certificate metadata for proxy-ca for easier visualization
177-
func pruneSystemTrust(pkiList *certgraphapi.PKIList) {
178-
for i := range pkiList.CertificateAuthorityBundles.Items {
179-
curr := pkiList.CertificateAuthorityBundles.Items[i]
180-
if curr.LogicalName != "proxy-ca" {
181-
continue
182-
}
183-
184-
if len(curr.Spec.CertificateMetadata) > 10 {
185-
pkiList.CertificateAuthorityBundles.Items[i].Name = "proxy-ca"
186-
pkiList.CertificateAuthorityBundles.Items[i].Spec.CertificateMetadata = []certgraphapi.CertKeyMetadata{
187-
{
188-
CertIdentifier: certgraphapi.CertIdentifier{
189-
CommonName: "synthetic-proxy-ca",
190-
SerialNumber: "0",
191-
Issuer: nil,
192-
},
193-
},
194-
}
195-
return
196-
}
197-
}
198-
199-
}

0 commit comments

Comments
 (0)