private static Zone getZone() { if (!isConfigServer()) { return Zone.defaultZone(); } CloudConfigInstallVariables cloudConfigVariables = new CloudConfigInstallVariables(); if (!cloudConfigVariables.hostedVespa().orElse(false)) { return Zone.defaultZone(); } RegionName region = cloudConfigVariables.region().map(RegionName::from).orElseGet(RegionName::defaultName); Environment environment = cloudConfigVariables.environment().map(Environment::from).orElseGet(Environment::defaultEnvironment); SystemName system = cloudConfigVariables.system().map(SystemName::from).orElseGet(SystemName::defaultSystem); return new Zone(system, environment, region); }
/** Do not use */ public static Zone defaultZone() { return new Zone(SystemName.defaultSystem(), Environment.defaultEnvironment(), RegionName.defaultName()); }
public void setContainerCluster(ContainerCluster containerCluster) { this.containerCluster = containerCluster; // If we are in a config server cluster the correct zone is propagated through cloud config options, // not through config to deployment options (see StandaloneContainerApplication.scala), // so we need to propagate the zone options into the container from here Environment environment = options.environment().isPresent() ? Environment.from(options.environment().get()) : Environment.defaultEnvironment(); RegionName region = options.region().isPresent() ? RegionName.from(options.region().get()) : RegionName.defaultName(); SystemName system = options.system().isPresent() ? SystemName.from(options.system().get()) : SystemName.defaultSystem(); containerCluster.setZone(new Zone(system, environment, region)); }