diff options
Diffstat (limited to 'service-monitor/src/main/java/com/yahoo/vespa/service/duper/ZoneApplication.java')
-rw-r--r-- | service-monitor/src/main/java/com/yahoo/vespa/service/duper/ZoneApplication.java | 84 |
1 files changed, 80 insertions, 4 deletions
diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/ZoneApplication.java b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/ZoneApplication.java index 65198e72c89..70354c0f16d 100644 --- a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/ZoneApplication.java +++ b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/ZoneApplication.java @@ -1,9 +1,15 @@ // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.service.duper; +import com.yahoo.config.model.api.ServiceInfo; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.config.provision.ApplicationName; +import com.yahoo.config.provision.ClusterSpec; +import com.yahoo.config.provision.NodeType; +import com.yahoo.config.provision.TenantName; import com.yahoo.vespa.applicationmodel.ClusterId; import com.yahoo.vespa.applicationmodel.ServiceType; +import com.yahoo.vespa.service.model.ApplicationInstanceGenerator; import java.util.Objects; @@ -17,14 +23,84 @@ import java.util.Objects; public class ZoneApplication { private ZoneApplication() {} - public static final ApplicationId ZONE_APPLICATION_ID = InfraApplication + private static final ApplicationId ZONE_APPLICATION_ID = InfraApplication .createHostedVespaApplicationId("routing"); + private static final ClusterId NODE_ADMIN_CLUSTER_ID = new ClusterId("node-admin"); + private static final ClusterId ROUTING_CLUSTER_ID = new ClusterId("routing"); + + public static ApplicationId getApplicationId() { + return ZONE_APPLICATION_ID; + } + + public static TenantName getTenantName() { + return ZONE_APPLICATION_ID.tenant(); + } + + public static ApplicationName getApplicationName() { + return ZONE_APPLICATION_ID.application(); + } + + public static NodeType getNodeAdminNodeType() { + return NodeType.host; + } + + public static ClusterId getNodeAdminClusterId() { + return NODE_ADMIN_CLUSTER_ID; + } + + public static ClusterSpec.Type getNodeAdminClusterSpecType() { + return ClusterSpec.Type.container; + } + + public static ClusterSpec.Id getNodeAdminClusterSpecId() { + return new ClusterSpec.Id(getNodeAdminClusterId().s()); + } + + public static ServiceType getNodeAdminServiceType() { + return ServiceType.CONTAINER; + } + + public static int getNodeAdminHealthPort() { + return HostAdminApplication.HOST_ADMIN_HEALT_PORT; + } + + public static NodeType getRoutingNodeType() { + return NodeType.proxy; + } + + public static ClusterId getRoutingClusterId() { + return ROUTING_CLUSTER_ID; + } + + public static ClusterSpec.Type getRoutingClusterSpecType() { + return ClusterSpec.Type.container; + } + + public static ClusterSpec.Id getRoutingClusterSpecId() { + return new ClusterSpec.Id(getRoutingClusterId().s()); + } + + public static ServiceType getRoutingServiceType() { + return ServiceType.CONTAINER; + } + + public static int getRoutingHealthPort() { + return 4088; + } public static boolean isNodeAdminService(ApplicationId applicationId, ClusterId clusterId, ServiceType serviceType) { - return Objects.equals(applicationId, ZONE_APPLICATION_ID) && - Objects.equals(serviceType, ServiceType.CONTAINER) && - Objects.equals(clusterId, ClusterId.NODE_ADMIN); + return Objects.equals(applicationId, getApplicationId()) && + Objects.equals(serviceType, getNodeAdminServiceType()) && + Objects.equals(clusterId, getNodeAdminClusterId()); + } + + /** Whether a {@link ServiceInfo} belongs to the zone application's node-admin cluster. */ + public static boolean isNodeAdminServiceInfo(ApplicationId applicationId, ServiceInfo serviceInfo) { + return isNodeAdminService( + applicationId, + ApplicationInstanceGenerator.getClusterId(serviceInfo), + ApplicationInstanceGenerator.toServiceType(serviceInfo)); } } |