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

Add maintenance state for customer action needed #3294

Merged
merged 66 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
b2b50c8
Add maintenance state enum
Oct 23, 2023
fe71714
Add maintenance state to cluster properties
Oct 23, 2023
46084f1
Add maintenance state to api
Oct 23, 2023
4d6288d
Add IsPUCM function
Oct 23, 2023
44ec5e7
Refactor setUpdateProvisioningState
Oct 23, 2023
3e0938c
Don't usse pucm pending bool in patch
Oct 24, 2023
3beeb32
Set ongoing maintenance state when we set admin update
Oct 24, 2023
90de9c5
Add code commetns
Oct 24, 2023
a165a31
Clear the maintenance state when done with pucm
Oct 24, 2023
46f08a3
Fix naming of funcs
Oct 24, 2023
0fa8783
Revamp mainntenance state monitoring code
Oct 24, 2023
5cd4ca1
Update comment on maintenance.go
Oct 24, 2023
7c0303c
Add none maintenance task to admin api
Oct 24, 2023
c5dd261
Remove pucm pending bool
Oct 24, 2023
73956bc
Add comment explaining maintenance tasks
Oct 24, 2023
ced133b
Update put or patch test
Oct 24, 2023
64b5046
Fix validate static.go
Oct 24, 2023
ba276be
Update monitor test
Oct 24, 2023
84ef58d
Fix IsPUCM call
Oct 24, 2023
f008e3e
Update comment
Oct 24, 2023
0c2bcf0
Fix setNoMaintenanceState
Oct 24, 2023
8a90e89
Fix openshiftcluster_convert.go
Oct 24, 2023
83aeb06
Add unit test for none task
Oct 24, 2023
b770f7c
Add '' maintenance task to IsPUCM
Oct 24, 2023
0f2953b
Fix put or patch unit test
Oct 24, 2023
2949f50
Add planned maintenance test to put or patch test
Oct 24, 2023
f187cf0
Fix bug in unplanned maintenance signal
Oct 24, 2023
4254234
Update backend unit test
Oct 24, 2023
ee480bc
Remove unneeded commentt in getPucmState
Oct 24, 2023
4140ce0
Reduce PUCM terminology usage
Oct 26, 2023
eb295fe
Rename IsPUCM() method
Oct 26, 2023
9c70cdd
Fix api doc
Oct 26, 2023
d796758
Rename emitPucmState()
Oct 26, 2023
c557dc3
Renaame getPucmState()
Oct 26, 2023
9c9625a
Rename pucmstates to maintenancestates
Oct 26, 2023
496b2e1
Remove PUCM terminology from maintenance.go
Oct 26, 2023
7de0344
Remove pucm terminology from maintenance_test
Oct 26, 2023
aabae72
Update admin update code comment
Oct 26, 2023
f39e2e6
Reduce pucm terminology in put/patch test
Oct 26, 2023
3544d85
Update maintenance task comment
Oct 26, 2023
ed2a6d0
Update validate static
Oct 26, 2023
d71164f
Update code comment
Oct 26, 2023
c42a27e
Rename pucm pending maintenannce task
Oct 26, 2023
e2bc595
Update pending task
Nov 1, 2023
359108d
Merge branch 'master' into niontive/rhc-bugs
Nov 27, 2023
537a710
Add more test cases
Nov 27, 2023
e817392
Revert "Add more test cases"
Nov 27, 2023
bb3f6f1
Add more unit tests
Nov 28, 2023
4d7e790
fix unit test
Nov 28, 2023
eb86134
Merge branch 'master' into niontive/rhc-bugs
Nov 28, 2023
14b246c
Add const maintenance state customer action needed
Nov 29, 2023
fb40496
Add maintenance task for customer action needed
Nov 29, 2023
1ae9932
add comment re removing customer action signal
Nov 29, 2023
8323156
Add customer action task to prov state func
Nov 29, 2023
3b52ce5
Update validate static
Nov 29, 2023
dd15464
Add unit test for failed planned maintenance
Nov 29, 2023
6056aa6
Fix unit test
Nov 29, 2023
1c71180
Fix tesT
Nov 29, 2023
c802790
mimic test in openshiftcluster.go
Nov 29, 2023
27079d0
Add test for unplanned maintenance customer action
Nov 29, 2023
5b3cd42
Resest last admin update error if customer took action
Nov 29, 2023
e79e6d1
Add test to transition to none state
Nov 29, 2023
09981f8
Add metric
Nov 29, 2023
4b0e12d
Update unit test
Nov 29, 2023
5125c2d
Don't reset last admin update err
Nov 29, 2023
b82d85f
Add unit test for customer action needed to unplanned ongoing
Dec 15, 2023
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
25 changes: 19 additions & 6 deletions pkg/api/admin/openshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,37 @@ const (
type MaintenanceState string

const (
MaintenanceStateNone MaintenanceState = "None"
MaintenanceStatePending MaintenanceState = "Pending"
MaintenanceStatePlanned MaintenanceState = "Planned"
MaintenanceStateUnplanned MaintenanceState = "Unplanned"
MaintenanceStateNone MaintenanceState = "None"
MaintenanceStatePending MaintenanceState = "Pending"
MaintenanceStatePlanned MaintenanceState = "Planned"
MaintenanceStateUnplanned MaintenanceState = "Unplanned"
MaintenanceStateCustomerActionNeeded MaintenanceState = "CustomerActionNeeded"
)

type MaintenanceTask string

const (
//
// Maintenance tasks that perform work on the cluster
//

MaintenanceTaskEverything MaintenanceTask = "Everything"
MaintenanceTaskOperator MaintenanceTask = "OperatorUpdate"
MaintenanceTaskRenewCerts MaintenanceTask = "CertificatesRenewal"

//
// Maintenance tasks for updating customer maintenance signals
//

MaintenanceTaskPending MaintenanceTask = "Pending"

// None signal should only be used when (1) admin update fails and (2) SRE fixes the failed admin update without running another admin updates
// Admin update success should automatically set the cluster into None state
MaintenanceTaskPending MaintenanceTask = "Pending"
MaintenanceTaskNone MaintenanceTask = "None"
MaintenanceTaskNone MaintenanceTask = "None"

// Customer action needed signal should only be used when (1) admin update fails and (2) customer needs to take action to resolve the failure
// To remove the signal after customer takes action, use maintenance task None
MaintenanceTaskCustomerActionNeeded MaintenanceTask = "CustomerActionNeeded"
)

// Operator feature flags
Expand Down
3 changes: 2 additions & 1 deletion pkg/api/admin/openshiftcluster_validatestatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func validateMaintenanceTask(task MaintenanceTask) error {
task == MaintenanceTaskOperator ||
task == MaintenanceTaskRenewCerts ||
task == MaintenanceTaskPending ||
task == MaintenanceTaskNone) {
task == MaintenanceTaskNone ||
task == MaintenanceTaskCustomerActionNeeded) {
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "properties.maintenanceTask", "Invalid enum parameter.")
}

