Uploaded image for project: 'Red Hat Advanced Cluster Management'
  1. Red Hat Advanced Cluster Management
  2. ACM-5877

[2.8.1]Objects are pruned on templating errors

XMLWordPrintable

    • GRC Sprint 2023-08, GRC Sprint 2023-09, GRC Sprint 2023-10
    • Critical
    • No

      Deploying a enforced ConfigurationPolicy with a valid template and then updating the template to be invalid caused the created object to be pruned. (I did it with hub templates, but I'd suspect managed cluster templates would have a similar behavior.)

       

      expected:  Not perform any deletion while in this error state.

       

      2023-05-03T16:52:26.387Z	info	configuration-policy-controller	controllers/configurationpolicy_controller.go:914	An error occurred while processing hub-templates on the Hub cluster. Cannot process the policy.	{"policy": "dhaiduce", "message": "failed to parse the template JSON string {\"apiVersion\":\"policy.open-cluster-management.io/v1\",\"kind\":\"ConfigurationPolicy\",\"metadata\":{\"name\":\"dhaiduce\"},\"spec\":{\"object-templates\":[{\"complianceType\":\"musthave\",\"objectDefinition\":{\"apiVersion\":\"v1\",\"data\":{\"test\":\"{{hub with (lookup \\\"v1\\\" \\\"ConfigMap\\\" \\\"default\\\" .ManagedClusterName) -hub}}\\n  {{hub- if (empty .) -hub}}\\n    {{hub print \\\"default-value\\\" hub}}\\n  {{hub- else -hub}}\\n    {{hub (index . \\\"data\\\" \\\"endpoint-publishing-strategy\\\") hub}}{\\n  {hub- end -hub}}\\n{{hub- end hub}}\\n\"},\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"dhaiduce\",\"namespace\":\"default\"}}}],\"remediationAction\":\"inform\",\"severity\":\"low\"}}: template: tmpl:25: unexpected EOF"}
      2023-05-03T16:52:26.387Z	info	configuration-policy-controller	controllers/configurationpolicy_controller.go:805	Setting the policy to noncompliant due to a templating error	{"policy": "dhaiduce", "error": "failed to parse the template JSON string {\"apiVersion\":\"policy.open-cluster-management.io/v1\",\"kind\":\"ConfigurationPolicy\",\"metadata\":{\"name\":\"dhaiduce\"},\"spec\":{\"object-templates\":[{\"complianceType\":\"musthave\",\"objectDefinition\":{\"apiVersion\":\"v1\",\"data\":{\"test\":\"{{hub with (lookup \\\"v1\\\" \\\"ConfigMap\\\" \\\"default\\\" .ManagedClusterName) -hub}}\\n  {{hub- if (empty .) -hub}}\\n    {{hub print \\\"default-value\\\" hub}}\\n  {{hub- else -hub}}\\n    {{hub (index . \\\"data\\\" \\\"endpoint-publishing-strategy\\\") hub}}{\\n  {hub- end -hub}}\\n{{hub- end hub}}\\n\"},\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"dhaiduce\",\"namespace\":\"default\"}}}],\"remediationAction\":\"inform\",\"severity\":\"low\"}}: template: tmpl:25: unexpected EOF"}
      2023-05-03T16:52:26.387Z	info	configuration-policy-controller	controllers/configurationpolicy_controller.go:1348	Will update the policy status	{"policy": "dhaiduce", "complianceState": "NonCompliant"}
      2023-05-03T16:52:26.398Z	info	configuration-policy-controller	controllers/configurationpolicy_controller.go:604	Object successfully deleted as part of child object pruning	{"policy": "dhaiduce", "groupVersionKind": "/v1, Kind=ConfigMap"} 

       
       

              yikim@redhat.com Yi Rae Kim
              dhaiduce Dale Haiducek
              Derek Ho Derek Ho
              ACM GRC & Gatekeeper
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: