Skip to content

Commit

Permalink
Remove the tech preview compliance history API integration
Browse files Browse the repository at this point in the history
Relates:
https://issues.redhat.com/browse/ACM-15291

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
  • Loading branch information
mprahl authored and openshift-merge-bot[bot] committed Nov 5, 2024
1 parent c1284b7 commit 95478d1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 40 deletions.
17 changes: 0 additions & 17 deletions controllers/certificatepolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const (
certNameLabel = "certificate-name"
certManagerNameLabel = "certmanager.k8s.io/certificate-name"
ControllerName = "certificate-policy-controller"
PolicyDBIDAnnotation = "policy.open-cluster-management.io/policy-compliance-db-id"
ParentDBIDAnnotation = "policy.open-cluster-management.io/parent-policy-compliance-db-id"
)

var (
Expand Down Expand Up @@ -665,21 +663,6 @@ func (r *CertificatePolicyReconciler) sendComplianceEvent(ctx context.Context,
ReportingInstance: r.InstanceName,
}

eventAnnotations := map[string]string{}

instanceAnnotations := instance.GetAnnotations()
if instanceAnnotations[ParentDBIDAnnotation] != "" {
eventAnnotations[ParentDBIDAnnotation] = instanceAnnotations[ParentDBIDAnnotation]
}

if instanceAnnotations[PolicyDBIDAnnotation] != "" {
eventAnnotations[PolicyDBIDAnnotation] = instanceAnnotations[PolicyDBIDAnnotation]
}

if len(eventAnnotations) > 0 {
event.Annotations = eventAnnotations
}

if instance.Status.ComplianceState == policyv1.NonCompliant {
event.Type = "Warning"
}
Expand Down
18 changes: 0 additions & 18 deletions test/e2e/case1_expiration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"

"open-cluster-management.io/cert-policy-controller/controllers"
"open-cluster-management.io/cert-policy-controller/test/utils"
)

Expand Down Expand Up @@ -179,21 +178,4 @@ var _ = DescribeTableSubtree("Test certificate policy expiration", Ordered, func
return utils.GetComplianceState(managedPlc)
}, defaultTimeoutSeconds, 1).Should(Equal("Compliant"))
})
It("should have the database IDs on the events", func(ctx context.Context) {
eventList, err := clientManaged.CoreV1().Events(testNamespaceLocal).List(
ctx, metav1.ListOptions{FieldSelector: "involvedObject.name=policy-cert-expiration"},
)
Expect(err).ToNot(HaveOccurred())

Expect(eventList.Items).ToNot(BeEmpty())

for _, event := range eventList.Items {
if event.Action != "ComplianceStateUpdate" {
continue
}

Expect(event.Annotations[controllers.ParentDBIDAnnotation]).To(Equal("3"))
Expect(event.Annotations[controllers.PolicyDBIDAnnotation]).To(Equal("5"))
}
})
}, Entry("Test with default testNamespace", ""), Entry("Test with "+ocmPolicyNs, ocmPolicyNs))
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ apiVersion: policy.open-cluster-management.io/v1
kind: CertificatePolicy # cert management expiration
metadata:
name: policy-cert-expiration
annotations:
policy.open-cluster-management.io/parent-policy-compliance-db-id: "3"
policy.open-cluster-management.io/policy-compliance-db-id: "5"
spec:
namespaceSelector:
include: ["default"]
Expand Down
2 changes: 0 additions & 2 deletions test/resources/case1_certificate/case1_parent_policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
name: policy-cert-expiration
annotations:
policy.open-cluster-management.io/parent-policy-compliance-db-id: "3"
spec:
remediationAction: enforce
disabled: false
Expand Down

0 comments on commit 95478d1

Please sign in to comment.