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 preexisting operator #192

Commits on Jan 26, 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>
    JustinKuli committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    e246345 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>
    JustinKuli committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    c0ca63e 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>
    JustinKuli committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    2978f4e View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2024

  1. 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>
    JustinKuli committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    c358a12 View commit details
    Browse the repository at this point in the history