Skip to content

Commit 66986b4

Browse files
committed
[PLAT-17224] Create universe and Edit Read replica failing because of missing primary cluster payload
Summary: isRootCARequired requires primary cluster to be present. Test Plan: itest must pass. https://jenkins.dev.yugabyte.com/view/Dev/job/dev-itest-pipeline/1825/ Also, verified locally. The first 2 failed runs are before the change. The 3rd one (top) succeeded after the fix. {F344971} {F344972} Reviewers: anabaria, yshchetinin, anijhawan Reviewed By: anabaria, yshchetinin Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D42962
1 parent 2c0f490 commit 66986b4

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

managed/src/main/java/com/yugabyte/yw/commissioner/tasks/AddOnClusterCreate.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void run() {
6969
createPreflightNodeCheckTasks(Collections.singletonList(cluster));
7070

7171
// Add check for certificateConfig
72-
createCheckCertificateConfigTask(Collections.singletonList(cluster));
72+
createCheckCertificateConfigTask(universe, Collections.singletonList(cluster));
7373

7474
// Create the nodes.
7575
// State checking is enabled because the subtasks are not idempotent.

managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateUniverse.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public void run() {
174174
createPreflightNodeCheckTasks(taskParams().clusters);
175175

176176
// Create certificate config check tasks for on-prem nodes.
177-
createCheckCertificateConfigTask(taskParams().clusters);
177+
createCheckCertificateConfigTask(universe, taskParams().clusters);
178178

179179
// Provision the nodes.
180180
// State checking is enabled because the subtasks are not idempotent.

managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditUniverseTaskBase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected void configureTaskParams(Universe universe) {
7979
}
8080
createPreflightNodeCheckTasks(taskParams().clusters);
8181

82-
createCheckCertificateConfigTask(taskParams().clusters);
82+
createCheckCertificateConfigTask(universe, taskParams().clusters);
8383
}
8484

8585
protected void freezeUniverseInTxn(Universe universe) {

managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterCreate.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected void configureTaskParams(Universe universe) {
5555
Collection<Cluster> clusters = taskParams().getReadOnlyClusters();
5656
// Create preflight node check tasks for on-prem nodes.
5757
createPreflightNodeCheckTasks(clusters);
58-
createCheckCertificateConfigTask(clusters);
58+
createCheckCertificateConfigTask(universe, clusters);
5959
}
6060

6161
protected void freezeUniverseInTxn(Universe universe) {

managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseDefinitionTaskBase.java

+12-17
Original file line numberDiff line numberDiff line change
@@ -2208,16 +2208,6 @@ public void createPreflightNodeCheckTasks(Collection<Cluster> clusters) {
22082208
}
22092209
}
22102210

2211-
public void createCheckCertificateConfigTask(
2212-
Collection<Cluster> clusters,
2213-
Set<NodeDetails> nodes,
2214-
@Nullable UUID rootCA,
2215-
@Nullable UUID clientRootCA,
2216-
boolean enableClientToNodeEncrypt) {
2217-
createCheckCertificateConfigTask(
2218-
clusters, nodes, rootCA, clientRootCA, enableClientToNodeEncrypt, null);
2219-
}
2220-
22212211
/**
22222212
* Create preflight node check to check certificateConfig for on-prem nodes in the universe
22232213
*
@@ -2299,9 +2289,10 @@ && taskParams()
22992289
* Create check certificate config tasks for on-prem nodes in the clusters if the nodes are in
23002290
* ToBeAdded state.
23012291
*
2302-
* @param clusters the clusters
2292+
* @param universe the universe to which the clusters belong.
2293+
* @param clusters the clusters.
23032294
*/
2304-
public void createCheckCertificateConfigTask(Collection<Cluster> clusters) {
2295+
public void createCheckCertificateConfigTask(Universe universe, Collection<Cluster> clusters) {
23052296
log.info("Checking certificate config for on-prem nodes in the universe.");
23062297
Set<Cluster> onPremClusters =
23072298
clusters.stream()
@@ -2311,22 +2302,26 @@ public void createCheckCertificateConfigTask(Collection<Cluster> clusters) {
23112302
log.info("No on-prem clusters found in the universe.");
23122303
return;
23132304
}
2305+
23142306
UUID rootCA =
2315-
EncryptionInTransitUtil.isRootCARequired(taskParams()) ? taskParams().rootCA : null;
2307+
EncryptionInTransitUtil.isRootCARequired(universe.getUniverseDetails())
2308+
? taskParams().rootCA
2309+
: null;
23162310
UUID clientRootCA =
2317-
EncryptionInTransitUtil.isClientRootCARequired(taskParams())
2311+
EncryptionInTransitUtil.isClientRootCARequired(universe.getUniverseDetails())
23182312
? taskParams().getClientRootCA()
23192313
: null;
2320-
boolean enableClientToNodeEncrypt =
2321-
taskParams().getPrimaryCluster().userIntent.enableClientToNodeEncrypt;
2322-
// If both rootCA and clientRootCA are empty, then we don't need to check the certificate config
2314+
// If both rootCA and clientRootCA are empty, then we don't need to check the certificate
2315+
// config.
23232316
if (rootCA == null && clientRootCA == null) {
23242317
return;
23252318
}
23262319

23272320
Set<NodeDetails> nodesToProvision =
23282321
PlacementInfoUtil.getNodesToProvision(taskParams().nodeDetailsSet);
23292322
if (CollectionUtils.isNotEmpty(nodesToProvision)) {
2323+
boolean enableClientToNodeEncrypt =
2324+
universe.getUniverseDetails().getPrimaryCluster().userIntent.enableClientToNodeEncrypt;
23302325
createCheckCertificateConfigTask(
23312326
clusters, nodesToProvision, rootCA, clientRootCA, enableClientToNodeEncrypt, null);
23322327
}

0 commit comments

Comments
 (0)