Skip to content

Commit

Permalink
Avoid processing subscription with mustnothave compliancetype (#422)
Browse files Browse the repository at this point in the history
If compliancetype of an object is mustnothave it won't be added to
ManagedPolicyContent, so controller won't try to approve installplan
for it.

Signed-off-by: Saeid Askari <saskari@redhat.com>
  • Loading branch information
sudomakeinstall2 committed Feb 2, 2023
1 parent f904f0a commit bdd0a76
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/monitoring.go
Expand Up @@ -77,6 +77,12 @@ func (r *ClusterGroupUpgradeReconciler) getMonitoredObjects(managedPolicy *unstr
objectTemplatesContent := objectTemplates.([]interface{})
for _, objectTemplate := range objectTemplatesContent {
objectTemplateContent := objectTemplate.(map[string]interface{})
if objectTemplateContent["complianceType"] == "mustnothave" {
r.Log.Info(
"[getMonitoredObjects] skipping object because compliance type is mustnothave",
"policyName", managedPolicyName)
continue
}
innerObjectDefinition := objectTemplateContent["objectDefinition"]
if innerObjectDefinition == nil {
return nil, fmt.Errorf("policy %s is missing its spec.policy-templates.objectDefinition.spec.object-templates.objectDefinition", managedPolicyName)
Expand Down

0 comments on commit bdd0a76

Please sign in to comment.