我找不到在 helm 模板中迭代某个范围的方法。我的 values.yaml 中有下一个定义:
ingress:
app1:
port: 80
hosts:
- example.com
app2:
port: 80
hosts:
- demo.example.com
- test.example.com
- stage.example.com
app3:
port: 80
hosts:
- app3.example.com
Run Code Online (Sandbox Code Playgroud)
我想为每个提到的主机生成相同的 nginx 入口规则:
spec:
rules:
{{- range $key, $value =: .Values.global.ingress }}
- host: {{ $value.hosts }}
http:
paths:
- path: /qapi
backend:
serviceName: api-server
servicePort: 80
{{- end }}
Run Code Online (Sandbox Code Playgroud)
但它会生成错误的主机:
- host: [example.com]
- host: [test.example.com demo.example.com test.example.com]
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助!
如果正常运行时间超过N小时,检查EC2实例正常运行时间以及可能发送警报的最佳方法是什么?如何使用CloudWatch,Lambda等默认AWS工具进行组织?
amazon-ec2 amazon-web-services amazon-cloudwatch aws-cli uptime-monitoring
我在hiera中有以下参数:
base::users:
john@example.com:
ensure: present
user: john
sudo: true
type: ssh-rsa
key: AAAAB3NzaC1yc2EAAAABJ
Run Code Online (Sandbox Code Playgroud)
在木偶我得到以下哈希:
{john@example.com => {ensure => present, user => john, sudo => true, type => ssh-rsa, key => AAAAB3NzaC1yc2EAAAABJ}}
Run Code Online (Sandbox Code Playgroud)
然后我调用创建资源来创建适当的authorized_keys文件:
create_resources('ssh_authorized_key', $users)
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为我添加了新参数'sudo',在调用create_resources之前,我想从散列中删除此键并在另一个资源中操作.
我已经尝试了下一步删除它:
$users_filtered = $users.each |$k, $v| { $v.delete['sudo'] }
Run Code Online (Sandbox Code Playgroud)
我收到了下一个错误:
Error while evaluating a Function Call, delete(): Wrong number of arguments given 1 for 2.
Run Code Online (Sandbox Code Playgroud)
据我所知,puppet尝试使用stdlib模块中的"删除"功能.但我也尝试过:
$users_filtered = $users.each |$k, $v| { delete($users, $v['sudo'] }
Run Code Online (Sandbox Code Playgroud)
但它不起作用.感谢任何帮助