我在执行linux工具时有一个makefile规则.我需要检查工具命令的退出状态,如果该命令失败,则必须中止make.
我试过用$ ?, $$来检查?\ $?makefile中的etc等.但是当makefile运行时,它们会给我语法错误.
这样做的正确方法是什么?
这是Makefile中的相关规则
Run Code Online (Sandbox Code Playgroud)mycommand \ if [ $$? -ne 0 ]; \ then \ echo "mycommand failed"; \ false; \ fi
我想使用pylint的对詹金斯与警告插件和Pipleine,因为违规插件已被弃用.
没有文档或完整的示例.
有一些信息:
timeout(time: 5, unit: 'MINUTES') {
sh 'npm run lint:ci'
step([$class: 'WarningsPublisher',
parserConfigurations: [[
parserName: 'JSLint',
pattern: 'pmd.xml'
]],
unstableTotalAll: '0',
usePreviousBuildAsReference: true
])
}
Run Code Online (Sandbox Code Playgroud)
和解决方法:
pylint || exit 0
Run Code Online (Sandbox Code Playgroud)
但这还不够.
创建yaml-bomb.yaml文件:
apiVersion: v1
data:
a: &a ["web","web","web","web","web","web","web","web","web"]
b: &b [*a,*a,*a,*a,*a,*a,*a,*a,*a]
c: &c [*b,*b,*b,*b,*b,*b,*b,*b,*b]
d: &d [*c,*c,*c,*c,*c,*c,*c,*c,*c]
e: &e [*d,*d,*d,*d,*d,*d,*d,*d,*d]
f: &f [*e,*e,*e,*e,*e,*e,*e,*e,*e]
g: &g [*f,*f,*f,*f,*f,*f,*f,*f,*f]
h: &h [*g,*g,*g,*g,*g,*g,*g,*g,*g]
i: &i [*h,*h,*h,*h,*h,*h,*h,*h,*h]
kind: ConfigMap
metadata:
name: yaml-bomb
namespace: default
Run Code Online (Sandbox Code Playgroud)
ConfigMap通过cmd 将创建请求发送到Kubernetes API kubectl apply -f yaml-bomb.yaml。
kube-api CPU /内存使用率很高,甚至在以后重新启动时也是如此。
我们如何防止这种炸弹?
我有1.7版本的golang,我想从命令提示符更新golang到1.8.再次卸载和安装它总是一个选项,但我可以使用Windows 8.1上的命令更新它吗?
我尝试使用创建s3桶
aws s3api create-bucket —bucket kubernetes-aws-wthamira-io
它会犯这个错误
调用CreateBucket操作时发生错误(IllegalLocationConstraintException):未指定的位置约束与此请求发送到的区域特定端点不兼容.
我使用aws configure区域设置并将区域设置为eu-west-1
An error occurred (IllegalLocationConstraintException) when calling
the CreateBucket operation: The unspecified location constraint is
incompatible for the region specific endpoint this request was sent
to.
Run Code Online (Sandbox Code Playgroud)
但是犯同样的错误.我怎么解决这个问题.
我使用osx终端连接aws
我想为子域创建一个 Route53 托管区域并NS记录到父域。
假设我有:
example.com
Run Code Online (Sandbox Code Playgroud)
我想要一个子域的托管区域:
build.example.com
Run Code Online (Sandbox Code Playgroud)
托管区创建工作:
ClusterHostedZone:
Type: "AWS::Route53::HostedZone"
Properties:
Name: !Ref DomainName
HostedZoneConfig:
Comment: Managed by Cloud Formation
HostedZoneTags:
- Key: KubernetesCluster
Value: !Ref KubernetesCluster
Run Code Online (Sandbox Code Playgroud)
委派子域的责任不要:
ParentHostedZoneClusterRecord:
Type: "AWS::Route53::RecordSet"
Properties:
Name: !Ref DomainName
Comment: Managed by Cloud Formation
HostedZoneId: !Ref ParentHostedZoneID
TTL: 30
Type: NS
ResourceRecords: !GetAtt ClusterHostedZone.NameServers
Run Code Online (Sandbox Code Playgroud)
这未实现,我不知道如何获取此信息:
ResourceRecords: !GetAtt ClusterHostedZone.NameServers
Run Code Online (Sandbox Code Playgroud)
Cloud Formation 中是否缺少这个简单的功能?
我已经在大约 6 个月前安装了 AWS CLI,今天使用以下命令进行了升级。
pip install --upgrade awscli
我的 Ubuntu 18.04 机器上的当前版本是:
aws-cli/1.14.44 Python/3.6.5 Linux/4.15.0-23-generic botocore/1.8.48
Run Code Online (Sandbox Code Playgroud)
当我尝试 aws eks 命令时,出现以下错误:
Invalid choice: 'eks', maybe you meant:
* es
Run Code Online (Sandbox Code Playgroud)
我的 aws cli 是否已正确升级,还是应该为 EKS 服务安装其他东西?
有一个 DSL 工作来在 jenkins 中创建多分支管道作业,运行 Jenkins2.107.1和插件: 'Branch API Plugin' 2.0.18, 'Bitbucket Branch Source Plugin' 2.2.10。
我找不到合适的配置功能来启用“抑制自动 SCM 触发”的属性,请帮忙。
这是我的工作,但它会在扫描分支后立即触发构建:
multibranchPipelineJob("job") {
configure {
it / sources / data / 'jenkins.branch.BranchSource' / source(class: 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource') {
credentialsId('..')
id("..")
checkoutCredentialsId("..")
repoOwner("owner")
repository("my-repo")
includes()
excludes("PR-*")
}
}
}
Run Code Online (Sandbox Code Playgroud) AWS::MSK::Cluster使用 Cloud Formation创建时,我无法以Tags通常的方式进行设置:
Tags:
- Key: Name
Value: !Ref Identifier
Run Code Online (Sandbox Code Playgroud)
因为这个错误:
Property validation failure: [Value of property {/Tags} does not match type {Map}]
在撰写本文时,文档指出Type: List of Tag,我应该使用:而不是通常的Type: Json。
同样的文档还指出:
You can specify tags in JSON or in YAML, depending on which format you use for your template
我需要测量 Apache Camel 中处理外部服务响应所需的时间。
我在网上搜索了解决方案,令人惊讶的是没有一个可以接受的解决方案。
使用EventNotifier感觉太重了,而且更多是框架级别的性能测量工具。
因此,我制定了自己的简单解决方案,但我希望能得到一些我错过的更好的东西,或者至少是建设性的反馈。
下面是解决方案的尝试。
我正在 Kubernetes 中使用 Horizontal Pod Autoscaler。我已将 HPA 设置为在平均 CPU 利用率超过 35% 时启动新实例。然而,这似乎并没有按预期工作。即使 CPU 利用率远低于定义的目标利用率,HPA 也会触发重新调整。如下所示,“当前”利用率为 10%,与 35% 相去甚远。但它仍然将 Pod 数量从 5 个调整为 6 个。

