Controller extends AbstractComponent { public ZoneRegistry zoneRegistry() { return zoneRegistry; } @Inject  Controller(CuratorDb curator, RotationsConfig rotationsConfig, AccessControl accessControl, FlagSource flagSource,
                      MavenRepository mavenRepository, ServiceRegistry serviceRegistry, Metric metric, SecretStore secretStore,
                      ControllerConfig controllerConfig);  Controller(CuratorDb curator, RotationsConfig rotationsConfig, AccessControl accessControl,
                      Supplier<String> hostnameSupplier, FlagSource flagSource, MavenRepository mavenRepository,
                      ServiceRegistry serviceRegistry, Metric metric, SecretStore secretStore, ControllerConfig controllerConfig); TenantController tenants(); ApplicationController applications(); JobController jobController(); RoutingController routing(); ServiceRegistry serviceRegistry(); FlagSource flagSource(); Clock clock(); ZoneRegistry zoneRegistry(); NameServiceForwarder nameServiceForwarder(); MavenRepository mavenRepository(); ControllerConfig controllerConfig(); ApplicationView getApplicationView(String tenantName, String applicationName, String instanceName,
                                              String environment, String region); void updateVersionStatus(VersionStatus newStatus); VersionStatus versionStatus(); void removeConfidenceOverride(Predicate<Version> filter); Version systemVersion(); Optional<OsVersionTarget> osVersionTarget(CloudName cloud); Set<OsVersionTarget> osVersionTargets(); void upgradeOsIn(CloudName cloudName, Version version, Optional<Duration> upgradeBudget, boolean force); OsVersionStatus osVersionStatus(); void updateOsVersionStatus(OsVersionStatus newStatus); HostName hostname(); ConfigServerMetrics metrics(); SystemName system(); CuratorDb curator(); AuditLogger auditLogger(); Metric metric(); JobControl jobControl();  }
@Test public void testDeployWithCrossCloudEndpoints() { tester.controllerTester().zoneRegistry().setZones( ZoneApiMock.fromId("prod.us-west-1"), ZoneApiMock.newBuilder().with(CloudName.from("aws")).withId("prod.aws-us-east-1").build() ); var context = tester.newDeploymentContext(); var applicationPackage = new ApplicationPackageBuilder() .region("aws-us-east-1") .region("us-west-1") .endpoint("default", "default") .build(); try { context.submit(applicationPackage); fail("Expected exception"); } catch (IllegalArgumentException e) { assertEquals("Endpoint 'default' in instance 'default' cannot contain regions in different clouds: [aws-us-east-1, us-west-1]", e.getMessage()); } var applicationPackage2 = new ApplicationPackageBuilder() .region("aws-us-east-1") .region("us-west-1") .endpoint("aws", "default", "aws-us-east-1") .endpoint("foo", "default", "aws-us-east-1", "us-west-1") .build(); try { context.submit(applicationPackage2); fail("Expected exception"); } catch (IllegalArgumentException e) { assertEquals("Endpoint 'foo' in instance 'default' cannot contain regions in different clouds: [aws-us-east-1, us-west-1]", e.getMessage()); } }
@Test public void testDeployWithGlobalEndpointsAndMultipleRoutingMethods() { var context = tester.newDeploymentContext(); var zone1 = ZoneId.from("prod", "us-west-1"); var zone2 = ZoneId.from("prod", "us-east-3"); var applicationPackage = new ApplicationPackageBuilder() .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service")) .compileVersion(RoutingController.DIRECT_ROUTING_MIN_VERSION) .endpoint("default", "default", zone1.region().value(), zone2.region().value()) .endpoint("east", "default", zone2.region().value()) .region(zone1.region()) .region(zone2.region()) .build(); tester.controllerTester().zoneRegistry().setRoutingMethod(ZoneApiMock.from(zone1), RoutingMethod.shared, RoutingMethod.sharedLayer4); tester.controllerTester().zoneRegistry().setRoutingMethod(ZoneApiMock.from(zone2), RoutingMethod.shared, RoutingMethod.exclusive); context.submit(applicationPackage).deploy(); var expectedRecords = List.of( new Record(Record.Type.ALIAS, RecordName.from("application.tenant.us-east-3-w.vespa.oath.cloud"), new WeightedAliasTarget(HostName.from("lb-0--tenant:application:default--prod.us-east-3"), "dns-zone-1", ZoneId.from("prod.us-east-3"), 1).pack()), new Record(Record.Type.ALIAS, RecordName.from("east.application.tenant.global.vespa.oath.cloud"), new LatencyAliasTarget(HostName.from("application.tenant.us-east-3-w.vespa.oath.cloud"), "dns-zone-1", ZoneId.from("prod.us-east-3")).pack()), new Record(Record.Type.CNAME, RecordName.from("application--tenant.global.vespa.oath.cloud"), RecordData.from("rotation-fqdn-01.")), new Record(Record.Type.CNAME, RecordName.from("application.tenant.us-east-3.vespa.oath.cloud"), RecordData.from("lb-0--tenant:application:default--prod.us-east-3.")), new Record(Record.Type.CNAME, RecordName.from("east--application--tenant.global.vespa.oath.cloud"), RecordData.from("rotation-fqdn-02."))); assertEquals(expectedRecords, List.copyOf(tester.controllerTester().nameService().records())); }