- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.yahoo.config.provision.Zone.environment()
方法的一些代码示例,展示了Zone.environment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zone.environment()
方法的具体详情如下:
包路径:com.yahoo.config.provision.Zone
类名称:Zone
方法名:environment
[英]Returns the current environment
[中]返回当前环境
代码示例来源:origin: com.yahoo.vespa/node-repository
/**
* Whether or not the nodes requested can share physical host with other applications.
* A security feature which only makes sense for prod.
*/
public boolean decideExclusivity(boolean requestedExclusivity) {
return requestedExclusivity && zone.environment() == Environment.prod;
}
代码示例来源:origin: com.yahoo.vespa/node-repository
/**
* Throw if the node count is 1 for container and content clusters and we're in a production zone
*
* @return the argument node count
* @throws IllegalArgumentException if only one node is requested and we can fail
*/
private int ensureRedundancy(int nodeCount, ClusterSpec.Type clusterType, boolean canFail) {
if (canFail &&
nodeCount == 1 &&
Arrays.asList(ClusterSpec.Type.container, ClusterSpec.Type.content).contains(clusterType) &&
zone.environment().isProduction())
throw new IllegalArgumentException("Deployments to prod require at least 2 nodes per cluster for redundancy");
return nodeCount;
}
代码示例来源:origin: com.yahoo.vespa/config-application-package
private void preprocessXML(File destination, File inputXml, Zone zone) throws ParserConfigurationException, TransformerException, SAXException, IOException {
Document document = new XmlPreProcessor(appDir, inputXml, zone.environment(), zone.region()).run();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
try (FileOutputStream outputStream = new FileOutputStream(destination)) {
transformer.transform(new DOMSource(document), new StreamResult(outputStream));
}
}
代码示例来源:origin: com.yahoo.vespa/node-repository
/** Returns whether the current node fail count should be used as an indicator of hardware issue */
private boolean failCountIndicatesHardwareIssue(Node node) {
if (node.flavor().getType() == Flavor.Type.DOCKER_CONTAINER) return false;
return (zone.environment() == Environment.prod || zone.environment() == Environment.staging) &&
node.status().failCount() >= maxAllowedFailures;
}
代码示例来源:origin: com.yahoo.vespa/node-repository
public int decideSize(Capacity requestedCapacity, ClusterSpec.Type clusterType) {
int requestedNodes = ensureRedundancy(requestedCapacity.nodeCount(), clusterType, requestedCapacity.canFail());
if (requestedCapacity.isRequired()) return requestedNodes;
switch(zone.environment()) {
case dev : case test : return 1;
case perf : return Math.min(requestedCapacity.nodeCount(), 3);
case staging: return requestedNodes <= 1 ? requestedNodes : Math.max(2, requestedNodes / 10);
case prod : return requestedNodes;
default : throw new IllegalArgumentException("Unsupported environment " + zone.environment());
}
}
代码示例来源:origin: com.yahoo.vespa/node-repository
public FailedExpirer(NodeRepository nodeRepository, Zone zone, Clock clock, Duration interval,
JobControl jobControl) {
super(nodeRepository, interval, jobControl);
this.nodeRepository = nodeRepository;
this.zone = zone;
this.clock = clock;
if (zone.system() == SystemName.main) {
if (zone.environment() == Environment.staging || zone.environment() == Environment.test) {
defaultExpiry = Duration.ofHours(1);
} else {
defaultExpiry = Duration.ofDays(4);
}
containerExpiry = Duration.ofHours(1);
} else {
defaultExpiry = containerExpiry = Duration.ofMinutes(30);
}
}
代码示例来源:origin: com.yahoo.vespa/config-model
private boolean zoneHasActiveRotation(Zone zone, DeploymentSpec spec) {
return spec.zones().stream()
.anyMatch(declaredZone -> declaredZone.deploysTo(zone.environment(), Optional.of(zone.region())) &&
declaredZone.active());
}
代码示例来源:origin: com.yahoo.vespa/config-model
private String getConfigserverIdentityName() {
return String.format("%s.provider_%s_%s",
zone.system() == SystemName.main ? "vespa.vespa" : "vespa.vespa.cd",
zone.environment().value(),
zone.region().value());
}
}
代码示例来源:origin: com.yahoo.vespa/node-repository
@Override
public boolean isActive() {
if(zone.system() == SystemName.cd) {
return zone.environment() == Environment.dev || zone.environment() == Environment.prod;
}
if (zone.system() == SystemName.main) {
if (zone.region().equals(RegionName.from("us-east-3"))) {
return zone.environment() == Environment.perf || zone.environment() == Environment.prod;
} else if (zone.region().equals(RegionName.from("us-west-1"))) {
return zone.environment() == Environment.prod;
} else if (zone.region().equals(RegionName.from("us-central-1"))) {
return zone.environment() == Environment.prod;
} else if (zone.region().equals(RegionName.from("ap-southeast-1"))) {
return zone.environment() == Environment.prod;
} else if (zone.region().equals(RegionName.from("ap-northeast-1"))) {
return zone.environment() == Environment.prod;
} else if (zone.region().equals(RegionName.from("ap-northeast-2"))) {
return zone.environment() == Environment.prod;
} else if (zone.region().equals(RegionName.from("eu-west-1"))) {
return zone.environment() == Environment.prod;
}
}
return false;
}
代码示例来源:origin: com.yahoo.vespa/node-repository
@Inject
public NodeRepositoryProvisioner(NodeRepository nodeRepository, NodeFlavors flavors, Zone zone,
ProvisionServiceProvider provisionServiceProvider) {
this.nodeRepository = nodeRepository;
this.capacityPolicies = new CapacityPolicies(zone, flavors);
this.zone = zone;
this.preparer = new Preparer(nodeRepository, zone.environment().equals(Environment.prod)
? SPARE_CAPACITY_PROD
: SPARE_CAPACITY_NONPROD);
this.activator = new Activator(nodeRepository);
this.loadBalancerProvisioner = provisionServiceProvider.getLoadBalancerService().map(lbService ->
new LoadBalancerProvisioner(nodeRepository, lbService));
}
代码示例来源:origin: com.yahoo.vespa/node-repository
public Flavor decideFlavor(Capacity requestedCapacity, ClusterSpec cluster) {
// for now, always use the requested flavor if a docker flavor is requested
Optional<String> requestedFlavor = requestedCapacity.flavor();
if (requestedFlavor.isPresent() &&
flavors.getFlavorOrThrow(requestedFlavor.get()).getType() == Flavor.Type.DOCKER_CONTAINER)
return flavors.getFlavorOrThrow(requestedFlavor.get());
String defaultFlavorName = zone.defaultFlavor(cluster.type());
if (zone.system() == SystemName.cd)
return flavors.getFlavorOrThrow(requestedFlavor.orElse(defaultFlavorName));
switch(zone.environment()) {
case dev : case test : case staging : return flavors.getFlavorOrThrow(defaultFlavorName);
default : return flavors.getFlavorOrThrow(requestedFlavor.orElse(defaultFlavorName));
}
}
代码示例来源:origin: com.yahoo.vespa/node-repository
/** Returns whether to reboot node as part of transition to given state. This is done to get rid of any lingering
* unwanted state (e.g. processes) on non-host nodes. */
private boolean rebootOnTransitionTo(Node.State state, Node node) {
if (node.type().isDockerHost()) return false; // Reboot of host nodes is handled by NodeRebooter
if (zone.environment().isTest()) return false; // We want to reuse nodes quickly in test environments
return node.state() != Node.State.dirty && state == Node.State.dirty;
}
代码示例来源:origin: com.yahoo.vespa/node-repository
private boolean checkForClashingParentHost() {
return nodeRepository.zone().system() == SystemName.main && nodeRepository.zone().environment().isProduction();
}
代码示例来源:origin: com.yahoo.vespa/config-model
@Override
public void validate(VespaModel model, DeployState deployState) {
if (! deployState.isHosted()) return;
if (! deployState.zone().environment().isProduction()) return;
if (model.getAdmin().getApplicationType() != ApplicationType.DEFAULT) return;
List<String> offendingClusters = new ArrayList<>();
for (ContainerCluster cluster : model.getContainerClusters().values()) {
if (cluster.getHttp() == null
|| ! cluster.getHttp().getAccessControl().isPresent()
|| ! cluster.getHttp().getAccessControl().get().writeEnabled)
if (hasHandlerThatNeedsProtection(cluster) || ! cluster.getAllServlets().isEmpty())
offendingClusters.add(cluster.getName());
}
if (! offendingClusters.isEmpty())
throw new IllegalArgumentException(
"Access-control must be enabled for write operations to container clusters in production zones: " +
mkString(offendingClusters, "[", ", ", "]."));
}
代码示例来源:origin: com.yahoo.vespa/config-model
private void addIdentityProvider(ContainerCluster cluster,
List<ConfigServerSpec> configServerSpecs,
HostName loadBalancerName,
URI ztsUrl,
String athenzDnsSuffix,
Zone zone,
DeploymentSpec spec) {
spec.athenzDomain().ifPresent(domain -> {
AthenzService service = spec.athenzService(zone.environment(), zone.region())
.orElseThrow(() -> new RuntimeException("Missing Athenz service configuration"));
String zoneDnsSuffix = zone.environment().value() + "-" + zone.region().value() + "." + athenzDnsSuffix;
IdentityProvider identityProvider = new IdentityProvider(domain, service, getLoadBalancerName(loadBalancerName, configServerSpecs), ztsUrl, zoneDnsSuffix, zone);
cluster.addComponent(identityProvider);
cluster.getContainers().forEach(container -> {
container.setProp("identity.domain", domain.value());
container.setProp("identity.service", service.value());
});
});
}
代码示例来源:origin: com.yahoo.vespa/config-model
/**
* 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());
}
}
代码示例来源:origin: com.yahoo.vespa/node-repository
private String getHostFromVespaCertificate(List<SubjectAlternativeName> sans) {
// TODO Remove this branch once all BM nodes are gone
if (sans.stream().anyMatch(san -> san.getValue().endsWith("ostk.yahoo.cloud"))) {
return getHostFromCalypsoCertificate(sans);
}
VespaUniqueInstanceId instanceId = VespaUniqueInstanceId.fromDottedString(getUniqueInstanceId(sans));
if (!zone.environment().value().equals(instanceId.environment()))
throw new NodeIdentifierException("Invalid environment: " + instanceId.environment());
if (!zone.region().value().equals(instanceId.region()))
throw new NodeIdentifierException("Invalid region(): " + instanceId.region());
List<Node> applicationNodes =
nodeRepository.getNodes(ApplicationId.from(instanceId.tenant(), instanceId.application(), instanceId.instance()));
return applicationNodes.stream()
.filter(
node -> node.allocation()
.map(allocation -> allocation.membership().index() == instanceId.clusterIndex()
&& allocation.membership().cluster().id().value().equals(instanceId.clusterId()))
.orElse(false))
.map(Node::hostname)
.findFirst()
.orElseThrow(() -> new NodeIdentifierException("Could not find any node with instance id: " + instanceId.asDottedString()));
}
代码示例来源:origin: com.yahoo.vespa/config-model
/**
* Returns a config server config containing the right zone settings (and defaults for the rest).
* This is useful to allow applications to find out in which zone they are runnung by having the Zone
* object (which is constructed from this config) injected.
*/
@Override
public void getConfig(ConfigserverConfig.Builder builder) {
builder.system(zone.system().name());
builder.environment(zone.environment().value());
builder.region(zone.region().value());
}
代码示例来源:origin: com.yahoo.vespa/config-model
private SentinelConfig.Application.Builder getApplicationConfig() {
SentinelConfig.Application.Builder builder = new SentinelConfig.Application.Builder();
builder.tenant(applicationId.tenant().value());
builder.name(applicationId.application().value());
builder.environment(zone.environment().value());
builder.region(zone.region().value());
builder.instance(applicationId.instance().value());
return builder;
}
代码示例来源:origin: com.yahoo.vespa/config-model
private void addClusterContent(ContainerCluster cluster, Element spec, ConfigModelContext context) {
DeployState deployState = context.getDeployState();
DocumentFactoryBuilder.buildDocumentFactories(cluster, spec);
addConfiguredComponents(deployState, cluster, spec);
addSecretStore(cluster, spec);
addHandlers(deployState, cluster, spec);
addRestApis(deployState, spec, cluster);
addServlets(deployState, spec, cluster);
addProcessing(deployState, spec, cluster);
addSearch(deployState, spec, cluster);
addModelEvaluation(spec, cluster, context);
addDocproc(deployState, spec, cluster);
addDocumentApi(spec, cluster); // NOTE: Must be done after addSearch
addDefaultHandlers(cluster);
addStatusHandlers(cluster, context);
addHttp(deployState, spec, cluster);
addAccessLogs(deployState, cluster, spec);
addRoutingAliases(cluster, spec, deployState.zone().environment());
addNodes(cluster, spec, context);
addClientProviders(deployState, spec, cluster);
addServerProviders(deployState, spec, cluster);
addAthensCopperArgos(cluster, context); // Must be added after nodes.
}
我不小心删除了 Provisioning Portal 中的 Team Provisioning Profile:*,我现在该怎么办? :/ 最佳答案 我有一台安装了 Xcode 4.2 的 MacB
我可以从 Apple Provisioning Portal 安全地删除分发配置文件而不影响应用程序商店中的应用程序吗? 最佳答案 是的。您的分发证书和配置文件仅用于向 Apple 提交应用程序。应用
我正在使用 Corona 创建游戏,但要为 iOS 构建应用程序,我需要在 Corona 中指定要使用的配置文件(我必须将其复制到特定文件夹)。 他们声明开发或临时配置文件都可以工作。 如何创建虚假的
刚刚知道苹果开发者计划有两种,即标准版和企业版。目前我们使用标准开发者计划。 在这两个开发人员计划中,我们将能够创建开发配置文件和证书。 但是,标准开发配置文件和企业开发配置文件之间有什么区别吗? 如
我正在尝试使用 xcodebuild 自动化我们的构建过程,并尝试在创建 IPA 之前存档构建,但我收到以下错误: Check dependencies Provisioning profile "i
我正在尝试创建可以稍后根据需要调整大小的 pvc。 我正在使用来自 github 的代码 mongodb pvc . 我按照所有步骤创建了 pvc,如下所示: PS C:\Users> minikub
我正在尝试创建可以稍后根据需要调整大小的 pvc。 我正在使用来自 github 的代码 mongodb pvc . 我按照所有步骤创建了 pvc,如下所示: PS C:\Users> minikub
过去几天我一直在尝试构建一个 Azure Pipeline,它构建一个 iOS 项目并将其部署到 Test-flight。我已经能够让它成功构建并生成 .ipa 但我一直在 AppStoreRelea
我正在尝试使用 visual studio 在分发模式下在 ios cordova 应用程序上运行我的应用程序。 构建失败并出现以下错误。 No matching provisioning prof
当我上传到 Application Loader 时,我收到以下消息: ERROR ITMS-90174: "Missing Provisioning Profile - iOS Apps must
我们将ruby微服务移至kubernetes,并且过去将特定于环境的配置保存在config/application.yml中。使用kubernetes,您可以为每个服务创建特定于环境的文件,例如con
我需要一种使用正则引号的简单方法 "在 provisioner "remote-exec"我的地形脚本块。只有 "将适用于我想做的事情,只是尝试 \"不起作用。让 terraform 从字面上解释我的
目前我正在从 puppet 切换到 Ansible 我对一些概念或至少 ansible 的工作方式有点困惑。 有关设置的一些信息: 我正在使用 Ansible Best Practices 中的示例并
从Xcode 7.3升级到Xcode 8后,出现错误: 配给配置文件“ iOS Team配给配置文件:*”没有 支持无线附件配置功能。 我可以知道如何解决这个问题吗? 最佳答案 您应该在苹果的开发人员
我已为应用启用推送通知服务。当我尝试为应用程序分发创建临时配置文件时出现以下错误: No Certificates are available. Click "Create Certificate."
今天,我尝试上传使用推送通知的新版本应用程序,并且显示XCode并出现错误,提示我没有任何有效的分发配置文件。 当我登录到Provisioning Profile时,我看到我的所有分发配置文件都已过期
您好,我为我的客户(销售人员)开发了一个业务应用程序,它与 ERP 集成,此应用通过开发人员配置文件分发给许多销售人员 iPad。 我的糟糕时光 开发人员配置文件的有效期仅为一年..如何使用life
您如何到达XCode Provisioning Organizer? 最佳答案 在Xcode中,从“窗口”菜单中选择“管理器”,您将获得一个窗口,该窗口为您提供有关设备和置备配置文件的各种信息。另外,
如果我遗漏了什么,很抱歉提出问题。 我正在使用一条看起来像这样的车道: desc "Submit a new Beta Build to Apple TestFlight" desc "Thi
我正在尝试制作一些 Ansible 剧本,这些剧本将提供一个环境(n 个数据库、m 个 Web 服务器等)并保存这些主机以供以后使用,以便我可以针对它们运行部署。我能想到的最好的方法是https://
我是一名优秀的程序员,十分优秀!