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

🤖 Sync from open-cluster-management-io/config-policy-controller: #192 #695

Closed
wants to merge 4 commits into from

Commits on Jan 31, 2024

  1. Add helpers for some enums

    ComplianceType and RemediationActions were previously checked inline
    with string comparisons. This is more easily readable, and potentially
    better able to be changed in the future.
    
    Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
    (cherry picked from commit e6deab6)
    JustinKuli authored and Magic Mirror committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    e3b1f5c View commit details
    Browse the repository at this point in the history
  2. Update OperatorPolicy types

    It was decided to use RawExtension for the "embedded" Subscription and
    OperatorGroup, this can better allow for possible version skew in the
    future. The CRD validation would be limited inside the policy framework
    anyway because in a Policy, the raw content has no validation.
    
    This also removes some fields which are not expected to be functional
    in the initial release.
    
    The `build*` functions have been updated to use the RawExtension, and
    may have been adjusted for some other incoming changes. Some other
    temporary changes were made to resolve compilation errors and unit
    tests, but the OperatorPolicy "e2e" tests were not considered.
    
    Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
    (cherry picked from commit 362ca28)
    JustinKuli authored and Magic Mirror committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    30ed05d View commit details
    Browse the repository at this point in the history
  3. Adjust test helper for owned objects

    The previous version of this function was only applicable to a Policy
    owning a ConfigurationPolicy. Now it is more broadly applicable.
    
    Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
    (cherry picked from commit 7ef6c39)
    JustinKuli authored and Magic Mirror committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    c9fb0e1 View commit details
    Browse the repository at this point in the history
  4. Handle situations when operators were preinstalled

    The general plan is to continue adding `handle*` functions for the other
    resources that an OperatorPolicy needs to examine. Each handle function
    will update the policy's status (with conditions and relatedObjects),
    and possibly emit compliance events. This may cause more compliance
    events "than usual" compared to other controllers, but I think the
    separation of concerns will help each function be more maintainable.
    
    My hope is that some of the `*Cond` and `*Obj` functions in the status
    section can be reused in the future handlers. There was already overlap
    between the Subscription and OperatorGroup, so this seemed reasonable.
    
    To check if the Subscription/OperatorGroup on the cluster matches what
    is desired by the policy, a function `handleKeys` was created that
    can be used for OperatorPolicies and ConfigurationPolicies.
    
    Refs:
     - https://issues.redhat.com/browse/ACM-9283
    
    Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
    (cherry picked from commit 56ace86)
    JustinKuli authored and Magic Mirror committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    ac25880 View commit details
    Browse the repository at this point in the history