我还检查了我的 Google Cloud Platform 仪表板(我们托管应用程序的位置)中的指标。这也表明请求的 CPU 利用率没有超过 35% 的阈值。但仍然发生了几次调整。

我的 HPA 的内容
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: django
spec:
{{ if eq .Values.env "prod" }}
minReplicas: 5
maxReplicas: 35
{{ else if eq .Values.env "staging" }}
minReplicas: 1
maxReplicas: 3
{{ end }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: django-app
targetCPUUtilizationPercentage: 35
Run Code Online (Sandbox Code Playgroud)
有谁知道这可能是什么原因?
cpu-usage google-cloud-platform kubernetes google-kubernetes-engine hpa
我有一个简单的应用程序,它接受一个字符串并返回字符串中唯一字符的数量。预计一个字符串可能会多次传递给该方法。该方法应该缓存结果,以便在给该方法之前遇到的字符串时,它会检索存储的结果。
出于学习目的,我需要使用装饰器模式来实现缓存。我从网上学到的:
public interface CharCount {
Map<String, Long> charCount(String input);
}
Run Code Online (Sandbox Code Playgroud)
public class CharCountImplement {
Map<String, Long> charCount(String input) {
return Arrays.stream(input.split(""))
.collect(Collectors.groupingBy(Function.identity(), HashMap::new, Collectors.counting()));
}
}
Run Code Online (Sandbox Code Playgroud)
public abstract class Decorator implements CharCount {
private CharCount charCount;
@Override
public Map<String, Long> charCount(String input) {
return charCount.charCount(input);
}
}
Run Code Online (Sandbox Code Playgroud)
public class CachedDecorator extends Decorator {
// decorator must contain something else
public Map<String, Long> charCount(String input) {
// some decoration code - no problem with …Run Code Online (Sandbox Code Playgroud)