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

OCPBUGS-3210: Avoid processing subscription with mustnothave compliancetype #422

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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