-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-16167] Add validation API to upgrades
Summary: Added new endpoint for validation before running upgrade. Inside this api we run upgrade task with runOnlyPrechecks flag, but skip creating customer task (to avoid showing this in UI) Waiting for task to finish with timeout of 1.5 minutes and caching result for 1 minute after task is completed (or failed) Example call: ``` http://localhost:9000/api/v1/customers/f33e3c9b-75ab-4c30-80ad-cba85646ea39/universes/8466355b-db5c-4394-b361-d5f0c4a92eee/upgrade/validate_before_upgrade?upgradeType=ResizeNode ``` Possible values for upgradeType: 1. Software - Upgrade database version 2. Systemd - Upgrade to systemd 3. VMImage - Upgade linux version 4. Restart - Restart universe 5. Certs - Rotate certificates 6. ToggleTls - Edit security 7. ResizeNode - Resize node 8. Reboot - Reboot universe 9. ThirdPartyPackages - Third party packages upgrade 10. GFlags - Edit flags Payload: ``` { "taskType": "ResizeNode", "upgradeOption": "Rolling", "universeUUID": "8466355b-db5c-4394-b361-d5f0c4a92eee", "sleepAfterMasterRestartMillis": 10000, "sleepAfterTServerRestartMillis": 60000, "ybSoftwareVersion": "2.23.1.0-b220", "clusters": [ { "clusterType": "PRIMARY", "userIntent": { "instanceType": "c5d.large" } } ] } ``` Test Plan: 1) Create RF3 universe 2) Run validation for resizeNode - see OK 3) Set incorrect payload -> validation failed 4) Stop one node 5) Mark it as Live 6) Run validation -> see AreNodesToSafeDown fails 7) Disable AreNodesToSafeDown -> see CheckClusterConsistency fails 8) Set timeout to 5 secs -> see that first request fails, wait for task to complete, re-run and get result immediately Reviewers: nsingh, #yba-api-review, sneelakantan Reviewed By: nsingh, #yba-api-review, sneelakantan Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D40219
- Loading branch information
Showing
17 changed files
with
487 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...src/main/java/com/yugabyte/yw/commissioner/tasks/params/PreUpgradeValidationResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
|
||
package com.yugabyte.yw.commissioner.tasks.params; | ||
|
||
import com.yugabyte.yw.models.common.YbaApi; | ||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import lombok.Data; | ||
|
||
@Data | ||
@ApiModel(description = "Upgrade Validation Response") | ||
public class PreUpgradeValidationResponse { | ||
|
||
@ApiModelProperty( | ||
value = | ||
"WARNING: This is a preview API that could change. " | ||
+ "Indicates whether all the checks passed", | ||
accessMode = ApiModelProperty.AccessMode.READ_ONLY) | ||
@YbaApi(visibility = YbaApi.YbaApiVisibility.PREVIEW, sinceYBAVersion = "2024.2.1") | ||
private boolean success; | ||
|
||
@ApiModelProperty( | ||
value = | ||
"WARNING: This is a preview API that could change. " | ||
+ "List of errors that occurred during validation", | ||
accessMode = ApiModelProperty.AccessMode.READ_ONLY) | ||
@YbaApi(visibility = YbaApi.YbaApiVisibility.PREVIEW, sinceYBAVersion = "2024.2.1") | ||
private List<String> errors; | ||
|
||
public static PreUpgradeValidationResponse fromError(String error) { | ||
PreUpgradeValidationResponse response = new PreUpgradeValidationResponse(); | ||
response.setErrors(Collections.singletonList(error)); | ||
return response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.