Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private CloudPassport processYamlFilesInClusterFolder(GitInfo gitInfo, Path clou
monitoringUri = monitoringUri.replace("${MONITORING_NAMESPACE}", cse.monitoringNamespace());
}
} else if (cse.monitoringNamespace() != null && MONITORING_TYPE_VICTORIA_DB.equals(cse.monitoringType())) {
monitoringUri = "http://vmsingle-k8s." + cse.monitoringNamespace() + ":8429";
monitoringUri = "https://vmsingle-" + cse.monitoringNamespace() + "." + cloud.cloudPublicHost();
}
}
Log.info("Monitoring URI: " + monitoringUri);
Expand All @@ -156,7 +156,7 @@ private CloudPassport processYamlFilesInClusterFolder(GitInfo gitInfo, Path clou
String dbaasUrl = null;
if (cloudPassportData.dbaas() != null) dbaasUrl = cloudPassportData.dbaas().apiDBaaSAddress();
Log.info("Cloud DBaaS URL: " + dbaasUrl);
return new CloudPassport(clusterName, token, cloudApiHost, environments, monitoringUri, gitInfo,
return new CloudPassport(clusterName, token, cloudApiHost, cloud.cloudPublicHost(), environments, monitoringUri, gitInfo,
cloud.cloudDashboardUrl(), dbaasUrl, cloud.cloudCmdbUrl(), argoUrl);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private void saveDataToCache(CloudPassport cloudPassport) {
}
cluster.setToken(cloudPassport.token());
cluster.setCloudApiHost(cloudPassport.cloudApiHost());
cluster.setCloudPublicHost(cloudPassport.cloudPublicHost());
cluster.setMonitoringUrl(cloudPassport.monitoringUrl());
cluster.setGitInfo(cloudPassport.gitInfo());
cluster.setDashboardUrl(cloudPassport.dashboardUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public InternalClusterInfoDto toDto(Cluster cluster) {
cluster.getName(),
cluster.getToken(),
cluster.getCloudApiHost(),
cluster.getCloudPublicHost(),
toLightDtos(cluster.getEnvironments()),
cluster.getMonitoringUrl()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Set;

public record CloudPassport(String name, String token, String cloudApiHost,
public record CloudPassport(String name, String token, String cloudApiHost, String cloudPublicHost,
Set<CloudPassportEnvironment> environments, String monitoringUrl, GitInfo gitInfo,
String dashboardUrl, String dbaasUrl, String deployerUrl, String argoUrl) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public record CloudData(
String cloudApiPort,
@JsonProperty("CLOUD_DEPLOY_TOKEN")
String cloudDeployToken,
@JsonProperty("CLOUD_PUBLIC_HOST")
String cloudPublicHost,
@JsonProperty("CLOUD_PROTOCOL")
String cloudProtocol,
@JsonProperty("CLOUD_DASHBOARD_URL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Cluster {
private String name;
private String token;
private String cloudApiHost;
private String cloudPublicHost;
private String monitoringUrl;
@Builder.Default
private List<Environment> environments = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public record InternalClusterInfoDto(
required = true
)
String cloudApiHost,
@Schema(
description = "Postfix for all ingresses in cloud",
examples = "gr7.eu-west-1.eks.amazonaws.com",
required = true
)
String cloudPublicHost,

@Schema(
description = "List of environments deployed on this cluster",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,21 @@ void get_cluster_internal_infos() {
.when().get("/colly/v2/inventory-service/internal/cluster-infos")
.then()
.statusCode(200)
.body("name", contains("test-cluster", "unreachable-cluster"))
.body(".", containsInAnyOrder(
allOf(
hasEntry("name", "test-cluster"),
hasEntry("token", "some_token_for_test_cluster"),
hasEntry("cloudApiHost", "https://1E4A399FCB54F505BBA05320EADF0DB3.gr7.eu-west-1.eks.amazonaws.com:443"),
hasEntry("cloudPublicHost", "gr7.eu-west-1.eks.amazonaws.com"),
hasEntry("monitoringUrl", "http://localhost:8428")
),
allOf(
hasEntry("name", "unreachable-cluster"),
hasEntry("token", "1234567890"),
hasEntry("cloudApiHost", "https://some.unreachable.url:8443"),
hasEntry("cloudPublicHost", "unreachable.url"),
hasEntry("monitoringUrl", "https://vmsingle-victoria.unreachable.url")
)))
.body("environments.flatten()", containsInAnyOrder(
hasEntry("name", "env-test"),
hasEntry("name", "env-metadata-test"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class CloudPassportLoaderTest {
private static final CloudPassport TEST_CLUSTER = new CloudPassport("test-cluster",
"some_token_for_test_cluster",
"https://1E4A399FCB54F505BBA05320EADF0DB3.gr7.eu-west-1.eks.amazonaws.com:443",
"gr7.eu-west-1.eks.amazonaws.com",
Set.of(new CloudPassportEnvironment(
"env-test",
"some env for tests",
Expand Down Expand Up @@ -78,6 +79,7 @@ class CloudPassportLoaderTest {
private static final CloudPassport UNREACHABLE_CLUSTER = new CloudPassport("unreachable-cluster",
"1234567890",
"https://some.unreachable.url:8443",
"unreachable.url",
Set.of(new CloudPassportEnvironment(
"env-1",
"some env for tests",
Expand All @@ -92,7 +94,7 @@ class CloudPassportLoaderTest {
null,
List.of(),
List.of())),
"http://vmsingle-k8s.victoria:8429",
"https://vmsingle-victoria.unreachable.url",
new GitInfo(new InstanceRepository("gitrepo_with_unreachable_cluster", "main", "43", "mb"), "target/test-cloud-passport-folder/2", "2"),
null,
null,
Expand Down Expand Up @@ -179,7 +181,7 @@ void test_read_cloud_passport_data(@TempDir Path tempDir) throws IOException {

@Test
void testParseTokenFromCredsFile_validYaml(@TempDir Path tempDir) throws IOException {
CloudData cloud = new CloudData(null, null, "tokenKey",
CloudData cloud = new CloudData(null, null, "tokenKey", null,
null, null, null);

CloudPassportData passportData = new CloudPassportData(cloud, null, null, null);
Expand All @@ -197,7 +199,7 @@ void testParseTokenFromCredsFile_validYaml(@TempDir Path tempDir) throws IOExcep

@Test
void testParseTokenFromCredsFile_missingSecretThrows(@TempDir Path tempDir) throws IOException {
CloudData cloud = new CloudData(null, null, "missingKey",
CloudData cloud = new CloudData(null, null, "missingKey", null,
null, null, null);

CloudPassportData passportData = new CloudPassportData(cloud, null, null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cloud:
CLOUD_API_HOST: 1E4A399FCB54F505BBA05320EADF0DB3.gr7.eu-west-1.eks.amazonaws.com
CLOUD_API_PORT: "443"
CLOUD_DEPLOY_TOKEN: cloud-deploy-sa-token
CLOUD_PUBLIC_HOST: gr7.eu-west-1.eks.amazonaws.com
CLOUD_PROTOCOL: https
PRODUCTION_MODE: "false"
SOME_UI_URL: https://som-ui.my-cluster.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cloud:
CLOUD_API_HOST: some.unreachable.url
CLOUD_API_PORT: "8443"
CLOUD_DEPLOY_TOKEN: cloud-deploy-sa-token
CLOUD_PUBLIC_HOST: unreachable.url
CLOUD_PROTOCOL: https
cse:
MONITORING_TYPE: VictoriaDB
Expand Down