public VespaModelFactory(Version version, ConfigModelRegistry configModelRegistry, Clock clock) { this.version = version; if (configModelRegistry == null) { this.configModelRegistry = new NullConfigModelRegistry(); log.info("Will not load config models from plugins, as no registry is available"); } else { this.configModelRegistry = configModelRegistry; } this.modelImporters = Collections.emptyList(); this.zone = Zone.defaultZone(); this.clock = clock; }
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); }
/** * Constructor * @param flavors flavors to have in node repo */ public MockNodeRepository(MockCurator curator, NodeFlavors flavors) { super(flavors, curator, Clock.fixed(Instant.ofEpochMilli(123), ZoneId.of("Z")), Zone.defaultZone(), new MockNameResolver() .addRecord("test-container-1", "::2") .mockAnyLookup(), new DockerImage("docker-registry.domain.tld:8080/dist/vespa"), true); this.flavors = flavors; curator.setZooKeeperEnsembleConnectionSpec("cfg1:1234,cfg2:1234,cfg3:1234"); populate(); }
/** * Returns the distribution bits this cluster should use. * On Hosted Vespa this is hardcoded and not computed from the nodes because reducing the number of nodes is a common * operation, while reducing the number of distribution bits can lead to consistency problems. * This hardcoded value should work fine from 1-200 nodes. Those who have more will need to set this value * in config and not remove it again if they reduce the node count. */ public int distributionBits() { if (zone.environment() == Environment.prod && ! zone.equals(Zone.defaultZone())) { return 16; } else { // hosted test zone, or self-hosted system // hosted test zones: have few nodes and use visiting in tests: This is slow with 16 bits (to many buckets) // self hosted systems: should probably default to 16 bits, but the transition may cause problems return DistributionBitCalculator.getDistributionBits(getNodeCountPerGroup(), getDistributionMode()); } }
private void populate() { NodeRepositoryProvisioner provisioner = new NodeRepositoryProvisioner(this, flavors, Zone.defaultZone(), new MockProvisionServiceProvider()); List<Node> nodes = new ArrayList<>();
this.name = name; this.isHostedVespa = stateIsHosted(deployState); this.zone = (deployState != null) ? deployState.zone() : Zone.defaultZone(); componentGroup = new ComponentGroup<>(this, "component"); restApiGroup = new ConfigProducerGroup<>(this, "rest-api");