Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt Helm chart to mimic Amazon EKS CoreDNS naming conventions #98

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/coredns/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: coredns
version: 1.19.7
version: 1.19.8
appVersion: 1.9.4
home: https://coredns.io
icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/clusterrole-autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "coredns.fullname" . }}-autoscaler
name: {{ default (include "coredns.fullname" .) .Values.clusterroleAutoscaler.namePrefix }}-autoscaler
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand Down
11 changes: 10 additions & 1 deletion charts/coredns/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "coredns.fullname" . }}
name: {{ default (include "coredns.fullname" .) .Values.clusterrole.name }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand All @@ -13,6 +13,15 @@ metadata:
kubernetes.io/name: "CoreDNS"
{{- end }}
app.kubernetes.io/name: {{ template "coredns.name" . }}
{{- if or .Values.clusterrole.annotations .Values.customAnnotations }}
annotations:
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.clusterrole.annotations }}
{{- toYaml .Values.clusterrole.annotations | nindent 4 }}
{{- end }}
{{- end }}
rules:
- apiGroups:
- ""
Expand Down
6 changes: 3 additions & 3 deletions charts/coredns/templates/clusterrolebinding-autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "coredns.fullname" . }}-autoscaler
name: {{ default (include "coredns.fullname" .) .Values.clusterrolebindingAutoscaler.namePrefix }}-autoscaler
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand All @@ -24,9 +24,9 @@ metadata:
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "coredns.fullname" . }}-autoscaler
name: {{ default (include "coredns.fullname" .) .Values.clusterroleAutoscaler.namePrefix }}-autoscaler
subjects:
- kind: ServiceAccount
name: {{ template "coredns.fullname" . }}-autoscaler
name: {{ default (include "coredns.fullname" .) .Values.serviceaccountAutoscaler.namePrefix }}-autoscaler
namespace: {{ .Release.Namespace }}
{{- end }}
13 changes: 11 additions & 2 deletions charts/coredns/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "coredns.fullname" . }}
name: {{ default (include "coredns.fullname" .) .Values.clusterrolebinding.name }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand All @@ -13,10 +13,19 @@ metadata:
kubernetes.io/name: "CoreDNS"
{{- end }}
app.kubernetes.io/name: {{ template "coredns.name" . }}
{{- if or .Values.clusterrolebinding.annotations .Values.customAnnotations }}
annotations:
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.clusterrolebinding.annotations }}
{{- toYaml .Values.clusterrolebinding.annotations | nindent 4 }}
{{- end }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "coredns.fullname" . }}
name: {{ default (include "coredns.fullname" .) .Values.clusterrole.name }}
subjects:
- kind: ServiceAccount
name: {{ template "coredns.serviceAccountName" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/configmap-autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ template "coredns.fullname" . }}-autoscaler
name: {{ default (include "coredns.fullname" .) .Values.configmapAutoscaler.namePrefix }}-autoscaler
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
Expand Down
13 changes: 9 additions & 4 deletions charts/coredns/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "coredns.fullname" . }}
name: {{ default (include "coredns.fullname" .) .Values.configmap.name }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand All @@ -17,10 +17,15 @@ metadata:
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | indent 4 }}
{{- end }}
{{- with .Values.customAnnotations }}
{{- if or .Values.configmap.annotations .Values.customAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.configmap.annotations }}
{{- toYaml .Values.configmap.annotations | nindent 4 }}
{{- end }}
{{- end }}
data:
Corefile: |-
{{- range $name, $conf := .Values.extraConfig }}
Expand Down
7 changes: 3 additions & 4 deletions charts/coredns/templates/deployment-autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "coredns.fullname" . }}-autoscaler
name: {{ default (include "coredns.fullname" .) .Values.autoscaler.namePrefix }}-autoscaler
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
Expand Down Expand Up @@ -48,11 +48,10 @@ spec:
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/configmap-autoscaler.yaml") . | sha256sum }}
{{- if .Values.isClusterService }}
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
{{- end }}
spec:
serviceAccountName: {{ template "coredns.fullname" . }}-autoscaler
serviceAccountName: {{ default (include "coredns.fullname" .) .Values.serviceaccountAutoscaler.namePrefix }}-autoscaler
{{- $priorityClassName := default .Values.priorityClassName .Values.autoscaler.priorityClassName }}
{{- if $priorityClassName }}
priorityClassName: {{ $priorityClassName | quote }}
Expand Down Expand Up @@ -90,7 +89,7 @@ spec:
command:
- /cluster-proportional-autoscaler
- --namespace={{ .Release.Namespace }}
- --configmap={{ template "coredns.fullname" . }}-autoscaler
- --configmap={{ default (include "coredns.fullname" .) .Values.configmapAutoscaler.namePrefix }}-autoscaler
- --target=Deployment/{{ default (include "coredns.fullname" .) .Values.deployment.name }}
- --logtostderr=true
- --v=2
Expand Down
3 changes: 1 addition & 2 deletions charts/coredns/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ spec:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if .Values.isClusterService }}
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
{{- end }}
{{- if .Values.podAnnotations }}
Expand Down Expand Up @@ -147,7 +146,7 @@ spec:
volumes:
- name: config-volume
configMap:
name: {{ template "coredns.fullname" . }}
name: {{ default (include "coredns.fullname" .) .Values.configmap.name }}
items:
- key: Corefile
path: Corefile
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "coredns.fullname" . }}
name: {{ default (include "coredns.fullname" .) .Values.hpa.name }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ template "coredns.fullname" . }}
name: {{ default (include "coredns.fullname" .) .Values.pdb.name }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/service-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "coredns.fullname" . }}-metrics
name: {{ default (include "coredns.fullname" .) .Values.servicemetrics.namePrefix }}-metrics
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/serviceaccount-autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "coredns.fullname" . }}-autoscaler
name: {{ default (include "coredns.fullname" .) .Values.serviceaccountAutoscaler.namePrefix }}-autoscaler
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "coredns.fullname" . }}
name: {{ default (include "coredns.fullname" .) .Values.servicemonitor.name }}
{{- if .Values.prometheus.monitor.namespace }}
namespace: {{ .Values.prometheus.monitor.namespace }}
{{- end }}
Expand Down
45 changes: 45 additions & 0 deletions charts/coredns/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,13 @@ hpa:
minReplicas: 1
maxReplicas: 2
metrics: []
name: ""

## Configue a cluster-proportional-autoscaler for coredns
# See https://github.com/kubernetes-incubator/cluster-proportional-autoscaler
autoscaler:
# deployment and all other autoscaler related components will be appended with "-autoscaler"
namePrefix: ""
# Enabled the cluster-proportional-autoscaler
enabled: false

Expand Down Expand Up @@ -334,3 +337,45 @@ deployment:
name: ""
## Annotations for the coredns deployment
annotations: {}

# additional values to mimic Amazon EKS CoreDNS implementation
configmap:
name: ""
## Annotations for the coredns deployment
annotations: {}

clusterrole:
name: ""
## Annotations for the coredns deployment
annotations: {}

clusterrolebinding:
name: ""
## Annotations for the coredns deployment
annotations: {}

# additional changes to have common naming schema across all resources
pdb:
name: ""

servicemonitor:
name: ""

# all autoscaler related components will be appended with "-autoscaler"
configmapAutoscaler:
namePrefix: ""

serviceaccountAutoscaler:
namePrefix: ""

clusterroleAutoscaler:
namePrefix: ""

clusterrolebindingAutoscaler:
namePrefix: ""

serviceaccountAutoscaler:
namePrefix: ""

servicemetrics:
namePrefix: ""