fix helm安装使用kube-system命名空间执行错误

pull/641/head
gjmzj 2019-07-08 11:17:42 +08:00
parent 0ca5f7fdd9
commit a96acfce07
2 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,11 @@
-config={{ ca_dir }}/ca-config.json \
-profile=kubernetes {{ tiller_cert_cn }}-csr.json | {{ bin_dir }}/cfssljson -bare {{ tiller_cert_cn }}"
- name: 获取当前集群所有 namespaces
shell: "{{ bin_dir }}/kubectl get ns"
register: current_ns
run_once: true
- name: 准备rbac配置
template: src=helm-rbac.yaml.j2 dest=/opt/kube/helm-rbac.yaml

View File

@ -1,10 +1,12 @@
# 绑定helm sa到 cluster-admin这样可以兼容现有需要集群特权的charts
#
#
{% if helm_namespace not in current_ns.stdout %}
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ helm_namespace }}
{% endif %}
---
apiVersion: v1
kind: ServiceAccount