run netchecker-server with list pods
This commit is contained in:
parent
e1386ba604
commit
a8e6a0763d
7 changed files with 42 additions and 4 deletions
|
@ -41,7 +41,7 @@ netchecker_server_memory_requests: 64M
|
||||||
etcd_cert_dir: "/etc/ssl/etcd/ssl"
|
etcd_cert_dir: "/etc/ssl/etcd/ssl"
|
||||||
canal_cert_dir: "/etc/canal/certs"
|
canal_cert_dir: "/etc/canal/certs"
|
||||||
|
|
||||||
kubedns_rbac_resources:
|
rbac_resources:
|
||||||
|
- sa
|
||||||
- clusterrole
|
- clusterrole
|
||||||
- clusterrolebinding
|
- clusterrolebinding
|
||||||
- sa
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
register: manifests
|
register: manifests
|
||||||
when:
|
when:
|
||||||
- dns_mode != 'none' and inventory_hostname == groups['kube-master'][0]
|
- dns_mode != 'none' and inventory_hostname == groups['kube-master'][0]
|
||||||
- rbac_enabled or item.type not in kubedns_rbac_resources
|
- rbac_enabled or item.type not in rbac_resources
|
||||||
tags: dnsmasq
|
tags: dnsmasq
|
||||||
|
|
||||||
# see https://github.com/kubernetes/kubernetes/issues/45084, only needed for "old" kube-dns
|
# see https://github.com/kubernetes/kubernetes/issues/45084, only needed for "old" kube-dns
|
||||||
|
|
|
@ -5,10 +5,15 @@
|
||||||
with_items:
|
with_items:
|
||||||
- {file: netchecker-agent-ds.yml.j2, type: ds, name: netchecker-agent}
|
- {file: netchecker-agent-ds.yml.j2, type: ds, name: netchecker-agent}
|
||||||
- {file: netchecker-agent-hostnet-ds.yml.j2, type: ds, name: netchecker-agent-hostnet}
|
- {file: netchecker-agent-hostnet-ds.yml.j2, type: ds, name: netchecker-agent-hostnet}
|
||||||
|
- {file: netchecker-server-sa.yml.j2, type: sa, name: netchecker-server}
|
||||||
|
- {file: netchecker-server-clusterrole.yml.j2, type: clusterrole, name: netchecker-server}
|
||||||
|
- {file: netchecker-server-clusterrolebinding.yml.j2, type: clusterrolebinding, name: netchecker-server}
|
||||||
- {file: netchecker-server-deployment.yml.j2, type: po, name: netchecker-server}
|
- {file: netchecker-server-deployment.yml.j2, type: po, name: netchecker-server}
|
||||||
- {file: netchecker-server-svc.yml.j2, type: svc, name: netchecker-service}
|
- {file: netchecker-server-svc.yml.j2, type: svc, name: netchecker-service}
|
||||||
register: manifests
|
register: manifests
|
||||||
when: inventory_hostname == groups['kube-master'][0]
|
when:
|
||||||
|
- inventory_hostname == groups['kube-master'][0]
|
||||||
|
- rbac_enabled or item.type not in rbac_resources
|
||||||
|
|
||||||
#FIXME: remove if kubernetes/features#124 is implemented
|
#FIXME: remove if kubernetes/features#124 is implemented
|
||||||
- name: Kubernetes Apps | Purge old Netchecker daemonsets
|
- name: Kubernetes Apps | Purge old Netchecker daemonsets
|
||||||
|
@ -31,4 +36,5 @@
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||||
state: "{{item.changed | ternary('latest','present') }}"
|
state: "{{item.changed | ternary('latest','present') }}"
|
||||||
with_items: "{{ manifests.results }}"
|
with_items: "{{ manifests.results }}"
|
||||||
|
failed_when: manifests|failed and "Error from server (AlreadyExists)" not in manifests.msg
|
||||||
when: inventory_hostname == groups['kube-master'][0]
|
when: inventory_hostname == groups['kube-master'][0]
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
kind: ClusterRole
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
|
metadata:
|
||||||
|
name: netchecker-server
|
||||||
|
namespace: {{ netcheck_namespace }}
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["pods"]
|
||||||
|
verbs: ["list"]
|
|
@ -0,0 +1,13 @@
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
|
metadata:
|
||||||
|
name: netchecker-server
|
||||||
|
namespace: {{ netcheck_namespace }}
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: netchecker-server
|
||||||
|
namespace: {{ netcheck_namespace }}
|
||||||
|
roleRef:
|
||||||
|
kind: ClusterRole
|
||||||
|
name: netchecker-server
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
|
@ -31,3 +31,6 @@ spec:
|
||||||
- "-logtostderr"
|
- "-logtostderr"
|
||||||
- "-kubeproxyinit"
|
- "-kubeproxyinit"
|
||||||
- "-endpoint=0.0.0.0:8081"
|
- "-endpoint=0.0.0.0:8081"
|
||||||
|
{% if rbac_enabled %}
|
||||||
|
serviceAccountName: netchecker-server
|
||||||
|
{% endif %}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: netchecker-server
|
||||||
|
namespace: {{ netcheck_namespace }}
|
||||||
|
labels:
|
||||||
|
kubernetes.io/cluster-service: "true"
|
Loading…
Reference in a new issue