Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func isOperatorManaged(cr *v1alpha1.Console) bool {
- return cr.Spec.ManagementState == operatorsv1alpha1.Managed
- }
- func isOperatorUnmanaged(cr *v1alpha1.Console) bool {
- return cr.Spec.ManagementState == operatorsv1alpha1.Unmanaged
- }
- func isOperatorRemoved(cr *v1alpha1.Console) bool {
- return cr.Spec.ManagementState == operatorsv1alpha1.Removed
- }
- type operatorStateReactionFn func(cr *v1alpha1.Console) bool
- func ensureConsoleIsInDesiredState(client *Clientset, state operatorsv1alpha1.ManagementState) error {
- var cr *v1alpha1.Console
- var checkFunc operatorStateReactionFn
- switch state {
- case operatorsv1alpha1.Managed:
- checkFunc = isOperatorManaged(cr)
- case operatorsv1alpha1.Unmanaged:
- checkFunc = isOperatorUnmanaged(cr)
- case operatorsv1alpha1.Removed:
- checkFunc = isOperatorRemoved(cr)
- }
- cr, err = client.ConsoleV1alpha1Interface.Consoles(consoleapi.OpenShiftConsoleOperatorNamespace).Get(consoleapi.ResourceName, metav1.GetOptions{})
- return checkFunc(cr), nil
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement