diff options
8 files changed, 48 insertions, 20 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java index 4df6ab52325..9922fd489fe 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java @@ -241,6 +241,7 @@ public class StorageMaintainer { maintainerExecutor.addJob("handle-core-dumps") .withArgument("doneCoredumpsPath", environment.pathInNodeAdminToDoneCoredumps()) .withArgument("coredumpsPath", environment.pathInNodeAdminFromPathInNode(containerName, "/home/y/var/crash")) + .withArgument("feedEndpoint", environment.getCoredumpFeedEndpoint()) .withArgument("attributes", attributes); maintainerExecutor.execute(); diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/Environment.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/Environment.java index 7f288dccb61..bc528f7393f 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/Environment.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/Environment.java @@ -37,6 +37,7 @@ public class Environment { private static final String LOGSTASH_NODES = "LOGSTASH_NODES"; private static final String ATHENS_DOMAIN = "ATHENS_DOMAIN"; private static final String RUNNING_LOCALLY = "RUNNING_LOCALLY"; + private static final String COREDUMP_FEED_ENDPOINT = "COREDUMP_FEED_ENDPOINT"; private final Set<String> configServerHosts; private final String environment; @@ -46,6 +47,7 @@ public class Environment { private final PathResolver pathResolver; private final List<String> logstashNodes; private final String athensDomain; + private final String feedEndpoint; private final boolean isRunningLocally; static { @@ -61,6 +63,7 @@ public class Environment { new PathResolver(), getLogstashNodesFromEnvironment(), getEnvironmentVariable(ATHENS_DOMAIN), + getEnvironmentVariable(COREDUMP_FEED_ENDPOINT), Optional.ofNullable(System.getenv(RUNNING_LOCALLY)).map(Boolean::valueOf).orElse(false)); } @@ -72,6 +75,7 @@ public class Environment { PathResolver pathResolver, List<String> logstashNodes, String athensDomain, + String feedEndpoint, boolean isRunningLocally) { this.configServerHosts = configServerHosts; this.environment = environment; @@ -81,6 +85,7 @@ public class Environment { this.pathResolver = pathResolver; this.logstashNodes = logstashNodes; this.athensDomain = athensDomain; + this.feedEndpoint = feedEndpoint; this.isRunningLocally = isRunningLocally; } @@ -134,6 +139,10 @@ public class Environment { return pathResolver; } + public String getCoredumpFeedEndpoint() { + return feedEndpoint; + } + public boolean isRunningLocally() { return isRunningLocally; } @@ -205,6 +214,7 @@ public class Environment { private PathResolver pathResolver; private List<String> logstashNodes = Collections.emptyList(); private String athensDomain; + private String feedEndpoint; private boolean isRunningLocally = false; public Builder configServerHosts(String... hosts) { @@ -247,6 +257,11 @@ public class Environment { return this; } + public Builder feedEndpoint(String feedEndpoint) { + this.feedEndpoint = feedEndpoint; + return this; + } + public Builder isRunningLocally(boolean isRunningLocally) { this.isRunningLocally = isRunningLocally; return this; @@ -254,7 +269,7 @@ public class Environment { public Environment build() { return new Environment(configServerHosts, environment, region, parentHostHostname, inetAddressResolver, - pathResolver, logstashNodes, athensDomain, isRunningLocally); + pathResolver, logstashNodes, athensDomain, feedEndpoint, isRunningLocally); } } } diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/LocalZoneUtils.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/LocalZoneUtils.java index 219fcb4a41c..b79207444de 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/LocalZoneUtils.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/LocalZoneUtils.java @@ -97,6 +97,7 @@ public class LocalZoneUtils { .withEnvironment("REGION", environment.getRegion()) .withEnvironment("CONFIG_SERVER_ADDRESS", CONFIG_SERVER_HOSTNAME) .withEnvironment("ATHENS_DOMAIN", "fake.env") + .withEnvironment("COREDUMP_FEED_ENDPOINT", "http://feed-endpoint.hostname.tld/feed") .withEnvironment("RUNNING_LOCALLY", "true") .withUlimit("nofile", 262_144, 262_144) .withUlimit("nproc", 32_768, 409_600) diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java index 2a641ae2356..9f2feea0ca1 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandler.java @@ -28,7 +28,7 @@ import java.util.stream.Collectors; * @author freva */ public class CoredumpHandler { - public static final String FEED_ENDPOINT = "http://panic.vespa.us-west-1.prod.vespa.yahooapis.com:4080/document/v1/panic/core_dump/docid"; + public static final String PROCESSING_DIRECTORY_NAME = "processing"; public static final String METADATA_FILE_NAME = "metadata.json"; @@ -41,15 +41,17 @@ public class CoredumpHandler { private final Path doneCoredumpsPath; private final Map<String, Object> nodeAttributes; private final Optional<Path> yinstStatePath; + private final String feedEndpoint; public CoredumpHandler(HttpClient httpClient, CoreCollector coreCollector, Path coredumpsPath, Path doneCoredumpsPath, - Map<String, Object> nodeAttributes, Optional<Path> yinstStatePath) { + Map<String, Object> nodeAttributes, Optional<Path> yinstStatePath, String feedEndpoint) { this.httpClient = httpClient; this.coreCollector = coreCollector; this.coredumpsPath = coredumpsPath; this.doneCoredumpsPath = doneCoredumpsPath; this.nodeAttributes = nodeAttributes; this.yinstStatePath = yinstStatePath; + this.feedEndpoint = feedEndpoint; } public void processAll() throws IOException { @@ -140,7 +142,7 @@ public class CoredumpHandler { // Use core dump UUID as document ID String documentId = coredumpDirectory.getFileName().toString(); - HttpPost post = new HttpPost(FEED_ENDPOINT + "/" + documentId); + HttpPost post = new HttpPost(feedEndpoint + "/" + documentId); post.setHeader(HttpHeaders.CONTENT_TYPE, "application/json"); post.setEntity(new StringEntity(metadata)); @@ -157,4 +159,5 @@ public class CoredumpHandler { void finishProcessing(Path coredumpDirectory) throws IOException { Files.move(coredumpDirectory, doneCoredumpsPath.resolve(coredumpDirectory.getFileName())); } + } diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/Maintainer.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/Maintainer.java index dac6b293942..97c6457e49c 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/Maintainer.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/Maintainer.java @@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger; * @author freva */ public class Maintainer { + private static final CoreCollector coreCollector = new CoreCollector(new ProcessExecuter()); private static final HttpClient httpClient = createHttpClient(Duration.ofSeconds(5)); @@ -142,10 +143,12 @@ public class Maintainer { Path doneCoredumpsPath = Paths.get(getFieldOrFail(arguments, "doneCoredumpsPath").asString()); Map<String, Object> attributesMap = parseMap(arguments); Optional<Path> yinstStatePath = SlimeUtils.optionalString(arguments.field("yinstStatePath")).map(Paths::get); + String feedEndpoint = getFieldOrFail(arguments, "feedEndpoint").asString(); try { - CoredumpHandler coredumpHandler = new CoredumpHandler(httpClient, coreCollector, - coredumpsPath, doneCoredumpsPath, attributesMap, yinstStatePath); + CoredumpHandler coredumpHandler = new CoredumpHandler(httpClient, coreCollector, coredumpsPath, + doneCoredumpsPath, attributesMap, yinstStatePath, + feedEndpoint); coredumpHandler.processAll(); } catch (IOException e) { throw new RuntimeException("Failed processing coredumps at " + coredumpsPath.toAbsolutePath() + @@ -194,4 +197,5 @@ public class Maintainer { .build()) .build(); } + } diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java index faf2e03d068..13a6f7b334b 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java @@ -42,6 +42,7 @@ import static org.mockito.Mockito.when; * @author freva */ public class CoredumpHandlerTest { + private final HttpClient httpClient = mock(HttpClient.class); private final CoreCollector coreCollector = mock(CoreCollector.class); private static final Map<String, Object> attributes = new LinkedHashMap<>(); @@ -53,6 +54,7 @@ public class CoredumpHandlerTest { "\"vespa_version\":\"6.48.4\"," + "\"kernel_version\":\"2.6.32-573.22.1.el6.YAHOO.20160401.10.x86_64\"," + "\"docker_image\":\"vespa/ci:6.48.4\"}}"; + private static final String feedEndpoint = "http://feed-endpoint.hostname.tld/feed"; static { attributes.put("hostname", "host123.yahoo.com"); @@ -76,7 +78,8 @@ public class CoredumpHandlerTest { crashPath = folder.newFolder("crash").toPath(); donePath = folder.newFolder("done").toPath(); - coredumpHandler = new CoredumpHandler(httpClient, coreCollector, crashPath, donePath, attributes, Optional.empty()); + coredumpHandler = new CoredumpHandler(httpClient, coreCollector, crashPath, donePath, attributes, + Optional.empty(), feedEndpoint); } @Test @@ -207,10 +210,11 @@ public class CoredumpHandlerTest { ArgumentCaptor<HttpPost> capturedPost = ArgumentCaptor.forClass(HttpPost.class); verify(httpClient).execute(capturedPost.capture()); - URI expectedURI = new URI(CoredumpHandler.FEED_ENDPOINT + "/" + documentId); + URI expectedURI = new URI(feedEndpoint + "/" + documentId); assertEquals(expectedURI, capturedPost.getValue().getURI()); assertEquals("application/json", capturedPost.getValue().getHeaders(HttpHeaders.CONTENT_TYPE)[0].getValue()); assertEquals(expectedBody, new BufferedReader(new InputStreamReader(capturedPost.getValue().getEntity().getContent())).readLine()); } + } diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/DummyInstanceLookupService.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/DummyInstanceLookupService.java index 8fc6f27d3d9..135aa61af5c 100644 --- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/DummyInstanceLookupService.java +++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/DummyInstanceLookupService.java @@ -29,9 +29,9 @@ import java.util.stream.Collectors; */ public class DummyInstanceLookupService implements InstanceLookupService { - public static final HostName TEST1_HOST_NAME = new HostName("test1.prod.utpoia-1.vespahosted.ut1.yahoo.com"); - public static final HostName TEST3_HOST_NAME = new HostName("test3.prod.utpoia-1.vespahosted.ut1.yahoo.com"); - public static final HostName TEST6_HOST_NAME = new HostName("test6.prod.us-east-1.vespahosted.ne1.yahoo.com"); + public static final HostName TEST1_HOST_NAME = new HostName("test1.hostname.tld"); + public static final HostName TEST3_HOST_NAME = new HostName("test3.hostname.tld"); + public static final HostName TEST6_HOST_NAME = new HostName("test6.hostname.tld"); private static final Set<ApplicationInstance<ServiceMonitorStatus>> apps = new HashSet<>(); @@ -50,7 +50,7 @@ public class DummyInstanceLookupService implements InstanceLookupService { ServiceMonitorStatus.UP), new ServiceInstance<>( new ConfigId("storage/storage/2"), - new HostName("test2.prod.utopoia-1.vespahosted.ut1.yahoo.com"), + new HostName("test2.hostname.tld"), ServiceMonitorStatus.UP))), new ServiceCluster<>( new ClusterId("clustercontroller"), @@ -58,7 +58,7 @@ public class DummyInstanceLookupService implements InstanceLookupService { TestUtil.makeServiceInstanceSet( new ServiceInstance<>( new ConfigId("clustercontroller-1"), - new HostName("myclustercontroller.prod.utopia-1.vespahosted.ut1.yahoo.com"), + new HostName("myclustercontroller.hostname.tld"), ServiceMonitorStatus.UP))) ) @@ -78,7 +78,7 @@ public class DummyInstanceLookupService implements InstanceLookupService { ServiceMonitorStatus.UP), new ServiceInstance<>( new ConfigId("storage/storage/4"), - new HostName("test4.prod.utpoia-1.vespahosted.ut1.yahoo.com"), + new HostName("test4.hostname.tld"), ServiceMonitorStatus.UP))), new ServiceCluster<>( new ClusterId("clustercontroller"), @@ -86,7 +86,7 @@ public class DummyInstanceLookupService implements InstanceLookupService { TestUtil.makeServiceInstanceSet( new ServiceInstance<>( new ConfigId("clustercontroller-1"), - new HostName("myclustercontroller2.prod.utopia-1.vespahosted.ut1.yahoo.com"), + new HostName("myclustercontroller2.hostname.tld"), ServiceMonitorStatus.UP))) ) ) @@ -106,7 +106,7 @@ public class DummyInstanceLookupService implements InstanceLookupService { ServiceMonitorStatus.UP), new ServiceInstance<>( new ConfigId("storage/storage/4"), - new HostName("test4.prod.utpoia-1.vespahosted.ut1.yahoo.com"), + new HostName("test4.hostname.tld"), ServiceMonitorStatus.UP))), new ServiceCluster<>( new ClusterId("clustercontroller"), @@ -114,7 +114,7 @@ public class DummyInstanceLookupService implements InstanceLookupService { TestUtil.makeServiceInstanceSet( new ServiceInstance<>( new ConfigId("clustercontroller-1"), - new HostName("myclustercontroller3.prod.utopia-1.vespahosted.ut1.yahoo.com"), + new HostName("myclustercontroller3.hostname.tld"), ServiceMonitorStatus.UP))) ) )); diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/OrchestratorImplTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/OrchestratorImplTest.java index 448ae78a21a..aea310932d1 100644 --- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/OrchestratorImplTest.java +++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/OrchestratorImplTest.java @@ -256,11 +256,11 @@ public class OrchestratorImplTest { assertEquals(e.getSuppressed().length, 1); assertEquals("Failed to suspend NodeGroup{application=tenant-id-3:application-instance-3:prod:utopia-1:default, " + - "hostNames=[test6.prod.us-east-1.vespahosted.ne1.yahoo.com]} with parent host parentHostname: " + - "Changing the state of test6.prod.us-east-1.vespahosted.ne1.yahoo.com would violate " + + "hostNames=[test6.hostname.tld]} with parent host parentHostname: " + + "Changing the state of test6.hostname.tld would violate " + "some-constraint: error message; With suppressed throwable " + "com.yahoo.vespa.orchestrator.policy.HostStateChangeDeniedException: " + - "Changing the state of test1.prod.utpoia-1.vespahosted.ut1.yahoo.com " + + "Changing the state of test1.hostname.tld " + "would violate foo1-constraint: foo1-message", e.getMessage()); } |