试图用argocd理解将TLAs传递给我的jsonnet文件。这是我的argocd application.yaml的一部分,它直接从main.jsonnet文件编译kube清单。我想要创建2个应用程序在argocd (prod和nonprod),我想通过TLAs来更改每个应用程序实例的入口主机名后缀。
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kube-prometheus-nonprod
namespace: argocd
spec:
destination:
name: ''
namespace: monitoring
server: 'https://kubernetes.default.svc'
source:
path: kube-prometheus/src
repoURL: 'https://myrepo.git'
targetRevision: branch-name
directory:
jsonnet:
tlas:
- name: npDomainSuffix
value: np.example.io
libs:
- kube-prometheus/vendor/
例如,在我的main.jsonnet文件中:
hosts: ['grafana.$(npDomainSuffix)']
刚接触到jsonnet和argocd,无法让它工作。我能用这样的方式吗?
发布于 2021-06-16 12:24:05
如果您是jsonnet
新手,我建议您使用extVars
,因为TLA机制有点难理解,从TLA部分的jsonnet教程中,您会发现您的jsonnet代码需要一个带有以每个顶级参数名命名的参数的条目函数。
或者,使用extVars可以代替:
extVars:
- name: npDomainSuffix
value: np.example.io
然后在您的jsonnet代码中的任何位置(extVars
是全局的)
hosts: ['grafana.' + std.extVar('npDomainSuffix')]
https://stackoverflow.com/questions/68001963
复制相似问题