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

Handle template errors better #136

Commits on Apr 24, 2024

  1. Handle hub template errors

    The plan is to add template support to more policy types. Currently it
    is restricted to ConfigurationPolicies. This removes that restriction
    and reports hub template errors that would be added by the propagator,
    so that each policy controller does not need to duplicate the logic to
    emit those events themselves.
    
    Refs:
     - https://issues.redhat.com/browse/ACM-10858
    
    Signed-off-by: Justin Kulikauskas <[email protected]>
    JustinKuli committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    8753246 View commit details
    Browse the repository at this point in the history
  2. Adjust template-sync event filter

    The compliance events emitted by the template-sync controller should
    have priority over any created by the policy controllers. For example,
    in the past we had issues where a "late" compliance event from a
    controller would override the Pending status of a policy, and there are
    other template-error statuses that are emitted by the template-sync
    which could have the same situation. To ensure that a template-sync event
    is always emitted after a different compliance event, this controller
    should reconcile in more situations.
    
    Note that it might seem better if the template-sync controller removed
    the templates that have had an error, but in the case of
    ConfigurationPolicy, removing it can cause undesirable side-effects due
    to PruneObjectBehavior.
    
    Refs:
     - https://issues.redhat.com/browse/ACM-10858
    
    Signed-off-by: Justin Kulikauskas <[email protected]>
    JustinKuli committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    7f28535 View commit details
    Browse the repository at this point in the history
  3. Set template-error on correct details item

    When adding a template-error to the status for a template that can't be
    decoded, the status-sync was incorrectly appending to the details array
    twice. So for something that would be called "template-0", the 0th item
    in the details array would be almost empty, and the 1st item would have
    all of the status events. This was causing some events to be emitted
    repeatedly, since the template-sync logic to prevent this was looking at
    the 0th item, which would never get the event.
    
    This commit also cleans up some awkward pointer gymnastics.
    
    Signed-off-by: Justin Kulikauskas <[email protected]>
    JustinKuli committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    71f82dc View commit details
    Browse the repository at this point in the history
  4. Refresh status before emitting a template event

    This should help reduce some duplication of status events, but it might
    not fully prevent it.
    
    Signed-off-by: Justin Kulikauskas <[email protected]>
    JustinKuli committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    9badf5d View commit details
    Browse the repository at this point in the history
  5. Loosen some event duplication test requirements

    With the template-sync now reconciling more often (there are no longer
    any cases where the reconcile can be skipped), some event duplication
    might be unavoidable.
    
    Signed-off-by: Justin Kulikauskas <[email protected]>
    JustinKuli committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    3aac660 View commit details
    Browse the repository at this point in the history