是否可以将csv文件传递给"argocd-rbac-cm“配置映射的数据?由于我已经通过gitops部署了argo-cd (使用正式的argo-cd头盔图),所以我不想在configmap itseld中硬编码一个大的csv文件,相反,我希望直接从舵机图表所在的git存储库中引用一个csv文件。而且,是否也可以传递多个类似文件的密钥?
示例:
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-rbac-cm
namespace: argocd
data:
policy.default: role:readonly
policy.csv: |
<<< something to have this append many files
<<< https://gitlab.custom.net/proj_name/-/blob/master/first_policy.csv # URL from the first csv file in the git repository >>
<<< https://gitlab.custom.net/proj_name/-/blob/master/second_policy.csv # URL from the second csv file in the git repository >>
提前感谢!
发布于 2022-01-31 15:06:17
policy.csv中的任何外部评估都会导致集群中一些不可预测的行为,并会使argocd代码基复杂化,而没有明显的收益。这就是为什么在部署任何东西之前,应该静态地设置这个configmap。
你基本上有两个选择:
使用bash脚本创建配置并将其赋值给变量,即在CI/CD管道中将其作为helm upgrade ... --set "server.rbacConfig=$RBAC_CONFIG"
.Files.Get
函数从存储库中已经存在的文件创建cm,参见https://helm.sh/docs/chart_template_guide/accessing_files/,其内容类似于。
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-rbac-cm
data:
policy.csv: |-
{{- $files := .Files }}
{{- range tuple "first_policy.csv" "first_policy.csv" }}
{{ $files.Get . }}
{{- end }}
https://stackoverflow.com/questions/70927502
复制相似问题