SystemRoutingPolicyMaintainer extends ControllerMaintainer { @Override protected boolean maintain() { for (var zone : controller().zoneRegistry().zones().all().ids()) { for (var application : SystemApplication.values()) { if (!application.hasEndpoint()) continue; controller().routing().policies().refresh(application.id(), DeploymentSpec.empty, zone); } } return true; } SystemRoutingPolicyMaintainer(Controller controller, Duration interval);   }
@Test public void maintain() { var tester = new ControllerTester(); var updater = new SystemRoutingPolicyMaintainer(tester.controller(), Duration.ofDays(1)); var dispatcher = new NameServiceDispatcher(tester.controller(), Duration.ofDays(1), Integer.MAX_VALUE); var zone = ZoneId.from("prod", "us-west-1"); tester.zoneRegistry().exclusiveRoutingIn(ZoneApiMock.from(zone)); tester.configServer().putLoadBalancers(zone, List.of(new LoadBalancer("lb1", SystemApplication.configServer.id(), ClusterSpec.Id.from("config"), HostName.from("lb1.example.com"), LoadBalancer.State.active, Optional.of("dns-zone-1")))); updater.run(); dispatcher.run(); Set<Record> records = tester.nameService().records(); assertEquals(1, records.size()); Record record = records.iterator().next(); assertSame(Record.Type.CNAME, record.type()); assertEquals("cfg.prod.us-west-1.test.vip", record.name().asString()); assertEquals("lb1.example.com.", record.data().asString()); }