Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 4beed8a

Browse files
committed
Always create required dnsmasq resources
The dnsmasq-node ServiceAccount must exist whether or not CoreDNS-local has been enabled. Therefore, it is created alongside the DaemonSet rather than as part of the coredns-local manifest. Additionally, always create dnsmasq-node-coredns-local.yaml If this file does not exist (as would be the case if the CoreDNS local feature has not been enabled), controller nodes will fail to come up with the error: > error: the path "/srv/kubernetes/manifests/dnsmasq-node-coredns-local.yaml" does not exist This is caused when `kubectl delete` is called against the file because of the line `remove "${mfdir}/dnsmasq-node-coredns-local.yaml`. This manifest must always be generated because the CoreDNS-local feature cannot be enabled and then later disabled without otherwise requiring manual operator intervention.
1 parent 57f4235 commit 4beed8a

File tree

1 file changed

+42
-44
lines changed

1 file changed

+42
-44
lines changed

builtin/files/userdata/cloud-config-controller

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5445,51 +5445,8 @@ write_files:
54455445
- --v=2
54465446
- --logtostderr
54475447

5448-
{{ if and .KubeDns.NodeLocalResolver .KubeDns.DNSMasq.CoreDNSLocal.Enabled }}
54495448
- path: /srv/kubernetes/manifests/dnsmasq-node-coredns-local.yaml
54505449
content: |
5451-
apiVersion: v1
5452-
kind: ServiceAccount
5453-
metadata:
5454-
name: dnsmasq
5455-
namespace: kube-system
5456-
---
5457-
apiVersion: rbac.authorization.k8s.io/v1
5458-
kind: ClusterRole
5459-
metadata:
5460-
name: dnsmasq
5461-
rules:
5462-
- apiGroups: [""]
5463-
resources: ["endpoints", "services", "pods", "namespaces"]
5464-
verbs: ["list", "watch"]
5465-
---
5466-
apiVersion: rbac.authorization.k8s.io/v1
5467-
kind: ClusterRoleBinding
5468-
metadata:
5469-
name: dnsmasq
5470-
roleRef:
5471-
apiGroup: rbac.authorization.k8s.io
5472-
kind: ClusterRole
5473-
name: dnsmasq
5474-
subjects:
5475-
- kind: ServiceAccount
5476-
name: dnsmasq
5477-
namespace: kube-system
5478-
---
5479-
apiVersion: rbac.authorization.k8s.io/v1
5480-
kind: RoleBinding
5481-
metadata:
5482-
name: dnsmasq-privileged-psp
5483-
namespace: kube-system
5484-
roleRef:
5485-
apiGroup: rbac.authorization.k8s.io
5486-
kind: ClusterRole
5487-
name: privileged-psp
5488-
subjects:
5489-
- kind: ServiceAccount
5490-
name: dnsmasq
5491-
namespace: kube-system
5492-
---
54935450
apiVersion: v1
54945451
kind: ConfigMap
54955452
metadata:
@@ -5522,11 +5479,52 @@ write_files:
55225479
cache 30
55235480
reload
55245481
}
5525-
{{ end }}
55265482

55275483
{{ if .KubeDns.NodeLocalResolver }}
55285484
- path: /srv/kubernetes/manifests/dnsmasq-node-ds.yaml
55295485
content: |
5486+
apiVersion: v1
5487+
kind: ServiceAccount
5488+
metadata:
5489+
name: dnsmasq
5490+
namespace: kube-system
5491+
---
5492+
apiVersion: rbac.authorization.k8s.io/v1
5493+
kind: ClusterRole
5494+
metadata:
5495+
name: dnsmasq
5496+
rules:
5497+
- apiGroups: [""]
5498+
resources: ["endpoints", "services", "pods", "namespaces"]
5499+
verbs: ["list", "watch"]
5500+
---
5501+
apiVersion: rbac.authorization.k8s.io/v1
5502+
kind: ClusterRoleBinding
5503+
metadata:
5504+
name: dnsmasq
5505+
roleRef:
5506+
apiGroup: rbac.authorization.k8s.io
5507+
kind: ClusterRole
5508+
name: dnsmasq
5509+
subjects:
5510+
- kind: ServiceAccount
5511+
name: dnsmasq
5512+
namespace: kube-system
5513+
---
5514+
apiVersion: rbac.authorization.k8s.io/v1
5515+
kind: RoleBinding
5516+
metadata:
5517+
name: dnsmasq-privileged-psp
5518+
namespace: kube-system
5519+
roleRef:
5520+
apiGroup: rbac.authorization.k8s.io
5521+
kind: ClusterRole
5522+
name: privileged-psp
5523+
subjects:
5524+
- kind: ServiceAccount
5525+
name: dnsmasq
5526+
namespace: kube-system
5527+
---
55305528
apiVersion: apps/v1
55315529
kind: DaemonSet
55325530
metadata:

0 commit comments

Comments
 (0)