我有一些 YAML 文件,我想应用它们来创建自定义资源。但在应用它之前,我想更改 YAML 代码段的规范和 ENV。那么,最好的方法是什么呢?
我现在做的是:
假设这是 YAML
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
namespace: default
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
appkind: 'deployment'
# It can be true/false
annotationCheck: 'false'
# It can be active/stop
engineState: 'active'
chaosServiceAccount: pod-delete-sa
monitoring: false
# It can be delete/retain
jobCleanUpPolicy: 'delete'
experiments:
- name: pod-delete
spec:
components:
env:
# set chaos duration (in sec) as desired
- name: TOTAL_CHAOS_DURATION
value: '30'
# set chaos interval (in sec) as desired
- name: CHAOS_INTERVAL
value: '10'
# pod failures without '--force' & default terminationGracePeriodSeconds
- name: FORCE
value: 'false'
我从原始链接下载此文件。(1 个函数)
替换类似 (1 fn) 的字段jobCleanUpPolicy: 'delete'
jobCleanUpPolicy: 'retain'
当找到匹配项时,替换下一行,例如 FORCE ENV。(1 fn)value: 'false'
value: 'true'
应用创建的最终清单!(1 功能)
这可以优化吗?
富国沪深
元芳怎么了
相关分类