Expand Down
13 changes: 13 additions & 0 deletions pkg/api/admin/openshiftcluster_validatestatic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,19 @@ func TestOpenShiftClusterStaticValidateDelta(t *testing.T) {
oc.Properties.MaintenanceTask = ""
},
},
{
name: "maintenanceTask change to customer action needed allowed",
oc: func() *OpenShiftCluster {
return &OpenShiftCluster{
Properties: OpenShiftClusterProperties{
MaintenanceTask: MaintenanceTaskCustomerActionNeeded,
},
}
},
modify: func(oc *OpenShiftCluster) {
oc.Properties.MaintenanceTask = ""
},
},
{
name: "maintenanceTask change to other values is disallowed",
oc: func() *OpenShiftCluster {
Expand Down
25 changes: 19 additions & 6 deletions pkg/api/openshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,37 @@ const (
type MaintenanceState string

const (
MaintenanceStateNone MaintenanceState = "None"
MaintenanceStatePending MaintenanceState = "Pending"
MaintenanceStatePlanned MaintenanceState = "Planned"
MaintenanceStateUnplanned MaintenanceState = "Unplanned"
MaintenanceStateNone MaintenanceState = "None"
MaintenanceStatePending MaintenanceState = "Pending"
MaintenanceStatePlanned MaintenanceState = "Planned"
MaintenanceStateUnplanned MaintenanceState = "Unplanned"
MaintenanceStateCustomerActionNeeded MaintenanceState = "CustomerActionNeeded"
)

type MaintenanceTask string

const (
//
// Maintenance tasks that perform work on the cluster
//

MaintenanceTaskEverything MaintenanceTask = "Everything"
MaintenanceTaskOperator MaintenanceTask = "OperatorUpdate"
MaintenanceTaskRenewCerts MaintenanceTask = "CertificatesRenewal"

//
// Maintenance tasks for updating customer maintenance signals
//

MaintenanceTaskPending MaintenanceTask = "Pending"

// None signal should only be used when (1) admin update fails and (2) SRE fixes the failed admin update without running another admin updates
// Admin update success should automatically set the cluster into None state
MaintenanceTaskPending MaintenanceTask = "Pending"
MaintenanceTaskNone MaintenanceTask = "None"
MaintenanceTaskNone MaintenanceTask = "None"

// Customer action needed signal should only be used when (1) admin update fails and (2) customer needs to take action to resolve the failure
// To remove the signal after customer takes action, use maintenance task None
MaintenanceTaskCustomerActionNeeded MaintenanceTask = "CustomerActionNeeded"
)

// IsMaintenanceOngoingTask returns true if the maintenance task should change state to maintenance ongoing (planned/unplanned)
Expand Down
2 changes: 2 additions & 0 deletions pkg/frontend/openshiftcluster_putorpatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ func adminUpdateProvisioningState(doc *api.OpenShiftClusterDocument) {
doc.OpenShiftCluster.Properties.MaintenanceState = api.MaintenanceStatePending
case api.MaintenanceTaskNone:
doc.OpenShiftCluster.Properties.MaintenanceState = api.MaintenanceStateNone
case api.MaintenanceTaskCustomerActionNeeded:
doc.OpenShiftCluster.Properties.MaintenanceState = api.MaintenanceStateCustomerActionNeeded
}

// This enables future admin update actions with body `{}` to succeed
Expand Down
Loading
Loading