diff --git a/charts/coredns/Chart.yaml b/charts/coredns/Chart.yaml index 09bc477..cb0ff4a 100644 --- a/charts/coredns/Chart.yaml +++ b/charts/coredns/Chart.yaml @@ -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 diff --git a/charts/coredns/templates/clusterrole-autoscaler.yaml b/charts/coredns/templates/clusterrole-autoscaler.yaml index 241cfac..a6fe1b6 100644 --- a/charts/coredns/templates/clusterrole-autoscaler.yaml +++ b/charts/coredns/templates/clusterrole-autoscaler.yaml @@ -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 }} diff --git a/charts/coredns/templates/clusterrole.yaml b/charts/coredns/templates/clusterrole.yaml index 4f5c25b..c8b7dcd 100644 --- a/charts/coredns/templates/clusterrole.yaml +++ b/charts/coredns/templates/clusterrole.yaml @@ -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 }} @@ -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: - "" diff --git a/charts/coredns/templates/clusterrolebinding-autoscaler.yaml b/charts/coredns/templates/clusterrolebinding-autoscaler.yaml index 9c7a861..2246683 100644 --- a/charts/coredns/templates/clusterrolebinding-autoscaler.yaml +++ b/charts/coredns/templates/clusterrolebinding-autoscaler.yaml @@ -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 }} @@ -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 }} diff --git a/charts/coredns/templates/clusterrolebinding.yaml b/charts/coredns/templates/clusterrolebinding.yaml index 534a82d..6780c1d 100644 --- a/charts/coredns/templates/clusterrolebinding.yaml +++ b/charts/coredns/templates/clusterrolebinding.yaml @@ -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 }} @@ -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" . }} diff --git a/charts/coredns/templates/configmap-autoscaler.yaml b/charts/coredns/templates/configmap-autoscaler.yaml index dab4d5a..a77bf3c 100644 --- a/charts/coredns/templates/configmap-autoscaler.yaml +++ b/charts/coredns/templates/configmap-autoscaler.yaml @@ -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 }} diff --git a/charts/coredns/templates/configmap.yaml b/charts/coredns/templates/configmap.yaml index 496f026..add536c 100644 --- a/charts/coredns/templates/configmap.yaml +++ b/charts/coredns/templates/configmap.yaml @@ -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 }} @@ -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 }} diff --git a/charts/coredns/templates/deployment-autoscaler.yaml b/charts/coredns/templates/deployment-autoscaler.yaml index 30db3b6..848c9e8 100644 --- a/charts/coredns/templates/deployment-autoscaler.yaml +++ b/charts/coredns/templates/deployment-autoscaler.yaml @@ -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 }} @@ -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 }} @@ -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 diff --git a/charts/coredns/templates/deployment.yaml b/charts/coredns/templates/deployment.yaml index 7412e19..50f27f3 100644 --- a/charts/coredns/templates/deployment.yaml +++ b/charts/coredns/templates/deployment.yaml @@ -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 }} @@ -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 diff --git a/charts/coredns/templates/hpa.yaml b/charts/coredns/templates/hpa.yaml index 5fc3cff..aa85a3c 100644 --- a/charts/coredns/templates/hpa.yaml +++ b/charts/coredns/templates/hpa.yaml @@ -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 }} diff --git a/charts/coredns/templates/poddisruptionbudget.yaml b/charts/coredns/templates/poddisruptionbudget.yaml index 5eddb35..1dd83fc 100644 --- a/charts/coredns/templates/poddisruptionbudget.yaml +++ b/charts/coredns/templates/poddisruptionbudget.yaml @@ -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 }} diff --git a/charts/coredns/templates/service-metrics.yaml b/charts/coredns/templates/service-metrics.yaml index 7e6ce78..b89941c 100644 --- a/charts/coredns/templates/service-metrics.yaml +++ b/charts/coredns/templates/service-metrics.yaml @@ -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 }} diff --git a/charts/coredns/templates/serviceaccount-autoscaler.yaml b/charts/coredns/templates/serviceaccount-autoscaler.yaml index d068a03..304e334 100644 --- a/charts/coredns/templates/serviceaccount-autoscaler.yaml +++ b/charts/coredns/templates/serviceaccount-autoscaler.yaml @@ -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 }} diff --git a/charts/coredns/templates/servicemonitor.yaml b/charts/coredns/templates/servicemonitor.yaml index d5e6804..43f53f0 100644 --- a/charts/coredns/templates/servicemonitor.yaml +++ b/charts/coredns/templates/servicemonitor.yaml @@ -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 }} diff --git a/charts/coredns/values.yaml b/charts/coredns/values.yaml index e7d21c2..8c5efce 100644 --- a/charts/coredns/values.yaml +++ b/charts/coredns/values.yaml @@ -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 @@ -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: ""