Reduce jinja2 filters in coredns templates (#4390)

pull/4396/head
Matthew Mosesohn 2019-03-26 21:09:17 +03:00 committed by Kubernetes Prow Robot
parent 85e0fb32e6
commit 6d7f3c4405
5 changed files with 20 additions and 21 deletions

View File

@ -7,6 +7,7 @@ dns_min_replicas: 2
dns_nodes_per_replica: 16 dns_nodes_per_replica: 16
dns_cores_per_replica: 256 dns_cores_per_replica: 256
dns_prevent_single_point_failure: "{{ 'true' if dns_min_replicas|int > 1 else 'false' }}" dns_prevent_single_point_failure: "{{ 'true' if dns_min_replicas|int > 1 else 'false' }}"
coredns_ordinal_suffix: ""
# nodelocaldns # nodelocaldns
nodelocaldns_cpu_requests: 100m nodelocaldns_cpu_requests: 100m

View File

@ -14,7 +14,7 @@ data:
kubernetes {{ dns_domain }} in-addr.arpa ip6.arpa { kubernetes {{ dns_domain }} in-addr.arpa ip6.arpa {
pods insecure pods insecure
{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %} {% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
upstream {{ upstream_dns_servers|join(' ') }} upstream {{ upstream_dns_servers.join(' ') }}
{% else %} {% else %}
upstream /etc/resolv.conf upstream /etc/resolv.conf
{% endif %} {% endif %}
@ -22,7 +22,7 @@ data:
} }
prometheus :9153 prometheus :9153
{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %} {% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
proxy . {{ upstream_dns_servers|join(' ') }} proxy . {{ upstream_dns_servers.join(' ') }}
{% else %} {% else %}
proxy . /etc/resolv.conf proxy . /etc/resolv.conf
{% endif %} {% endif %}

View File

@ -2,13 +2,13 @@
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: "coredns{{ coredns_ordinal_suffix | default('') }}" name: "coredns{{ coredns_ordinal_suffix }}"
namespace: kube-system namespace: kube-system
labels: labels:
k8s-app: "coredns{{ coredns_ordinal_suffix | default('') }}" k8s-app: "coredns{{ coredns_ordinal_suffix }}"
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
kubernetes.io/name: "coredns{{ coredns_ordinal_suffix | default('') }}" kubernetes.io/name: "coredns{{ coredns_ordinal_suffix }}"
spec: spec:
strategy: strategy:
type: RollingUpdate type: RollingUpdate
@ -17,17 +17,15 @@ spec:
maxSurge: 10% maxSurge: 10%
selector: selector:
matchLabels: matchLabels:
k8s-app: coredns{{ coredns_ordinal_suffix | default('') }} k8s-app: coredns{{ coredns_ordinal_suffix }}
template: template:
metadata: metadata:
labels: labels:
k8s-app: coredns{{ coredns_ordinal_suffix | default('') }} k8s-app: coredns{{ coredns_ordinal_suffix }}
annotations: annotations:
seccomp.security.alpha.kubernetes.io/pod: 'docker/default' seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
spec: spec:
{% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %}
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux
serviceAccountName: coredns serviceAccountName: coredns
@ -42,7 +40,7 @@ spec:
- topologyKey: "kubernetes.io/hostname" - topologyKey: "kubernetes.io/hostname"
labelSelector: labelSelector:
matchLabels: matchLabels:
k8s-app: coredns{{ coredns_ordinal_suffix | default('') }} k8s-app: coredns{{ coredns_ordinal_suffix }}
nodeAffinity: nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution: preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100 - weight: 100

View File

@ -2,12 +2,12 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: coredns{{ coredns_ordinal_suffix | default('') }} name: coredns{{ coredns_ordinal_suffix }}
namespace: kube-system namespace: kube-system
labels: labels:
k8s-app: coredns{{ coredns_ordinal_suffix | default('') }} k8s-app: coredns{{ coredns_ordinal_suffix }}
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
kubernetes.io/name: "coredns{{ coredns_ordinal_suffix | default('') }}" kubernetes.io/name: "coredns{{ coredns_ordinal_suffix }}"
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
annotations: annotations:
prometheus.io/path: /metrics prometheus.io/path: /metrics
@ -15,7 +15,7 @@ metadata:
prometheus.io/scrape: "true" prometheus.io/scrape: "true"
spec: spec:
selector: selector:
k8s-app: coredns{{ coredns_ordinal_suffix | default('') }} k8s-app: coredns{{ coredns_ordinal_suffix }}
clusterIP: {{ clusterIP }} clusterIP: {{ clusterIP }}
ports: ports:
- name: dns - name: dns

View File

@ -16,20 +16,20 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: dns-autoscaler{{ coredns_ordinal_suffix | default('') }} name: dns-autoscaler{{ coredns_ordinal_suffix }}
namespace: kube-system namespace: kube-system
labels: labels:
k8s-app: dns-autoscaler{{ coredns_ordinal_suffix | default('') }} k8s-app: dns-autoscaler{{ coredns_ordinal_suffix }}
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
spec: spec:
selector: selector:
matchLabels: matchLabels:
k8s-app: dns-autoscaler{{ coredns_ordinal_suffix | default('') }} k8s-app: dns-autoscaler{{ coredns_ordinal_suffix }}
template: template:
metadata: metadata:
labels: labels:
k8s-app: dns-autoscaler{{ coredns_ordinal_suffix | default('') }} k8s-app: dns-autoscaler{{ coredns_ordinal_suffix }}
annotations: annotations:
seccomp.security.alpha.kubernetes.io/pod: 'docker/default' seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
spec: spec:
@ -48,7 +48,7 @@ spec:
- topologyKey: "kubernetes.io/hostname" - topologyKey: "kubernetes.io/hostname"
labelSelector: labelSelector:
matchLabels: matchLabels:
k8s-app: dns-autoscaler{{ coredns_ordinal_suffix | default('') }} k8s-app: dns-autoscaler{{ coredns_ordinal_suffix }}
nodeAffinity: nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution: preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100 - weight: 100
@ -71,9 +71,9 @@ spec:
- --default-params={"linear":{"preventSinglePointFailure":{{ dns_prevent_single_point_failure }},"coresPerReplica":{{ dns_cores_per_replica }},"nodesPerReplica":{{ dns_nodes_per_replica }},"min":{{ dns_min_replicas }}}} - --default-params={"linear":{"preventSinglePointFailure":{{ dns_prevent_single_point_failure }},"coresPerReplica":{{ dns_cores_per_replica }},"nodesPerReplica":{{ dns_nodes_per_replica }},"min":{{ dns_min_replicas }}}}
- --logtostderr=true - --logtostderr=true
- --v=2 - --v=2
- --configmap=dns-autoscaler{{ coredns_ordinal_suffix | default('') }} - --configmap=dns-autoscaler{{ coredns_ordinal_suffix }}
{% if dns_mode in ['coredns', 'coredns_dual'] %} {% if dns_mode in ['coredns', 'coredns_dual'] %}
- --target=Deployment/coredns{{ coredns_ordinal_suffix | default('') }} - --target=Deployment/coredns{{ coredns_ordinal_suffix }}
{% endif %} {% endif %}
{% if dns_mode in ['kubedns', 'dnsmasq_kubedns'] %} {% if dns_mode in ['kubedns', 'dnsmasq_kubedns'] %}
- --target=Deployment/kube-dns - --target=Deployment/kube-dns