Skip to content

Bug 1813146: set Upgradeable False when in Managed state #72

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,14 @@ func (c ServiceCatalogControllerManagerOperator) sync() error {
}
}

v1helpers.SetOperatorCondition(&operatorConfig.Status.Conditions, operatorapiv1.OperatorCondition{
Type: operatorapiv1.OperatorStatusTypeUpgradeable,
Status: operatorapiv1.ConditionTrue,
Reason: "",
Message: "",
})

switch operatorConfig.Spec.ManagementState {
case operatorapiv1.Managed:
// redundant but it makes reading this switch later more clear
break
v1helpers.SetOperatorCondition(&operatorConfig.Status.Conditions, operatorapiv1.OperatorCondition{
Type: operatorapiv1.OperatorStatusTypeUpgradeable,
Status: operatorapiv1.ConditionFalse,
Reason: "Managed",
Message: "the controller manager is in a managed state, upgrades are not possible.",
})
case operatorapiv1.Unmanaged:
// manage status
originalOperatorConfig := operatorConfig.DeepCopy()
Expand All @@ -143,6 +140,12 @@ func (c ServiceCatalogControllerManagerOperator) sync() error {
Reason: "Unmanaged",
Message: "the controller manager is in an unmanaged state, therefore no operator actions are failing.",
})
v1helpers.SetOperatorCondition(&operatorConfig.Status.Conditions, operatorapiv1.OperatorCondition{
Type: operatorapiv1.OperatorStatusTypeUpgradeable,
Status: operatorapiv1.ConditionTrue,
Reason: "Unmanaged",
Message: "the controller manager is in an unmanaged state, upgrades are possible.",
})

if !equality.Semantic.DeepEqual(operatorConfig.Status, originalOperatorConfig.Status) {
if _, err := c.operatorConfigClient.ServiceCatalogControllerManagers().UpdateStatus(operatorConfig); err != nil {
Expand Down Expand Up @@ -177,6 +180,12 @@ func (c ServiceCatalogControllerManagerOperator) sync() error {
Reason: "Removed",
Message: "",
})
v1helpers.SetOperatorCondition(&operatorConfig.Status.Conditions, operatorapiv1.OperatorCondition{
Type: operatorapiv1.OperatorStatusTypeUpgradeable,
Status: operatorapiv1.ConditionTrue,
Reason: "Removed",
Message: "the controller manager is in a removed state, upgrades are possible.",
})

// The version must be reported even though the operand is not running
operatorConfig.Status.Version = os.Getenv("RELEASE_VERSION")
Expand Down