From c0fcd57edad9a0a3c2015a980de13760c5519777 Mon Sep 17 00:00:00 2001 From: Bhavin Gandhi Date: Thu, 8 Apr 2021 15:13:39 +0530 Subject: [PATCH] [Platform] Add API for suggested Kubernetes provider configuration - This API tries to fetch the details which can be used to pre-fill the data during Kubernetes provider creation (should work on OpenShift or Tanzu as well). The returned JSON is similar to what we use for the create call. Please refer this issue for more details: https://github.com/yugabyte/yugabyte-db/issues/7394 - Use blank string for KUBECONFIG if kubeconfig file is not provided. This allows us to in-cluster credentials (ServiceAccount) when running in the same cluster as of the target cluster. Can be used to simplify the current flow later, we won't need a separate kubeconfig in that case. - Finds out the region and AZ based on node annotations. - Takes the pull secret name and the storage class name from app config. Scenarios tested: - Ran platform inside Kubernetes, curl the API, it returns the expected JSON. - Tested all the failure scenarios like missing config, no permissions to get secret, nodes etc. This PR is backend part for the #7394 Signed-off-by: Bhavin Gandhi --- managed/build.sbt | 3 +- .../subtasks/KubernetesCommandExecutor.java | 2 + .../yugabyte/yw/common/KubernetesManager.java | 46 + .../controllers/CloudProviderController.java | 134 +- .../src/main/resources/application.test.conf | 2 + managed/src/main/resources/swagger.json | 2594 +++++++++-------- managed/src/main/resources/v1.routes | 1 + .../yw/common/KubernetesManagerTest.java | 28 + .../CloudProviderControllerTest.java | 110 + 9 files changed, 1672 insertions(+), 1248 deletions(-) diff --git a/managed/build.sbt b/managed/build.sbt index 69bd85a86e2e..be10f32bdb1e 100644 --- a/managed/build.sbt +++ b/managed/build.sbt @@ -168,7 +168,8 @@ libraryDependencies ++= Seq( "com.fasterxml.jackson.core" % "jackson-core" % "2.10.5", "com.jayway.jsonpath" % "json-path" % "2.4.0", "commons-io" % "commons-io" % "2.8.0", - "commons-codec" % "commons-codec" % "1.15" + "commons-codec" % "commons-codec" % "1.15", + "org.apache.commons" % "commons-collections4" % "4.4" ) // Clear default resolvers. appResolvers := None diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCommandExecutor.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCommandExecutor.java index 198c002126c5..ddfad519633e 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCommandExecutor.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCommandExecutor.java @@ -174,6 +174,8 @@ public void run() { String pullSecret = this.getPullSecret(); if (pullSecret != null) { response = kubernetesManager.applySecret(config, taskParams().namespace, pullSecret); + } else { + LOG.debug("Pull secret is missing, skipping the pull secret creation."); } break; case HELM_INSTALL: diff --git a/managed/src/main/java/com/yugabyte/yw/common/KubernetesManager.java b/managed/src/main/java/com/yugabyte/yw/common/KubernetesManager.java index acf149af0a82..42d281723e4a 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/KubernetesManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/KubernetesManager.java @@ -2,13 +2,17 @@ package com.yugabyte.yw.common; +import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import com.google.inject.Inject; +import com.yugabyte.yw.common.Util; import com.yugabyte.yw.models.Provider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Singleton; + +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; @@ -136,6 +140,48 @@ public ShellResponse getServiceIPs( return execCommand(config, commandList); } + public JsonNode getNodeInfos(Map config) { + ShellResponse response = runGetNodeInfos(config); + if (response.code != 0) { + String msg = "Unable to get node information"; + if (!response.message.isEmpty()) { + msg = String.format("%s: %s", msg, response.message); + } + throw new RuntimeException(msg); + } + return Util.convertStringToJson(response.message); + } + + public ShellResponse runGetNodeInfos(Map config) { + List commandList = ImmutableList.of("kubectl", "get", "nodes", "-o", "json"); + return execCommand(config, commandList); + } + + public JsonNode getSecret(Map config, String secretName, String namespace) { + ShellResponse response = runGetSecret(config, secretName, namespace); + if (response.code != 0) { + String msg = "Unable to get secret"; + if (!response.message.isEmpty()) { + msg = String.format("%s: %s", msg, response.message); + } + throw new RuntimeException(msg); + } + return Util.convertStringToJson(response.message); + } + + // TODO: disable the logging of stdout of this command if possibile, + // as it just leaks the secret content in the logs at DEBUG level. + public ShellResponse runGetSecret( + Map config, String secretName, String namespace) { + List commandList = new ArrayList(); + commandList.addAll(ImmutableList.of("kubectl", "get", "secret", secretName, "-o", "json")); + if (namespace != null) { + commandList.add("--namespace"); + commandList.add(namespace); + } + return execCommand(config, commandList); + } + public ShellResponse helmUpgrade( Map config, String universePrefix, String namespace, String overridesFile) { String helmPackagePath = appConfig.getString("yb.helm.package"); diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderController.java b/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderController.java index ad1f5f165b85..067d636864ce 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderController.java @@ -4,7 +4,10 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.inject.Inject; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableList; import com.typesafe.config.Config; import com.yugabyte.yw.cloud.AWSInitializer; import com.yugabyte.yw.cloud.AZUInitializer; @@ -26,6 +29,8 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections4.MultiValuedMap; +import org.apache.commons.collections4.multimap.HashSetValuedHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.api.Play; @@ -84,6 +89,10 @@ public CloudProviderController(Config config) { @Inject CloudAPI.Factory cloudAPIFactory; + @Inject KubernetesManager kubernetesManager; + + @Inject play.Configuration appConfig; + /** * GET endpoint for listing providers * @@ -216,7 +225,8 @@ public Result createKubernetes(UUID customerUUID) throws IOException { throw new YWServiceException(BAD_REQUEST, "Kubeconfig can't be at two levels"); } } else if (!hasConfig) { - throw new YWServiceException(BAD_REQUEST, "No Kubeconfig found for zone(s)"); + LOG.warn( + "No Kubeconfig found at any level, in-cluster service account credentials will be used."); } } } @@ -238,7 +248,10 @@ public Result createKubernetes(UUID customerUUID) throws IOException { Map zoneConfig = zd.config; AvailabilityZone az = AvailabilityZone.create(region, zd.code, zd.name, null); boolean isConfigInZone = updateKubeConfig(provider, region, az, zoneConfig, false); - if (isConfigInZone) {} + if (!(isConfigInProvider || isConfigInRegion || isConfigInZone)) { + // Use in-cluster ServiceAccount credentials + az.setConfig(ImmutableMap.of("KUBECONFIG", "")); + } } } try { @@ -378,6 +391,123 @@ private void createKubernetesInstanceTypes(Provider provider, UUID customerUUID) } } + // Performs discovery of region, zones, pull secret, storageClass + // when running inside a Kubernetes cluster. Returns the discovered + // information as a JSON, which is similar to the one which is + // passed to the createKubernetes method. + @ApiOperation( + value = "getSuggestedKubernetesConfigs", + response = KubernetesProviderFormData.class) + public Result getSuggestedKubernetesConfigs(UUID customerUUID) { + try { + MultiValuedMap regionToAZ = getKubernetesRegionToZoneInfo(); + if (regionToAZ.isEmpty()) { + LOG.info( + "No regions and zones found, check if the region and zone labels are present on the nodes. https://k8s.io/docs/reference/labels-annotations-taints/"); + throw new YWServiceException( + INTERNAL_SERVER_ERROR, "No region and zone information found."); + } + + String storageClass = appConfig.getString("yb.kubernetes.storageClass"); + String pullSecretName = appConfig.getString("yb.kubernetes.pullSecretName"); + if (storageClass == null || pullSecretName == null) { + LOG.error("Required configuration keys from yb.kubernetes.* are missing."); + throw new YWServiceException(INTERNAL_SERVER_ERROR, "Required configuration is missing."); + } + String pullSecretContent = getKubernetesPullSecretContent(pullSecretName); + + KubernetesProviderFormData formData = new KubernetesProviderFormData(); + formData.code = Common.CloudType.kubernetes; + if (pullSecretContent != null) { + formData.config = + ImmutableMap.of( + "KUBECONFIG_IMAGE_PULL_SECRET_NAME", pullSecretName, + "KUBECONFIG_PULL_SECRET_NAME", pullSecretName, // filename + "KUBECONFIG_PULL_SECRET_CONTENT", pullSecretContent); + } + + for (String region : regionToAZ.keySet()) { + RegionData regionData = new RegionData(); + regionData.code = region; + for (String az : regionToAZ.get(region)) { + ZoneData zoneData = new ZoneData(); + zoneData.code = az; + zoneData.name = az; + zoneData.config = ImmutableMap.of("STORAGE_CLASS", storageClass); + regionData.zoneList.add(zoneData); + } + formData.regionList.add(regionData); + } + + ObjectMapper mapper = new ObjectMapper(); + return ApiResponse.success(mapper.valueToTree(formData)); + } catch (RuntimeException e) { + throw new YWServiceException(INTERNAL_SERVER_ERROR, e.getMessage()); + } + } + + // Performs region and zone discovery based on + // topology/failure-domain labels from the Kubernetes nodes. + private MultiValuedMap getKubernetesRegionToZoneInfo() { + JsonNode nodeInfos = kubernetesManager.getNodeInfos(null); + MultiValuedMap regionToAZ = new HashSetValuedHashMap<>(); + for (JsonNode nodeInfo : nodeInfos.path("items")) { + JsonNode nodeLabels = nodeInfo.path("metadata").path("labels"); + // failure-domain.beta.k8s.io is deprecated as of 1.17 + String region = nodeLabels.path("topology.kubernetes.io/region").asText(); + region = + region.isEmpty() + ? nodeLabels.path("failure-domain.beta.kubernetes.io/region").asText() + : region; + String zone = nodeLabels.path("topology.kubernetes.io/zone").asText(); + zone = + zone.isEmpty() + ? nodeLabels.path("failure-domain.beta.kubernetes.io/zone").asText() + : zone; + if (region.isEmpty() || zone.isEmpty()) { + LOG.debug( + "Value of the zone or region label is empty for " + + nodeInfo.path("metadata").path("name").asText() + + ", skipping."); + continue; + } + regionToAZ.put(region, zone); + } + return regionToAZ; + } + + // Fetches the secret secretName from current namespace, removes + // extra metadata and returns the secret as JSON string. Returns + // null if the secret is not present. + private String getKubernetesPullSecretContent(String secretName) { + JsonNode pullSecretJson; + try { + pullSecretJson = kubernetesManager.getSecret(null, secretName, null); + } catch (RuntimeException e) { + if (e.getMessage().contains("Error from server (NotFound): secrets")) { + LOG.debug( + "The pull secret " + secretName + " is not present, provider won't have this field."); + return null; + } + throw new RuntimeException("Unable to fetch the pull secret."); + } + JsonNode secretMetadata = pullSecretJson.get("metadata"); + if (secretMetadata == null) { + LOG.error( + "metadata of the pull secret " + secretName + " is missing. This should never happen."); + throw new RuntimeException("Error while fetching the pull secret."); + } + ((ObjectNode) secretMetadata) + .remove( + ImmutableList.of( + "namespace", "uid", "selfLink", "creationTimestamp", "resourceVersion")); + JsonNode secretAnnotations = secretMetadata.get("annotations"); + if (secretAnnotations != null) { + ((ObjectNode) secretAnnotations).remove("kubectl.kubernetes.io/last-applied-configuration"); + } + return pullSecretJson.toString(); + } + // TODO: This is temporary endpoint, so we can setup docker, will move this // to standard provider bootstrap route soon. public Result setupDocker(UUID customerUUID) { diff --git a/managed/src/main/resources/application.test.conf b/managed/src/main/resources/application.test.conf index e11a5eea2761..4bfc230b2d5d 100644 --- a/managed/src/main/resources/application.test.conf +++ b/managed/src/main/resources/application.test.conf @@ -16,6 +16,8 @@ yb { # Keep more frequent gc runs in non-prod to catch any bugs: taskGC.gc_check_interval = 1 hour taskGC.task_retention_duration = 5 days + kubernetes.storageClass = "ssd-class" + kubernetes.pullSecretName = "pull-sec" } ebean { diff --git a/managed/src/main/resources/swagger.json b/managed/src/main/resources/swagger.json index b733c7309666..8420aac0b878 100644 --- a/managed/src/main/resources/swagger.json +++ b/managed/src/main/resources/swagger.json @@ -16,21 +16,20 @@ "host" : "localhost", "basePath" : "/", "tags" : [ { - "name" : "Region" - }, { "name" : "Universe" }, { "name" : "RuntimeConfig" }, { "name" : "Provider" + }, { + "name" : "Region" } ], "paths" : { - "/api/v1/customers/{cUUID}/regions" : { - "get" : { - "tags" : [ "Region" ], - "summary" : "list all Regions across all providers", + "/api/v1/customers/{cUUID}/universes/import" : { + "post" : { + "summary" : "import", "description" : "", - "operationId" : "listAllRegions", + "operationId" : "importUniverse", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -42,35 +41,49 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Region" - } + "type" : "object" } } } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}" : { - "delete" : { - "tags" : [ "Region" ], - "summary" : "delete", - "description" : "", - "operationId" : "delete", + "/api/v1/customers/{cUUID}/universe_configure" : { + "post" : { + "tags" : [ "Universe" ], + "summary" : "configure the universe parameters", + "description" : "This API builds the new universe definition task parameters by merging the input UserIntent with the current taskParams and returns the resulting task parameters in a serialized form", + "operationId" : "configure", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "pUUID", + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/UniverseDefinitionTaskParams" + } + } + } + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/set_key" : { + "post" : { + "tags" : [ "Universe" ], + "summary" : "setUniverse", + "description" : "", + "operationId" : "setUniverseKey", + "parameters" : [ { + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "name" : "rUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", @@ -80,18 +93,16 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/UniverseResp" } } } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/regions" : { + "/api/v1/customers/{cUUID}/universes/find/{universeName}" : { "get" : { - "tags" : [ "Region" ], - "summary" : "list Regions for a specific provider", - "description" : "", - "operationId" : "list", + "tags" : [ "Universe" ], + "operationId" : "findByName", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -99,35 +110,25 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "universeName", "in" : "path", "required" : true, - "type" : "string", - "format" : "uuid" + "type" : "string" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Region" - } - } - }, - "500" : { - "description" : "If there was a server or database issue when listing the regions", - "schema" : { - "$ref" : "#/definitions/Generic error response from Yugawware Platform API" - } + "default" : { + "description" : "successful operation" } - } - }, + }, + "deprecated" : true + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/upgrade" : { "post" : { - "tags" : [ "Region" ], - "summary" : "create new region", + "tags" : [ "Universe" ], + "summary" : "Upgrade the universe", "description" : "", - "operationId" : "create", + "operationId" : "upgrade", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -135,93 +136,101 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { "in" : "body", - "name" : "region", - "description" : "region form data for new region to be created", + "name" : "upgrade_params", + "description" : "upgrade params", "required" : true, "schema" : { - "$ref" : "#/definitions/RegionFormData" + "$ref" : "#/definitions/UpgradeParams" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Region" + "type" : "object" } } } } }, - "/universes/{uniUUID}/proxy/{proxyUrl}" : { - "get" : { - "operationId" : "proxyRequest", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/setup_universe_2dc" : { + "put" : { + "tags" : [ "Universe" ], + "summary" : "resetVersion", + "description" : "", + "operationId" : "resetVersion", "parameters" : [ { - "name" : "uniUUID", + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "name" : "proxyUrl", + "name" : "uniUUID", "in" : "path", "required" : true, - "type" : "string" + "type" : "string", + "format" : "uuid" } ], "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/logout" : { - "get" : { - "operationId" : "logout", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/YWSuccess" + } } } } }, - "/api/v1/login" : { + "/api/v1/customers/{cUUID}/universe_resources" : { "post" : { - "summary" : "login", - "description" : "", - "operationId" : "login", + "tags" : [ "Universe" ], + "summary" : "Api to get the resource estimate for a universe", + "description" : "Expects UniverseDefinitionTaskParams in request body and calculates the resource estimate for NodeDetailsSet in that.", + "operationId" : "getUniverseResources", "parameters" : [ { - "in" : "body", - "name" : "loginFormData", - "description" : "login form data", + "name" : "cUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/CustomerLoginFormData" - } + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/UniverseResourceDetails" } } } } }, - "/api/v1/insecure_login" : { - "get" : { - "summary" : "insecureLogin", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/pause" : { + "post" : { + "tags" : [ "Universe" ], + "summary" : "Pause the universe", "description" : "", - "operationId" : "insecure_login", - "parameters" : [ ], + "operationId" : "pause", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], "responses" : { "200" : { "description" : "successful operation", @@ -232,56 +241,53 @@ } } }, - "/api/v1/platform_config" : { - "get" : { - "operationId" : "getPlatformConfig", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/third_party_login" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/cost" : { "get" : { - "operationId" : "thirdPartyLogin", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/customers/{cUUID}/security" : { - "put" : { - "operationId" : "set_security", + "tags" : [ "Universe" ], + "summary" : "universeCost", + "description" : "", + "operationId" : "universeCost", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/UniverseResourceDetails" + } } } } }, - "/api/v1/customers/{cUUID}/api_token" : { - "put" : { - "summary" : "apiToken", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/leader" : { + "get" : { + "tags" : [ "Universe" ], + "summary" : "getMasterLeaderIP", "description" : "", - "operationId" : "api_token", + "operationId" : "getMasterLeaderIP", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { @@ -293,78 +299,24 @@ } } }, - "/api/v1/customer_count" : { - "get" : { - "operationId" : "customerCount", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/app_version" : { - "get" : { - "operationId" : "appVersion", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/logs/{maxLines}" : { - "get" : { - "operationId" : "getLogs", - "parameters" : [ { - "name" : "maxLines", - "in" : "path", - "required" : true, - "type" : "integer", - "format" : "int32" - } ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/ui_theme" : { - "get" : { - "operationId" : "getUITheme", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/register" : { - "post" : { - "operationId" : "register", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/customers/{cUUID}/universes/import" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/disk_update" : { "post" : { - "summary" : "import", + "tags" : [ "Universe" ], + "summary" : "updateDiskSize", "description" : "", - "operationId" : "importUniverse", + "operationId" : "updateDiskSize", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { @@ -376,33 +328,41 @@ } } }, - "/api/v1/customers/{cUUID}/universe_configure" : { - "post" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/status" : { + "get" : { "tags" : [ "Universe" ], - "summary" : "configure the universe parameters", - "description" : "This API builds the new universe definition task parameters by merging the input UserIntent with the current taskParams and returns the resulting task parameters in a serialized form", - "operationId" : "configure", + "summary" : "Status of the Universe", + "description" : "", + "operationId" : "status1", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseDefinitionTaskParams" + "type" : "object" } } } } }, - "/api/v1/customers/{cUUID}/universes/find/{universeName}" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/health_check" : { "get" : { "tags" : [ "Universe" ], - "operationId" : "findByName", + "summary" : "health Check", + "description" : "", + "operationId" : "healthCheck", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -410,62 +370,51 @@ "type" : "string", "format" : "uuid" }, { - "name" : "universeName", + "name" : "uniUUID", "in" : "path", "required" : true, - "type" : "string" + "type" : "string", + "format" : "uuid" } ], "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object" + } } - }, - "deprecated" : true + } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/upgrade" : { - "post" : { + "/api/v1/customers/{cUUID}/cost" : { + "get" : { "tags" : [ "Universe" ], - "summary" : "Upgrade the universe", + "summary" : "list universe cost for all universes", "description" : "", - "operationId" : "upgrade", + "operationId" : "universeListCost", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "in" : "body", - "name" : "upgrade_params", - "description" : "upgrade params", - "required" : true, - "schema" : { - "$ref" : "#/definitions/UpgradeParams" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/UniverseResourceDetails" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/setup_universe_2dc" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/update_backup_state" : { "put" : { "tags" : [ "Universe" ], - "summary" : "resetVersion", + "summary" : "Set backup Flag for a universe", "description" : "", - "operationId" : "resetVersion", + "operationId" : "setBackupFlag", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -489,12 +438,12 @@ } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/set_key" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/config_alerts" : { "post" : { "tags" : [ "Universe" ], - "summary" : "setUniverse", + "summary" : "Configure Alerts for a universe", "description" : "", - "operationId" : "setUniverseKey", + "operationId" : "configureAlerts", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -512,41 +461,47 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResp" + "$ref" : "#/definitions/YWSuccess" } } } } }, - "/api/v1/customers/{cUUID}/universe_resources" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/run_query" : { "post" : { "tags" : [ "Universe" ], - "summary" : "Api to get the resource estimate for a universe", - "description" : "Expects UniverseDefinitionTaskParams in request body and calculates the resource estimate for NodeDetailsSet in that.", - "operationId" : "getUniverseResources", + "summary" : "Run YSQL query against this universe", + "description" : "Only valid when platform is running in mode is `OSS`", + "operationId" : "runQuery", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResourceDetails" + "type" : "object" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/pause" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/run_in_shell" : { "post" : { "tags" : [ "Universe" ], - "summary" : "Pause the universe", - "description" : "", - "operationId" : "pause", + "summary" : "run command in shell", + "description" : "This operation is no longer supported sue to security reasons", + "operationId" : "runInShell", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -564,18 +519,18 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/Generic error response from Yugawware Platform API" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/cost" : { - "get" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/update_db_credentials" : { + "post" : { "tags" : [ "Universe" ], - "summary" : "universeCost", + "summary" : "setDatabaseCredentials", "description" : "", - "operationId" : "universeCost", + "operationId" : "setDatabaseCredentials", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -593,18 +548,18 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResourceDetails" + "$ref" : "#/definitions/YWSuccess" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/leader" : { - "get" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/create_db_credentials" : { + "post" : { "tags" : [ "Universe" ], - "summary" : "getMasterLeaderIP", + "summary" : "createUserInDB", "description" : "", - "operationId" : "getMasterLeaderIP", + "operationId" : "createUserInDB", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -622,18 +577,18 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/YWSuccess" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/disk_update" : { - "post" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/mark_helm3_compatible" : { + "put" : { "tags" : [ "Universe" ], - "summary" : "updateDiskSize", + "summary" : "Set the universe as helm3 compatible", "description" : "", - "operationId" : "updateDiskSize", + "operationId" : "setHelm3Compatible", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -651,18 +606,18 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/YWSuccess" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/status" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/live_queries" : { "get" : { "tags" : [ "Universe" ], - "summary" : "Status of the Universe", + "summary" : "getLiveQueries", "description" : "", - "operationId" : "status1", + "operationId" : "getLiveQueries", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -686,12 +641,12 @@ } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/health_check" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/slow_queries" : { "get" : { "tags" : [ "Universe" ], - "summary" : "health Check", + "summary" : "getSlowQueries", "description" : "", - "operationId" : "healthCheck", + "operationId" : "getSlowQueries", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -713,37 +668,34 @@ } } } - } - }, - "/api/v1/customers/{cUUID}/cost" : { - "get" : { + }, + "delete" : { "tags" : [ "Universe" ], - "summary" : "list universe cost for all universes", - "description" : "", - "operationId" : "universeListCost", + "operationId" : "resetSlowQueries", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/UniverseResourceDetails" - } + "default" : { + "description" : "successful operation" } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/update_backup_state" : { - "put" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/{nodeName}/download_logs" : { + "get" : { "tags" : [ "Universe" ], - "summary" : "Set backup Flag for a universe", - "description" : "", - "operationId" : "setBackupFlag", + "operationId" : "downloadNodeLogs", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -756,23 +708,25 @@ "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "nodeName", + "in" : "path", + "required" : true, + "type" : "string" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/YWSuccess" - } + "default" : { + "description" : "successful operation" } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/config_alerts" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/cluster" : { "post" : { "tags" : [ "Universe" ], - "summary" : "Configure Alerts for a universe", + "summary" : "clusterCreate", "description" : "", - "operationId" : "configureAlerts", + "operationId" : "clusterCreate", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -785,23 +739,31 @@ "required" : true, "type" : "string", "format" : "uuid" - } ], - "responses" : { + }, { + "in" : "body", + "name" : "univ_def", + "description" : "univ definition", + "required" : true, + "schema" : { + "$ref" : "#/definitions/UniverseDefinitionTaskParams" + } + } ], + "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "$ref" : "#/definitions/UniverseResp" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/run_query" : { - "post" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/cluster/{clustUUID}" : { + "delete" : { "tags" : [ "Universe" ], - "summary" : "Run YSQL query against this universe", - "description" : "Only valid when platform is running in mode is `OSS`", - "operationId" : "runQuery", + "summary" : "clusterDelete", + "description" : "", + "operationId" : "clusterDelete", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -814,23 +776,29 @@ "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "clustUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/UniverseResp" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/run_in_shell" : { - "post" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}" : { + "get" : { "tags" : [ "Universe" ], - "summary" : "run command in shell", - "description" : "This operation is no longer supported sue to security reasons", - "operationId" : "runInShell", + "summary" : "getUniverse", + "description" : "", + "operationId" : "index", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -848,18 +816,16 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Generic error response from Yugawware Platform API" + "$ref" : "#/definitions/UniverseResp" } } } - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/update_db_credentials" : { - "post" : { + }, + "put" : { "tags" : [ "Universe" ], - "summary" : "setDatabaseCredentials", + "summary" : "updateUniverse", "description" : "", - "operationId" : "setDatabaseCredentials", + "operationId" : "update", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -872,23 +838,29 @@ "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "univ_def", + "description" : "univ definition", + "required" : true, + "schema" : { + "$ref" : "#/definitions/UniverseDefinitionTaskParams" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "$ref" : "#/definitions/UniverseResp" } } } - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/create_db_credentials" : { - "post" : { + }, + "delete" : { "tags" : [ "Universe" ], - "summary" : "createUserInDB", + "summary" : "Destroy the universe", "description" : "", - "operationId" : "createUserInDB", + "operationId" : "destroy", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -901,52 +873,53 @@ "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "isForceDelete", + "in" : "query", + "description" : "isForceDelete", + "required" : false, + "type" : "boolean" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "object" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/mark_helm3_compatible" : { - "put" : { + "/api/v1/customers/{cUUID}/universes" : { + "get" : { "tags" : [ "Universe" ], - "summary" : "Set the universe as helm3 compatible", + "summary" : "List Universes", "description" : "", - "operationId" : "setHelm3Compatible", + "operationId" : "list", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "array", + "items" : { + "$ref" : "#/definitions/UniverseResp" + } } } } - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/live_queries" : { - "get" : { + }, + "post" : { "tags" : [ "Universe" ], - "summary" : "getLiveQueries", + "summary" : "Create a YugaByte Universe", "description" : "", - "operationId" : "getLiveQueries", + "operationId" : "create", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -954,28 +927,30 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", + "in" : "body", + "name" : "univ_def", + "description" : "univ definition", "required" : true, - "type" : "string", - "format" : "uuid" + "schema" : { + "$ref" : "#/definitions/UniverseDefinitionTaskParams" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/UniverseResp" } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/slow_queries" : { - "get" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/resume" : { + "post" : { "tags" : [ "Universe" ], - "summary" : "getSlowQueries", + "summary" : "Resume the universe", "description" : "", - "operationId" : "getSlowQueries", + "operationId" : "resume", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -997,34 +972,49 @@ } } } - }, - "delete" : { - "tags" : [ "Universe" ], - "operationId" : "resetSlowQueries", + } + }, + "/api/v1/customers/{cUUID}/certificates" : { + "get" : { + "operationId" : "list", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + }, + "post" : { + "summary" : "upload", + "description" : "", + "operationId" : "upload", + "parameters" : [ { + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" } ], "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "string", + "format" : "uuid" + } } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/{nodeName}/download_logs" : { + "/api/v1/customers/{cUUID}/certificates/{rUUID}/download" : { "get" : { - "tags" : [ "Universe" ], - "operationId" : "downloadNodeLogs", + "operationId" : "getRootCert", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1032,16 +1022,11 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "nodeName", - "in" : "path", - "required" : true, - "type" : "string" } ], "responses" : { "default" : { @@ -1050,12 +1035,11 @@ } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/cluster" : { + "/api/v1/customers/{cUUID}/certificates/{rUUID}" : { "post" : { - "tags" : [ "Universe" ], - "summary" : "clusterCreate", + "summary" : "TODO", "description" : "", - "operationId" : "clusterCreate", + "operationId" : "getClientCert", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1063,36 +1047,20 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "in" : "body", - "name" : "univ_def", - "description" : "univ definition", - "required" : true, - "schema" : { - "$ref" : "#/definitions/UniverseDefinitionTaskParams" - } } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/UniverseResp" - } + "default" : { + "description" : "successful operation" } } - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/cluster/{clustUUID}" : { + }, "delete" : { - "tags" : [ "Universe" ], - "summary" : "clusterDelete", - "description" : "", - "operationId" : "clusterDelete", + "operationId" : "delete", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1100,34 +1068,24 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "clustUUID", + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/UniverseResp" - } + "default" : { + "description" : "successful operation" } } } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}" : { - "get" : { - "tags" : [ "Universe" ], - "summary" : "getUniverse", + "/api/v1/customers/{cUUID}/certificates/{rUUID}/update_empty_cert" : { + "post" : { + "summary" : "update empty certs", "description" : "", - "operationId" : "index", + "operationId" : "updateEmptyCustomCert", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1135,7 +1093,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", @@ -1145,16 +1103,15 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResp" + "$ref" : "#/definitions/CertificateInfo" } } } - }, - "put" : { - "tags" : [ "Universe" ], - "summary" : "updateUniverse", - "description" : "", - "operationId" : "update", + } + }, + "/api/v1/customers/{cUUID}/certificates/{name}" : { + "get" : { + "operationId" : "get", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1162,143 +1119,14 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "name", "in" : "path", "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "in" : "body", - "name" : "univ_def", - "description" : "univ definition", - "required" : true, - "schema" : { - "$ref" : "#/definitions/UniverseDefinitionTaskParams" - } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/UniverseResp" - } - } - } - }, - "delete" : { - "tags" : [ "Universe" ], - "summary" : "Destroy the universe", - "description" : "", - "operationId" : "destroy", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "isForceDelete", - "in" : "query", - "description" : "isForceDelete", - "required" : false, - "type" : "boolean" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "object" - } - } - } - } - }, - "/api/v1/customers/{cUUID}/universes" : { - "get" : { - "tags" : [ "Universe" ], - "summary" : "List Universes", - "description" : "", - "operationId" : "list", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/UniverseResp" - } - } - } - } - }, - "post" : { - "tags" : [ "Universe" ], - "summary" : "Create a YugaByte Universe", - "description" : "", - "operationId" : "create", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "in" : "body", - "name" : "univ_def", - "description" : "univ definition", - "required" : true, - "schema" : { - "$ref" : "#/definitions/UniverseDefinitionTaskParams" - } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/UniverseResp" - } - } - } - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/resume" : { - "post" : { - "tags" : [ "Universe" ], - "summary" : "Resume the universe", - "description" : "", - "operationId" : "resume", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" + "type" : "string" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "object" - } + "default" : { + "description" : "successful operation" } } } @@ -1422,8 +1250,10 @@ } } }, - "/api/v1/customers/{cUUID}/certificates" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}/zones" : { "get" : { + "summary" : "listAZ", + "description" : "", "operationId" : "list", "parameters" : [ { "name" : "cUUID", @@ -1431,19 +1261,14 @@ "required" : true, "type" : "string", "format" : "uuid" - } ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - }, - "post" : { - "summary" : "upload", - "description" : "", - "operationId" : "upload", - "parameters" : [ { - "name" : "cUUID", + }, { + "name" : "pUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", @@ -1453,41 +1278,63 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "string", - "format" : "uuid" + "type" : "array", + "items" : { + "$ref" : "#/definitions/AvailabilityZone" + } } } } - } - }, - "/api/v1/customers/{cUUID}/certificates/{rUUID}/download" : { - "get" : { - "operationId" : "getRootCert", + }, + "post" : { + "summary" : "createAZ", + "description" : "", + "operationId" : "create", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "pUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" }, { "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "azFormData", + "description" : "az form data", + "required" : true, + "schema" : { + "$ref" : "#/definitions/AvailabilityZoneFormData" + } } ], "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object", + "additionalProperties" : { + "$ref" : "#/definitions/AvailabilityZone" + } + } } } } }, - "/api/v1/customers/{cUUID}/certificates/{rUUID}" : { - "post" : { - "summary" : "TODO", + "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}/zones/{azUUID}" : { + "delete" : { + "summary" : "deleteAZ", "description" : "", - "operationId" : "getClientCert", + "operationId" : "delete", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1495,45 +1342,40 @@ "type" : "string", "format" : "uuid" }, { - "name" : "rUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - } ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - }, - "delete" : { - "operationId" : "delete", - "parameters" : [ { - "name" : "cUUID", + }, { + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "name" : "rUUID", + "name" : "azUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" } ], "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object" + } } } } }, - "/api/v1/customers/{cUUID}/certificates/{rUUID}/update_empty_cert" : { - "post" : { - "summary" : "update empty certs", - "description" : "", - "operationId" : "updateEmptyCustomCert", + "/api/v1/customers/{cUUID}/runtime_config/{scope}" : { + "get" : { + "tags" : [ "RuntimeConfig" ], + "summary" : "listScopes", + "description" : "Lists all (including empty scopes) runtime config scopes for current customer. List includes the Global scope that spans multiple customers, scope for customer specific overrides for current customer and one scope each for each universe and provider.", + "operationId" : "getConfig", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1541,80 +1383,29 @@ "type" : "string", "format" : "uuid" }, { - "name" : "rUUID", + "name" : "scope", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "includeInherited", + "in" : "query", + "required" : false, + "type" : "boolean", + "default" : false } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/CertificateInfo" + "$ref" : "#/definitions/RuntimeConfigFormData" } } } } }, - "/api/v1/customers/{cUUID}/certificates/{name}" : { - "get" : { - "operationId" : "get", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "name", - "in" : "path", - "required" : true, - "type" : "string" - } ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/customers/{cUUID}/runtime_config/{scope}" : { - "get" : { - "tags" : [ "RuntimeConfig" ], - "summary" : "listScopes", - "description" : "Lists all (including empty scopes) runtime config scopes for current customer. List includes the Global scope that spans multiple customers, scope for customer specific overrides for current customer and one scope each for each universe and provider.", - "operationId" : "getConfig", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "scope", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "includeInherited", - "in" : "query", - "required" : false, - "type" : "boolean", - "default" : false - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/RuntimeConfigFormData" - } - } - } - } - }, - "/api/v1/runtime_config/mutable_keys" : { + "/api/v1/runtime_config/mutable_keys" : { "get" : { "tags" : [ "RuntimeConfig" ], "summary" : "listKeys", @@ -1758,6 +1549,201 @@ } } }, + "/universes/{uniUUID}/proxy/{proxyUrl}" : { + "get" : { + "operationId" : "proxyRequest", + "parameters" : [ { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "proxyUrl", + "in" : "path", + "required" : true, + "type" : "string" + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/logout" : { + "get" : { + "operationId" : "logout", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/login" : { + "post" : { + "summary" : "login", + "description" : "", + "operationId" : "login", + "parameters" : [ { + "in" : "body", + "name" : "loginFormData", + "description" : "login form data", + "required" : true, + "schema" : { + "$ref" : "#/definitions/CustomerLoginFormData" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object" + } + } + } + } + }, + "/api/v1/insecure_login" : { + "get" : { + "summary" : "insecureLogin", + "description" : "", + "operationId" : "insecure_login", + "parameters" : [ ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object" + } + } + } + } + }, + "/api/v1/platform_config" : { + "get" : { + "operationId" : "getPlatformConfig", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/third_party_login" : { + "get" : { + "operationId" : "thirdPartyLogin", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/customers/{cUUID}/security" : { + "put" : { + "operationId" : "set_security", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/customers/{cUUID}/api_token" : { + "put" : { + "summary" : "apiToken", + "description" : "", + "operationId" : "api_token", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object" + } + } + } + } + }, + "/api/v1/customer_count" : { + "get" : { + "operationId" : "customerCount", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/app_version" : { + "get" : { + "operationId" : "appVersion", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/logs/{maxLines}" : { + "get" : { + "operationId" : "getLogs", + "parameters" : [ { + "name" : "maxLines", + "in" : "path", + "required" : true, + "type" : "integer", + "format" : "int32" + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/ui_theme" : { + "get" : { + "operationId" : "getUITheme", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/register" : { + "post" : { + "operationId" : "register", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, "/api/v1/customers/{cUUID}/providers/{pUUID}/bootstrap" : { "post" : { "tags" : [ "Provider" ], @@ -1850,10 +1836,12 @@ } } }, - "/api/v1/customers/{cUUID}/providers/setup_docker" : { - "post" : { + "/api/v1/customers/{cUUID}/providers/suggested_kubernetes_config" : { + "get" : { "tags" : [ "Provider" ], - "operationId" : "setupDocker", + "summary" : "getSuggestedKubernetesConfigs", + "description" : "", + "operationId" : "getSuggestedKubernetesConfigs", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1862,30 +1850,25 @@ "format" : "uuid" } ], "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/KubernetesProviderFormData" + } } } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}" : { - "delete" : { - "tags" : [ "Provider" ], - "summary" : "deleteProvider", - "description" : "", - "operationId" : "delete", + "/api/v1/customers/{cUUID}/providers/setup_docker" : { + "post" : { + "tags" : [ "Provider" ], + "operationId" : "setupDocker", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "default" : { @@ -1973,10 +1956,12 @@ } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/cleanup" : { - "post" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}" : { + "delete" : { "tags" : [ "Provider" ], - "operationId" : "cleanup", + "summary" : "deleteProvider", + "description" : "", + "operationId" : "delete", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1997,11 +1982,10 @@ } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}/zones/{azUUID}" : { - "delete" : { - "summary" : "deleteAZ", - "description" : "", - "operationId" : "delete", + "/api/v1/customers/{cUUID}/providers/{pUUID}/cleanup" : { + "post" : { + "tags" : [ "Provider" ], + "operationId" : "cleanup", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2014,14 +1998,22 @@ "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "rUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "azUUID", + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/customers/{cUUID}/regions" : { + "get" : { + "tags" : [ "Region" ], + "summary" : "list all Regions across all providers", + "description" : "", + "operationId" : "listAllRegions", + "parameters" : [ { + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", @@ -2031,15 +2023,19 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "type" : "array", + "items" : { + "$ref" : "#/definitions/Region" + } } } } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}/zones" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/regions" : { "get" : { - "summary" : "listAZ", + "tags" : [ "Region" ], + "summary" : "list Regions for a specific provider", "description" : "", "operationId" : "list", "parameters" : [ { @@ -2054,12 +2050,6 @@ "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "rUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "200" : { @@ -2067,14 +2057,21 @@ "schema" : { "type" : "array", "items" : { - "$ref" : "#/definitions/AvailabilityZone" + "$ref" : "#/definitions/Region" } } + }, + "500" : { + "description" : "If there was a server or database issue when listing the regions", + "schema" : { + "$ref" : "#/definitions/Generic error response from Yugawware Platform API" + } } } }, "post" : { - "summary" : "createAZ", + "tags" : [ "Region" ], + "summary" : "create new region", "description" : "", "operationId" : "create", "parameters" : [ { @@ -2089,217 +2086,65 @@ "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "rUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" }, { "in" : "body", - "name" : "azFormData", - "description" : "az form data", + "name" : "region", + "description" : "region form data for new region to be created", "required" : true, "schema" : { - "$ref" : "#/definitions/AvailabilityZoneFormData" + "$ref" : "#/definitions/RegionFormData" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "$ref" : "#/definitions/AvailabilityZone" - } + "$ref" : "#/definitions/Region" } } } } - } - }, - "definitions" : { - "AvailabilityZone" : { - "type" : "object", - "required" : [ "active", "code", "kubeconfigPath", "name", "provider", "region", "subnet", "uuid" ], - "properties" : { - "uuid" : { - "type" : "string", - "format" : "uuid" - }, - "code" : { - "type" : "string" - }, - "name" : { - "type" : "string" - }, - "region" : { - "$ref" : "#/definitions/Region" - }, - "active" : { - "type" : "boolean" - }, - "subnet" : { - "type" : "string" - }, - "provider" : { - "$ref" : "#/definitions/Provider" - }, - "kubeconfigPath" : { - "type" : "string" - } - } }, - "CloudBootstrapParams" : { - "type" : "object", - "required" : [ "airGapInstall", "customHostCidrs", "destVpcId", "errorString", "hostVpcId", "hostVpcRegion", "keyPairName", "perRegionMetadata", "providerUUID", "sshPort", "sshPrivateKeyContent", "sshUser" ], - "properties" : { - "errorString" : { - "type" : "string" - }, - "providerUUID" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}" : { + "delete" : { + "tags" : [ "Region" ], + "summary" : "delete", + "description" : "", + "operationId" : "delete", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, "type" : "string", "format" : "uuid" - }, - "perRegionMetadata" : { - "type" : "object", - "additionalProperties" : { - "$ref" : "#/definitions/PerRegionMetadata" - } - }, - "keyPairName" : { - "type" : "string" - }, - "sshPrivateKeyContent" : { - "type" : "string" - }, - "sshUser" : { - "type" : "string" - }, - "airGapInstall" : { - "type" : "boolean" - }, - "sshPort" : { - "type" : "integer", - "format" : "int32" - }, - "hostVpcId" : { - "type" : "string" - }, - "hostVpcRegion" : { - "type" : "string" - }, - "customHostCidrs" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "destVpcId" : { - "type" : "string" - } - } - }, - "JsonNode" : { - "type" : "object", - "required" : [ "array", "bigDecimal", "bigInteger", "binary", "boolean", "containerNode", "double", "float", "floatingPointNumber", "int", "integralNumber", "long", "missingNode", "nodeType", "null", "number", "object", "pojo", "short", "textual", "valueNode" ], - "properties" : { - "float" : { - "type" : "boolean" - }, - "nodeType" : { - "type" : "string", - "enum" : [ "ARRAY", "BINARY", "BOOLEAN", "MISSING", "NULL", "NUMBER", "OBJECT", "POJO", "STRING" ] - }, - "object" : { - "type" : "boolean" - }, - "valueNode" : { - "type" : "boolean" - }, - "containerNode" : { - "type" : "boolean" - }, - "missingNode" : { - "type" : "boolean" - }, - "pojo" : { - "type" : "boolean" - }, - "number" : { - "type" : "boolean" - }, - "integralNumber" : { - "type" : "boolean" - }, - "floatingPointNumber" : { - "type" : "boolean" - }, - "short" : { - "type" : "boolean" - }, - "int" : { - "type" : "boolean" - }, - "long" : { - "type" : "boolean" - }, - "double" : { - "type" : "boolean" - }, - "bigDecimal" : { - "type" : "boolean" - }, - "bigInteger" : { - "type" : "boolean" - }, - "textual" : { - "type" : "boolean" - }, - "boolean" : { - "type" : "boolean" - }, - "binary" : { - "type" : "boolean" - }, - "array" : { - "type" : "boolean" - }, - "null" : { - "type" : "boolean" - } - } - }, - "PerRegionMetadata" : { - "type" : "object", - "required" : [ "azToSubnetIds", "customImageId", "customSecurityGroupId", "subnetId", "vpcCidr", "vpcId" ], - "properties" : { - "vpcId" : { - "type" : "string" - }, - "vpcCidr" : { - "type" : "string" - }, - "azToSubnetIds" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" + }, { + "name" : "pUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "rUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object" + } } - }, - "subnetId" : { - "type" : "string" - }, - "customImageId" : { - "type" : "string" - }, - "customSecurityGroupId" : { - "type" : "string" } } - }, - "Provider" : { + } + }, + "definitions" : { + "AvailabilityZone" : { "type" : "object", - "required" : [ "active", "cloudParams", "code", "customerUUID", "hostedZoneId", "hostedZoneName", "name", "regions", "uuid" ], + "required" : [ "active", "code", "kubeconfigPath", "name", "provider", "region", "subnet", "uuid" ], "properties" : { "uuid" : { "type" : "string", @@ -2311,152 +2156,70 @@ "name" : { "type" : "string" }, + "region" : { + "$ref" : "#/definitions/Region" + }, "active" : { "type" : "boolean" }, - "customerUUID" : { - "type" : "string", - "format" : "uuid" - }, - "regions" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "$ref" : "#/definitions/Region" - } - }, - "hostedZoneName" : { - "type" : "string" - }, - "hostedZoneId" : { + "subnet" : { "type" : "string" }, - "cloudParams" : { - "$ref" : "#/definitions/CloudBootstrapParams" + "provider" : { + "$ref" : "#/definitions/Provider" }, - "config" : { - "type" : "object", - "readOnly" : true, - "additionalProperties" : { - "type" : "string" - } + "kubeconfigPath" : { + "type" : "string" } } }, - "Region" : { + "CloudBootstrapParams" : { "type" : "object", - "required" : [ "active", "code", "details", "latitude", "longitude", "name", "provider", "securityGroupId", "uuid", "vnetName", "ybImage", "zones" ], + "required" : [ "airGapInstall", "customHostCidrs", "destVpcId", "errorString", "hostVpcId", "hostVpcRegion", "keyPairName", "perRegionMetadata", "providerUUID", "sshPort", "sshPrivateKeyContent", "sshUser" ], "properties" : { - "uuid" : { + "errorString" : { + "type" : "string" + }, + "providerUUID" : { "type" : "string", "format" : "uuid" }, - "code" : { - "type" : "string", - "example" : "us-west-2", - "description" : "Cloud provider region code" + "perRegionMetadata" : { + "type" : "object", + "additionalProperties" : { + "$ref" : "#/definitions/PerRegionMetadata" + } }, - "name" : { + "keyPairName" : { "type" : "string" }, - "ybImage" : { + "sshPrivateKeyContent" : { "type" : "string" }, - "longitude" : { - "type" : "number", - "format" : "double" - }, - "latitude" : { - "type" : "number", - "format" : "double" - }, - "provider" : { - "$ref" : "#/definitions/Provider" - }, - "zones" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "$ref" : "#/definitions/AvailabilityZone" - } + "sshUser" : { + "type" : "string" }, - "active" : { + "airGapInstall" : { "type" : "boolean" }, - "details" : { - "$ref" : "#/definitions/JsonNode" + "sshPort" : { + "type" : "integer", + "format" : "int32" }, - "securityGroupId" : { + "hostVpcId" : { "type" : "string" }, - "vnetName" : { + "hostVpcRegion" : { "type" : "string" }, - "config" : { - "type" : "object", - "readOnly" : true, - "additionalProperties" : { + "customHostCidrs" : { + "type" : "array", + "items" : { "type" : "string" } - } - }, - "description" : "Region within a given provider. Typically this will map to a single cloud provider region" - }, - "RegionFormData" : { - "type" : "object", - "required" : [ "code", "destVpcId", "hostVpcId", "hostVpcRegion", "latitude", "longitude", "name", "ybImage" ], - "properties" : { - "code" : { - "type" : "string" - }, - "name" : { - "type" : "string" - }, - "ybImage" : { - "type" : "string" - }, - "hostVpcRegion" : { - "type" : "string" - }, - "hostVpcId" : { - "type" : "string" }, "destVpcId" : { "type" : "string" - }, - "latitude" : { - "type" : "number", - "format" : "double" - }, - "longitude" : { - "type" : "number", - "format" : "double" - } - } - }, - "Generic error response from Yugawware Platform API" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "error" : { - "type" : "string", - "example" : "There was a problem creating universe", - "description" : "User visible unstructurred error message" - } - } - }, - "CustomerLoginFormData" : { - "type" : "object", - "required" : [ "email", "password" ], - "properties" : { - "email" : { - "type" : "string" - }, - "password" : { - "type" : "string" } } }, @@ -2622,25 +2385,95 @@ "encryptionAtRestEnabled" : { "type" : "boolean" }, - "kmsConfigUUID" : { - "type" : "string", - "format" : "uuid" + "kmsConfigUUID" : { + "type" : "string", + "format" : "uuid" + }, + "opType" : { + "type" : "string", + "enum" : [ "ENABLE", "DISABLE", "UNDEFINED" ] + }, + "type" : { + "type" : "string", + "enum" : [ "CMK", "DATA_KEY" ] + } + } + }, + "ExtraDependencies" : { + "type" : "object", + "required" : [ "installNodeExporter" ], + "properties" : { + "installNodeExporter" : { + "type" : "boolean" + } + } + }, + "JsonNode" : { + "type" : "object", + "required" : [ "array", "bigDecimal", "bigInteger", "binary", "boolean", "containerNode", "double", "float", "floatingPointNumber", "int", "integralNumber", "long", "missingNode", "nodeType", "null", "number", "object", "pojo", "short", "textual", "valueNode" ], + "properties" : { + "float" : { + "type" : "boolean" + }, + "nodeType" : { + "type" : "string", + "enum" : [ "ARRAY", "BINARY", "BOOLEAN", "MISSING", "NULL", "NUMBER", "OBJECT", "POJO", "STRING" ] + }, + "object" : { + "type" : "boolean" + }, + "valueNode" : { + "type" : "boolean" + }, + "containerNode" : { + "type" : "boolean" + }, + "missingNode" : { + "type" : "boolean" + }, + "pojo" : { + "type" : "boolean" + }, + "number" : { + "type" : "boolean" + }, + "integralNumber" : { + "type" : "boolean" + }, + "floatingPointNumber" : { + "type" : "boolean" + }, + "short" : { + "type" : "boolean" + }, + "int" : { + "type" : "boolean" + }, + "long" : { + "type" : "boolean" + }, + "double" : { + "type" : "boolean" + }, + "bigDecimal" : { + "type" : "boolean" + }, + "bigInteger" : { + "type" : "boolean" + }, + "textual" : { + "type" : "boolean" + }, + "boolean" : { + "type" : "boolean" }, - "opType" : { - "type" : "string", - "enum" : [ "ENABLE", "DISABLE", "UNDEFINED" ] + "binary" : { + "type" : "boolean" }, - "type" : { - "type" : "string", - "enum" : [ "CMK", "DATA_KEY" ] - } - } - }, - "ExtraDependencies" : { - "type" : "object", - "required" : [ "installNodeExporter" ], - "properties" : { - "installNodeExporter" : { + "array" : { + "type" : "boolean" + }, + "null" : { "type" : "boolean" } } @@ -2739,6 +2572,33 @@ } } }, + "PerRegionMetadata" : { + "type" : "object", + "required" : [ "azToSubnetIds", "customImageId", "customSecurityGroupId", "subnetId", "vpcCidr", "vpcId" ], + "properties" : { + "vpcId" : { + "type" : "string" + }, + "vpcCidr" : { + "type" : "string" + }, + "azToSubnetIds" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + }, + "subnetId" : { + "type" : "string" + }, + "customImageId" : { + "type" : "string" + }, + "customSecurityGroupId" : { + "type" : "string" + } + } + }, "PlacementAZ" : { "type" : "object", "required" : [ "isAffinitized", "name", "numNodesInAZ", "replicationFactor", "subnet", "uuid" ], @@ -2819,212 +2679,114 @@ } } }, - "UniverseDefinitionTaskParams" : { + "Provider" : { "type" : "object", - "required" : [ "allowInsecure", "backupInProgress", "capability", "clusters", "cmkArn", "communicationPorts", "currentClusterType", "deviceInfo", "encryptionAtRestConfig", "errorString", "expectedUniverseVersion", "extraDependencies", "firstTry", "importedState", "itestS3PackagePath", "nextClusterIndex", "nodeDetailsSet", "nodeExporterUser", "nodePrefix", "remotePackagePath", "resetAZConfig", "rootCA", "setTxnTableWaitCountFlag", "universePaused", "universeUUID", "updateInProgress", "updateSucceeded", "userAZSelected" ], + "required" : [ "active", "cloudParams", "code", "customerUUID", "hostedZoneId", "hostedZoneName", "name", "regions", "uuid" ], "properties" : { - "errorString" : { + "uuid" : { + "type" : "string", + "format" : "uuid" + }, + "code" : { "type" : "string" }, - "nodeExporterUser" : { + "name" : { "type" : "string" }, - "deviceInfo" : { - "$ref" : "#/definitions/DeviceInfo" + "active" : { + "type" : "boolean" }, - "universeUUID" : { + "customerUUID" : { "type" : "string", "format" : "uuid" }, - "expectedUniverseVersion" : { - "type" : "integer", - "format" : "int32" - }, - "cmkArn" : { - "type" : "string" - }, - "encryptionAtRestConfig" : { - "$ref" : "#/definitions/EncryptionAtRestConfig" - }, - "nodeDetailsSet" : { + "regions" : { "type" : "array", "uniqueItems" : true, "items" : { - "$ref" : "#/definitions/NodeDetails" - } - }, - "communicationPorts" : { - "$ref" : "#/definitions/CommunicationPorts" - }, - "extraDependencies" : { - "$ref" : "#/definitions/ExtraDependencies" - }, - "firstTry" : { - "type" : "boolean" - }, - "clusters" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Cluster" + "$ref" : "#/definitions/Region" } }, - "currentClusterType" : { - "type" : "string", - "enum" : [ "PRIMARY", "ASYNC" ] - }, - "nodePrefix" : { - "type" : "string" - }, - "rootCA" : { - "type" : "string", - "format" : "uuid" - }, - "userAZSelected" : { - "type" : "boolean" - }, - "resetAZConfig" : { - "type" : "boolean" - }, - "updateInProgress" : { - "type" : "boolean" - }, - "backupInProgress" : { - "type" : "boolean" - }, - "updateSucceeded" : { - "type" : "boolean" - }, - "universePaused" : { - "type" : "boolean" - }, - "nextClusterIndex" : { - "type" : "integer", - "format" : "int32" - }, - "allowInsecure" : { - "type" : "boolean" - }, - "setTxnTableWaitCountFlag" : { - "type" : "boolean" - }, - "itestS3PackagePath" : { + "hostedZoneName" : { "type" : "string" }, - "remotePackagePath" : { + "hostedZoneId" : { "type" : "string" }, - "importedState" : { - "type" : "string", - "enum" : [ "NONE", "STARTED", "MASTERS_ADDED", "TSERVERS_ADDED", "IMPORTED" ] + "cloudParams" : { + "$ref" : "#/definitions/CloudBootstrapParams" }, - "capability" : { - "type" : "string", - "enum" : [ "READ_ONLY", "EDITS_ALLOWED" ] + "config" : { + "type" : "object", + "readOnly" : true, + "additionalProperties" : { + "type" : "string" + } } } }, - "UserIntent" : { + "Region" : { "type" : "object", - "required" : [ "accessKeyCode", "assignPublicIP", "awsArnString", "deviceInfo", "enableClientToNodeEncrypt", "enableExposingService", "enableIPV6", "enableNodeToNodeEncrypt", "enableVolumeEncryption", "enableYEDIS", "enableYSQL", "instanceTags", "instanceType", "masterGFlags", "numNodes", "preferredRegion", "provider", "providerType", "regionList", "replicationFactor", "tserverGFlags", "universeName", "useHostname", "useTimeSync", "ybSoftwareVersion" ], + "required" : [ "active", "code", "details", "latitude", "longitude", "name", "provider", "securityGroupId", "uuid", "vnetName", "ybImage", "zones" ], "properties" : { - "universeName" : { - "type" : "string" - }, - "provider" : { - "type" : "string" - }, - "providerType" : { - "type" : "string", - "enum" : [ "unknown", "aws", "gcp", "azu", "docker", "onprem", "kubernetes", "local", "other" ] - }, - "replicationFactor" : { - "type" : "integer", - "format" : "int32" - }, - "regionList" : { - "type" : "array", - "items" : { - "type" : "string", - "format" : "uuid" - } - }, - "preferredRegion" : { + "uuid" : { "type" : "string", "format" : "uuid" }, - "instanceType" : { - "type" : "string" - }, - "numNodes" : { - "type" : "integer", - "format" : "int32" + "code" : { + "type" : "string", + "example" : "us-west-2", + "description" : "Cloud provider region code" }, - "ybSoftwareVersion" : { + "name" : { "type" : "string" }, - "accessKeyCode" : { + "ybImage" : { "type" : "string" }, - "deviceInfo" : { - "$ref" : "#/definitions/DeviceInfo" - }, - "assignPublicIP" : { - "type" : "boolean" - }, - "useTimeSync" : { - "type" : "boolean" - }, - "enableYSQL" : { - "type" : "boolean" - }, - "enableYEDIS" : { - "type" : "boolean" + "longitude" : { + "type" : "number", + "format" : "double" }, - "enableNodeToNodeEncrypt" : { - "type" : "boolean" + "latitude" : { + "type" : "number", + "format" : "double" }, - "enableClientToNodeEncrypt" : { - "type" : "boolean" + "provider" : { + "$ref" : "#/definitions/Provider" }, - "enableVolumeEncryption" : { - "type" : "boolean" + "zones" : { + "type" : "array", + "uniqueItems" : true, + "items" : { + "$ref" : "#/definitions/AvailabilityZone" + } }, - "enableIPV6" : { + "active" : { "type" : "boolean" }, - "enableExposingService" : { - "type" : "string", - "enum" : [ "NONE", "EXPOSED", "UNEXPOSED" ] + "details" : { + "$ref" : "#/definitions/JsonNode" }, - "awsArnString" : { + "securityGroupId" : { "type" : "string" }, - "useHostname" : { - "type" : "boolean" - }, - "masterGFlags" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "tserverGFlags" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } + "vnetName" : { + "type" : "string" }, - "instanceTags" : { + "config" : { "type" : "object", + "readOnly" : true, "additionalProperties" : { "type" : "string" } } - } + }, + "description" : "Region within a given provider. Typically this will map to a single cloud provider region" }, - "UpgradeParams" : { + "UniverseDefinitionTaskParams" : { "type" : "object", - "required" : [ "allowInsecure", "backupInProgress", "capability", "certUUID", "clusters", "cmkArn", "communicationPorts", "currentClusterType", "deviceInfo", "encryptionAtRestConfig", "errorString", "expectedUniverseVersion", "extraDependencies", "firstTry", "importedState", "itestS3PackagePath", "masterGFlags", "nextClusterIndex", "nodeDetailsSet", "nodeExporterUser", "nodePrefix", "remotePackagePath", "resetAZConfig", "rootCA", "rotateRoot", "setTxnTableWaitCountFlag", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "taskType", "tserverGFlags", "universePaused", "universeUUID", "updateInProgress", "updateSucceeded", "upgradeOption", "userAZSelected", "ybSoftwareVersion" ], + "required" : [ "allowInsecure", "backupInProgress", "capability", "clusters", "cmkArn", "communicationPorts", "currentClusterType", "deviceInfo", "encryptionAtRestConfig", "errorString", "expectedUniverseVersion", "extraDependencies", "firstTry", "importedState", "itestS3PackagePath", "nextClusterIndex", "nodeDetailsSet", "nodeExporterUser", "nodePrefix", "remotePackagePath", "resetAZConfig", "rootCA", "setTxnTableWaitCountFlag", "universePaused", "universeUUID", "updateInProgress", "updateSucceeded", "userAZSelected" ], "properties" : { "errorString" : { "type" : "string" @@ -3123,19 +2885,86 @@ "capability" : { "type" : "string", "enum" : [ "READ_ONLY", "EDITS_ALLOWED" ] + } + } + }, + "UserIntent" : { + "type" : "object", + "required" : [ "accessKeyCode", "assignPublicIP", "awsArnString", "deviceInfo", "enableClientToNodeEncrypt", "enableExposingService", "enableIPV6", "enableNodeToNodeEncrypt", "enableVolumeEncryption", "enableYEDIS", "enableYSQL", "instanceTags", "instanceType", "masterGFlags", "numNodes", "preferredRegion", "provider", "providerType", "regionList", "replicationFactor", "tserverGFlags", "universeName", "useHostname", "useTimeSync", "ybSoftwareVersion" ], + "properties" : { + "universeName" : { + "type" : "string" }, - "taskType" : { + "provider" : { + "type" : "string" + }, + "providerType" : { "type" : "string", - "enum" : [ "Everything", "Software", "GFlags", "Restart", "Certs" ] + "enum" : [ "unknown", "aws", "gcp", "azu", "docker", "onprem", "kubernetes", "local", "other" ] + }, + "replicationFactor" : { + "type" : "integer", + "format" : "int32" + }, + "regionList" : { + "type" : "array", + "items" : { + "type" : "string", + "format" : "uuid" + } + }, + "preferredRegion" : { + "type" : "string", + "format" : "uuid" + }, + "instanceType" : { + "type" : "string" + }, + "numNodes" : { + "type" : "integer", + "format" : "int32" }, "ybSoftwareVersion" : { "type" : "string" }, - "certUUID" : { + "accessKeyCode" : { + "type" : "string" + }, + "deviceInfo" : { + "$ref" : "#/definitions/DeviceInfo" + }, + "assignPublicIP" : { + "type" : "boolean" + }, + "useTimeSync" : { + "type" : "boolean" + }, + "enableYSQL" : { + "type" : "boolean" + }, + "enableYEDIS" : { + "type" : "boolean" + }, + "enableNodeToNodeEncrypt" : { + "type" : "boolean" + }, + "enableClientToNodeEncrypt" : { + "type" : "boolean" + }, + "enableVolumeEncryption" : { + "type" : "boolean" + }, + "enableIPV6" : { + "type" : "boolean" + }, + "enableExposingService" : { "type" : "string", - "format" : "uuid" + "enum" : [ "NONE", "EXPOSED", "UNEXPOSED" ] }, - "rotateRoot" : { + "awsArnString" : { + "type" : "string" + }, + "useHostname" : { "type" : "boolean" }, "masterGFlags" : { @@ -3150,29 +2979,11 @@ "type" : "string" } }, - "sleepAfterMasterRestartMillis" : { - "type" : "integer", - "format" : "int32" - }, - "sleepAfterTServerRestartMillis" : { - "type" : "integer", - "format" : "int32" - }, - "upgradeOption" : { - "type" : "string", - "enum" : [ "Rolling", "Non-Rolling", "Non-Restart" ] - } - } - }, - "YWSuccess" : { - "type" : "object", - "required" : [ "message", "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "message" : { - "type" : "string" + "instanceTags" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } } } }, @@ -3443,72 +3254,205 @@ "name" : { "type" : "string" }, - "creationDate" : { + "creationDate" : { + "type" : "string" + }, + "version" : { + "type" : "integer", + "format" : "int32" + }, + "dnsName" : { + "type" : "string" + }, + "resources" : { + "$ref" : "#/definitions/UniverseResourceDetails" + }, + "universeDetails" : { + "$ref" : "#/definitions/UniverseDefinitionTaskParamsResp" + }, + "universeConfig" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + }, + "taskUUID" : { + "type" : "string" + }, + "sampleAppCommandTxt" : { + "type" : "string" + }, + "pricePerHour" : { + "type" : "number", + "format" : "double" + } + } + }, + "UpgradeParams" : { + "type" : "object", + "required" : [ "allowInsecure", "backupInProgress", "capability", "certUUID", "clusters", "cmkArn", "communicationPorts", "currentClusterType", "deviceInfo", "encryptionAtRestConfig", "errorString", "expectedUniverseVersion", "extraDependencies", "firstTry", "importedState", "itestS3PackagePath", "masterGFlags", "nextClusterIndex", "nodeDetailsSet", "nodeExporterUser", "nodePrefix", "remotePackagePath", "resetAZConfig", "rootCA", "rotateRoot", "setTxnTableWaitCountFlag", "sleepAfterMasterRestartMillis", "sleepAfterTServerRestartMillis", "taskType", "tserverGFlags", "universePaused", "universeUUID", "updateInProgress", "updateSucceeded", "upgradeOption", "userAZSelected", "ybSoftwareVersion" ], + "properties" : { + "errorString" : { + "type" : "string" + }, + "nodeExporterUser" : { + "type" : "string" + }, + "deviceInfo" : { + "$ref" : "#/definitions/DeviceInfo" + }, + "universeUUID" : { + "type" : "string", + "format" : "uuid" + }, + "expectedUniverseVersion" : { + "type" : "integer", + "format" : "int32" + }, + "cmkArn" : { + "type" : "string" + }, + "encryptionAtRestConfig" : { + "$ref" : "#/definitions/EncryptionAtRestConfig" + }, + "nodeDetailsSet" : { + "type" : "array", + "uniqueItems" : true, + "items" : { + "$ref" : "#/definitions/NodeDetails" + } + }, + "communicationPorts" : { + "$ref" : "#/definitions/CommunicationPorts" + }, + "extraDependencies" : { + "$ref" : "#/definitions/ExtraDependencies" + }, + "firstTry" : { + "type" : "boolean" + }, + "clusters" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Cluster" + } + }, + "currentClusterType" : { + "type" : "string", + "enum" : [ "PRIMARY", "ASYNC" ] + }, + "nodePrefix" : { + "type" : "string" + }, + "rootCA" : { + "type" : "string", + "format" : "uuid" + }, + "userAZSelected" : { + "type" : "boolean" + }, + "resetAZConfig" : { + "type" : "boolean" + }, + "updateInProgress" : { + "type" : "boolean" + }, + "backupInProgress" : { + "type" : "boolean" + }, + "updateSucceeded" : { + "type" : "boolean" + }, + "universePaused" : { + "type" : "boolean" + }, + "nextClusterIndex" : { + "type" : "integer", + "format" : "int32" + }, + "allowInsecure" : { + "type" : "boolean" + }, + "setTxnTableWaitCountFlag" : { + "type" : "boolean" + }, + "itestS3PackagePath" : { + "type" : "string" + }, + "remotePackagePath" : { + "type" : "string" + }, + "importedState" : { + "type" : "string", + "enum" : [ "NONE", "STARTED", "MASTERS_ADDED", "TSERVERS_ADDED", "IMPORTED" ] + }, + "capability" : { + "type" : "string", + "enum" : [ "READ_ONLY", "EDITS_ALLOWED" ] + }, + "taskType" : { + "type" : "string", + "enum" : [ "Everything", "Software", "GFlags", "Restart", "Certs" ] + }, + "ybSoftwareVersion" : { "type" : "string" }, - "version" : { - "type" : "integer", - "format" : "int32" - }, - "dnsName" : { - "type" : "string" + "certUUID" : { + "type" : "string", + "format" : "uuid" }, - "resources" : { - "$ref" : "#/definitions/UniverseResourceDetails" + "rotateRoot" : { + "type" : "boolean" }, - "universeDetails" : { - "$ref" : "#/definitions/UniverseDefinitionTaskParamsResp" + "masterGFlags" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } }, - "universeConfig" : { + "tserverGFlags" : { "type" : "object", "additionalProperties" : { "type" : "string" } }, - "taskUUID" : { - "type" : "string" + "sleepAfterMasterRestartMillis" : { + "type" : "integer", + "format" : "int32" }, - "sampleAppCommandTxt" : { - "type" : "string" + "sleepAfterTServerRestartMillis" : { + "type" : "integer", + "format" : "int32" }, - "pricePerHour" : { - "type" : "number", - "format" : "double" + "upgradeOption" : { + "type" : "string", + "enum" : [ "Rolling", "Non-Rolling", "Non-Restart" ] } } }, - "Customer" : { + "YWSuccess" : { "type" : "object", - "required" : [ "code", "creationDate", "customerId", "features", "name", "universeUUIDs", "uuid" ], + "required" : [ "message", "success" ], "properties" : { - "uuid" : { - "type" : "string", - "format" : "uuid" - }, - "code" : { - "type" : "string" + "success" : { + "type" : "boolean" }, - "name" : { + "message" : { "type" : "string" + } + } + }, + "Generic error response from Yugawware Platform API" : { + "type" : "object", + "required" : [ "success" ], + "properties" : { + "success" : { + "type" : "boolean" }, - "creationDate" : { + "error" : { "type" : "string", - "format" : "date-time" - }, - "features" : { - "$ref" : "#/definitions/JsonNode" - }, - "universeUUIDs" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "string", - "format" : "uuid" - } - }, - "customerId" : { - "type" : "integer", - "format" : "int64" + "example" : "There was a problem creating universe", + "description" : "User visible unstructurred error message" } } }, @@ -3650,6 +3594,68 @@ } } }, + "Customer" : { + "type" : "object", + "required" : [ "code", "creationDate", "customerId", "features", "name", "universeUUIDs", "uuid" ], + "properties" : { + "uuid" : { + "type" : "string", + "format" : "uuid" + }, + "code" : { + "type" : "string" + }, + "name" : { + "type" : "string" + }, + "creationDate" : { + "type" : "string", + "format" : "date-time" + }, + "features" : { + "$ref" : "#/definitions/JsonNode" + }, + "universeUUIDs" : { + "type" : "array", + "uniqueItems" : true, + "items" : { + "type" : "string", + "format" : "uuid" + } + }, + "customerId" : { + "type" : "integer", + "format" : "int64" + } + } + }, + "AvailabilityZoneData" : { + "type" : "object", + "required" : [ "code", "name", "subnet" ], + "properties" : { + "code" : { + "type" : "string" + }, + "name" : { + "type" : "string" + }, + "subnet" : { + "type" : "string" + } + } + }, + "AvailabilityZoneFormData" : { + "type" : "object", + "required" : [ "availabilityZones" ], + "properties" : { + "availabilityZones" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/AvailabilityZoneData" + } + } + } + }, "ConfigEntry" : { "type" : "object", "required" : [ "inherited", "key", "value" ], @@ -3700,6 +3706,18 @@ } } }, + "CustomerLoginFormData" : { + "type" : "object", + "required" : [ "email", "password" ], + "properties" : { + "email" : { + "type" : "string" + }, + "password" : { + "type" : "string" + } + } + }, "YWTask" : { "type" : "object", "required" : [ "taskUUID" ], @@ -3710,9 +3728,9 @@ } } }, - "CloudProviderFormData" : { + "KubernetesProviderFormData" : { "type" : "object", - "required" : [ "active", "code", "config", "name", "region" ], + "required" : [ "active", "code", "config", "name", "region", "regionList" ], "properties" : { "code" : { "type" : "string", @@ -3732,12 +3750,18 @@ }, "region" : { "type" : "string" + }, + "regionList" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/RegionData" + } } } }, - "AvailabilityZoneData" : { + "RegionData" : { "type" : "object", - "required" : [ "code", "name", "subnet" ], + "required" : [ "code", "config", "latitude", "longitude", "name", "zoneList" ], "properties" : { "code" : { "type" : "string" @@ -3745,20 +3769,100 @@ "name" : { "type" : "string" }, - "subnet" : { + "latitude" : { + "type" : "number", + "format" : "double" + }, + "longitude" : { + "type" : "number", + "format" : "double" + }, + "zoneList" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/ZoneData" + } + }, + "config" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + } + } + }, + "ZoneData" : { + "type" : "object", + "required" : [ "code", "config", "name" ], + "properties" : { + "code" : { + "type" : "string" + }, + "name" : { "type" : "string" + }, + "config" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } } } }, - "AvailabilityZoneFormData" : { + "CloudProviderFormData" : { "type" : "object", - "required" : [ "availabilityZones" ], + "required" : [ "active", "code", "config", "name", "region" ], "properties" : { - "availabilityZones" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AvailabilityZoneData" + "code" : { + "type" : "string", + "enum" : [ "unknown", "aws", "gcp", "azu", "docker", "onprem", "kubernetes", "local", "other" ] + }, + "name" : { + "type" : "string" + }, + "active" : { + "type" : "boolean" + }, + "config" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" } + }, + "region" : { + "type" : "string" + } + } + }, + "RegionFormData" : { + "type" : "object", + "required" : [ "code", "destVpcId", "hostVpcId", "hostVpcRegion", "latitude", "longitude", "name", "ybImage" ], + "properties" : { + "code" : { + "type" : "string" + }, + "name" : { + "type" : "string" + }, + "ybImage" : { + "type" : "string" + }, + "hostVpcRegion" : { + "type" : "string" + }, + "hostVpcId" : { + "type" : "string" + }, + "destVpcId" : { + "type" : "string" + }, + "latitude" : { + "type" : "number", + "format" : "double" + }, + "longitude" : { + "type" : "number", + "format" : "double" } } } diff --git a/managed/src/main/resources/v1.routes b/managed/src/main/resources/v1.routes index dc2010dfe5ad..ad99ef4c84bc 100644 --- a/managed/src/main/resources/v1.routes +++ b/managed/src/main/resources/v1.routes @@ -32,6 +32,7 @@ GET /customers/:cUUID/providers c GET /customers/:cUUID/providers/:pUUID/initialize com.yugabyte.yw.controllers.CloudProviderController.initialize(cUUID: java.util.UUID, pUUID: java.util.UUID) POST /customers/:cUUID/providers com.yugabyte.yw.controllers.CloudProviderController.create(cUUID: java.util.UUID) POST /customers/:cUUID/providers/kubernetes com.yugabyte.yw.controllers.CloudProviderController.createKubernetes(cUUID: java.util.UUID) +GET /customers/:cUUID/providers/suggested_kubernetes_config com.yugabyte.yw.controllers.CloudProviderController.getSuggestedKubernetesConfigs(cUUID: java.util.UUID) DELETE /customers/:cUUID/providers/:pUUID com.yugabyte.yw.controllers.CloudProviderController.delete(cUUID: java.util.UUID, pUUID: java.util.UUID) POST /customers/:cUUID/providers/:pUUID/bootstrap com.yugabyte.yw.controllers.CloudProviderController.bootstrap(cUUID: java.util.UUID, pUUID: java.util.UUID) POST /customers/:cUUID/providers/:pUUID/cleanup com.yugabyte.yw.controllers.CloudProviderController.cleanup(cUUID: java.util.UUID, pUUID: java.util.UUID) diff --git a/managed/src/test/java/com/yugabyte/yw/common/KubernetesManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/KubernetesManagerTest.java index c0b6a252b94e..74231cd29613 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/KubernetesManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/KubernetesManagerTest.java @@ -305,4 +305,32 @@ public void getServices() { "release=" + "demo-universe"), command.getValue()); } + + @Test + public void getNodeInfos() { + kubernetesManager.runGetNodeInfos(configProvider); + Mockito.verify(shellProcessHandler, times(1)) + .run(command.capture(), (Map) config.capture(), description.capture()); + assertEquals(ImmutableList.of("kubectl", "get", "nodes", "-o", "json"), command.getValue()); + } + + @Test + public void getSecret() { + kubernetesManager.runGetSecret(configProvider, "pull-sec", "test-ns"); + Mockito.verify(shellProcessHandler, times(1)) + .run(command.capture(), (Map) config.capture(), description.capture()); + assertEquals( + ImmutableList.of( + "kubectl", "get", "secret", "pull-sec", "-o", "json", "--namespace", "test-ns"), + command.getValue()); + } + + @Test + public void getSecretWithoutNamespace() { + kubernetesManager.runGetSecret(configProvider, "pull-sec", null); + Mockito.verify(shellProcessHandler, times(1)) + .run(command.capture(), (Map) config.capture(), description.capture()); + assertEquals( + ImmutableList.of("kubectl", "get", "secret", "pull-sec", "-o", "json"), command.getValue()); + } } diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/CloudProviderControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/CloudProviderControllerTest.java index eee2a9c17466..9c3d33275160 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/CloudProviderControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/CloudProviderControllerTest.java @@ -20,8 +20,10 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.libs.Json; @@ -43,11 +45,14 @@ import static play.test.Helpers.contentAsString; import static play.test.Helpers.*; +@RunWith(MockitoJUnitRunner.class) public class CloudProviderControllerTest extends FakeDBApplication { public static final Logger LOG = LoggerFactory.getLogger(CloudProviderControllerTest.class); @Mock Config mockConfig; + @Mock private play.Configuration appConfig; + Customer customer; Users user; @@ -88,6 +93,13 @@ private Result createKubernetesProvider(JsonNode bodyJson) { bodyJson); } + private Result getKubernetesSuggestedConfig() { + return FakeApiHelper.doRequestWithAuthToken( + "GET", + "/api/customers/" + customer.uuid + "/providers/suggested_kubernetes_config", + user.createAuthToken()); + } + private Result deleteProvider(UUID providerUUID) { return FakeApiHelper.doRequestWithAuthToken( "DELETE", @@ -376,6 +388,104 @@ public void testCreateKubernetesMultiRegionProviderFailure() { assertAuditEntry(0, customer.uuid); } + @Test + public void testGetK8sSuggestedConfig() { + testGetK8sSuggestedConfigBase(false); + } + + @Test + public void testGetK8sSuggestedConfigWithoutPullSecret() { + testGetK8sSuggestedConfigBase(true); + } + + private void testGetK8sSuggestedConfigBase(boolean noPullSecret) { + String pullSecretName = "pull-sec"; + String storageClassName = "ssd-class"; + // Was not able to get this working after trying various + // approaches, so added the values to application.test.conf + // directly + // when(mockAppConfig.getString("yb.kubernetes.storageClass")).thenReturn(storageClassName); + // when(mockAppConfig.getString("yb.kubernetes.pullSecretName")).thenReturn(pullSecretName); + + String nodeInfos = + "{\"items\": [" + + "{\"metadata\": {\"labels\": " + + "{\"failure-domain.beta.kubernetes.io/region\": \"deprecated\", " + + "\"failure-domain.beta.kubernetes.io/zone\": \"deprecated\", " + + "\"topology.kubernetes.io/region\": \"region-1\", \"topology.kubernetes.io/zone\": \"r1-az1\"}, " + + "\"name\": \"node-1\"}}, " + + "{\"metadata\": {\"labels\": " + + "{\"failure-domain.beta.kubernetes.io/region\": \"region-2\", " + + "\"failure-domain.beta.kubernetes.io/zone\": \"r2-az1\"}, " + + "\"name\": \"node-2\"}}, " + + "{\"metadata\": {\"labels\": " + + "{\"topology.kubernetes.io/region\": \"region-3\", \"topology.kubernetes.io/zone\": \"r3-az1\"}, " + + "\"name\": \"node-3\"}}" + + "]}"; + when(mockKubernetesManager.getNodeInfos(any())).thenReturn(Util.convertStringToJson(nodeInfos)); + + String secretContent = + "{\"metadata\": {" + + "\"annotations\": {\"kubectl.kubernetes.io/last-applied-configuration\": \"removed\"}, " + + "\"creationTimestamp\": \"2021-03-05\", \"name\": \"" + + pullSecretName + + "\", " + + "\"namespace\": \"testns\", " + + "\"resourceVersion\": \"118225713\", \"selfLink\": \"/api/v1/to-be-removed\", " + + "\"uid\": \"15fab1c4-3828-4783-b3b1-413c4e131bc7\"}, " + + "\"data\": {\".dockerconfigjson\": \"sec-key\"}}"; + if (noPullSecret) { + String msg = "Error from server (NotFound): secrets \"" + pullSecretName + "\" not found"; + when(mockKubernetesManager.getSecret(null, pullSecretName, null)) + .thenThrow(new RuntimeException(msg)); + } else { + when(mockKubernetesManager.getSecret(null, pullSecretName, null)) + .thenReturn(Util.convertStringToJson(secretContent)); + } + + Result result = getKubernetesSuggestedConfig(); + assertOk(result); + JsonNode json = Json.parse(contentAsString(result)); + + if (noPullSecret) { + assertTrue(json.path("config").isNull()); + } else { + String parsedSecret = + "{\"metadata\":{" + + "\"annotations\":{}," + + "\"name\":\"" + + pullSecretName + + "\"}," + + "\"data\":{\".dockerconfigjson\":\"sec-key\"}}"; + + assertValueAtPath(json, "/config/KUBECONFIG_IMAGE_PULL_SECRET_NAME", pullSecretName); + assertValueAtPath(json, "/config/KUBECONFIG_PULL_SECRET_NAME", pullSecretName); + assertValueAtPath(json, "/config/KUBECONFIG_PULL_SECRET_CONTENT", parsedSecret); + } + + assertValues( + json, + "code", + ImmutableList.of( + "kubernetes", "region-3", "r3-az1", "region-1", "r1-az1", "region-2", "r2-az1")); + assertValues(json, "STORAGE_CLASS", ImmutableList.of(storageClassName)); + } + + @Test + public void testGetKubernetesConfigsDiscoveryFailure() { + String nodeInfos = + "{\"items\": [" + + "{\"metadata\": {\"name\": \"node-1\"}}, " + + "{\"metadata\": {\"name\": \"node-2\"}}, " + + "{\"metadata\": {\"name\": \"node-3\"}}" + + "]}"; + when(mockKubernetesManager.getNodeInfos(any())).thenReturn(Util.convertStringToJson(nodeInfos)); + + Result result = + assertThrows(YWServiceException.class, () -> getKubernetesSuggestedConfig()).getResult(); + assertInternalServerError(result, "No region and zone information found."); + } + @Test public void testDeleteProviderWithAccessKey() { Provider p = ModelFactory.awsProvider(customer);