Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove confusing Undetermined compliance state #85

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions controllers/configurationpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,7 @@ func (r *ConfigurationPolicyReconciler) addForUpdate(policy *policyv1.Configurat
if policy.ObjectMeta.DeletionTimestamp != nil {
policy.Status.ComplianceState = policyv1.Terminating
} else if len(policy.Status.CompliancyDetails) == 0 {
policy.Status.ComplianceState = "Undetermined"
policy.Status.ComplianceState = policyv1.UnknownCompliancy
} else if compliant {
policy.Status.ComplianceState = policyv1.Compliant
} else {
Expand Down Expand Up @@ -2443,7 +2443,7 @@ func (r *ConfigurationPolicyReconciler) updatePolicyStatus(
policy *policyv1.ConfigurationPolicy,
sendEvent bool,
) (*policyv1.ConfigurationPolicy, error) {
if policy.Status.ComplianceState != "Undetermined" && sendEvent {
if sendEvent {
log.V(1).Info("Sending parent policy compliance event")

// If the compliance event can't be created, then don't update the ConfigurationPolicy
Expand Down Expand Up @@ -2516,7 +2516,7 @@ func (r *ConfigurationPolicyReconciler) sendComplianceEvent(instance *policyv1.C
ReportingInstance: r.InstanceName,
}

if instance.Status.ComplianceState == policyv1.NonCompliant {
if instance.Status.ComplianceState != policyv1.Compliant {
event.Type = "Warning"
}

Expand All @@ -2528,8 +2528,8 @@ func (r *ConfigurationPolicyReconciler) sendComplianceEvent(instance *policyv1.C

// convertPolicyStatusToString to be able to pass the status as event
func convertPolicyStatusToString(plc *policyv1.ConfigurationPolicy) (results string) {
if plc.Status.ComplianceState == "" {
return "ComplianceState is still undetermined"
if plc.Status.ComplianceState == "" || plc.Status.ComplianceState == policyv1.UnknownCompliancy {
return "ComplianceState is still unknown"
}

result := string(plc.Status.ComplianceState)
Expand Down