Skip to content

Commit

Permalink
dale comment
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Rae Kim <yikim@redhat.com>
  • Loading branch information
yiraeChristineKim committed Apr 23, 2023
1 parent 987e512 commit 4dd9ba5
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions controllers/configurationpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1114,20 +1114,21 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi
}

if mergeMessageEnforce {
names = append([]string{}, templateObjs[indx].name)
names = []string{templateObjs[indx].name}
}

// object template enforced, already handled in handleObjects
if names == nil {
handled = true
} else {
// when multiple messages and enforce mode, it doesn't mean remediactionAction is changed
enforce = false
}

// violations for enforce configurationpolicies are already handled in handleObjects,
// so we only need to generate a violation if the remediationAction is set to inform
// Or multiple namespaces and enforce use this
if mergeMessageEnforce || (!handled && !enforce) {
if !handled && !enforce {
if !compliant {
if len(names) == 0 {
numNonCompliant++
Expand All @@ -1153,7 +1154,7 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi
}
}

if mergeMessageEnforce || (!handled && !enforce) {
if !handled && !enforce {
objData := templateIdentifier{
index: indx,
kind: kind,
Expand All @@ -1169,10 +1170,6 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi
parentStatusUpdateNeeded = true
}

if mergeMessageEnforce {
r.Recorder.Event(&plc, eventNormal, fmt.Sprintf(plcFmtStr, plc.GetName()),
convertPolicyStatusToString(&plc))
}
}
}

Expand Down Expand Up @@ -1362,7 +1359,7 @@ type templateIdentifier struct {
namespaced bool
}

// createInformStatus updates the status field for a configurationpolicy with remediationAction=inform
// createMergedStatus updates the status field for a configurationpolicy with remediationAction=inform
// based on how many compliant/noncompliant objects are found when processing the templates in the configurationpolicy
// Or multiple namespaces and enforce use this
func createMergedStatus(
Expand Down

0 comments on commit 4dd9ba5

Please sign in to comment.