Revisit Policy status, policy mode status and conditions and refactor the policy subreconciler #804
Labels
kind/tech-debt
kind/to-be-refined
status/waiting-feedback
Label to help visualize issue waiting for feedback from someone
Status
At the time of writing, the policy status is composed by
[PolicyModeStatus](https://github.com/kubewarden/kubewarden-controller/blob/a331d8d2d4ccd26396935fd9333118c85185280a/api/policies/v1/policy.go#L31)
and[PolicyStatusEnum](https://github.com/kubewarden/kubewarden-controller/blob/a331d8d2d4ccd26396935fd9333118c85185280a/api/policies/v1/policy.go#L11)
. Unfortunately this adds complexity in the reconciliation loop and it could be ambiguous for the user.Instead, we could merge
PolicyModeStatus
withPolicyStatusEnum
having two different final active statesPolicyStatusActiveMonitor
andPolicyStatusActiveProtect
.Condition
Also, we could revisit the
PolicyConditionType
. We could either remove them or refactor them to be more explicit. See: https://maelvls.dev/kubernetes-conditions/Reconciler
The policy subreconciler reconciliation loop could be simplified using the new statuses/conditions.
reconcilePolicy
and refactor thesetPolicyStatus
methods, as the first could be part of thereconcile
method and the second one does not set the policy status, but it changes the policy mode status instead. The status change is also spread in thereconcilePolicy
andreconcile
methods.reconcileErr
and return it after the status update.This is related to: #743, #616
The text was updated successfully, but these errors were encountered: