diff --git a/stable/coredns/README.md b/stable/coredns/README.md index bbd971d..0e99037 100644 --- a/stable/coredns/README.md +++ b/stable/coredns/README.md @@ -5,7 +5,8 @@ # TL;DR; ```console -$ helm install coredns --namespace=kube-system coredns/coredns +$ helm repo add coredns https://coredns.github.io/helm +$ helm --namespace=kube-system install coredns coredns/coredns ``` ## Introduction @@ -26,7 +27,7 @@ The chart can be installed as follows: ```console $ helm repo add coredns https://coredns.github.io/helm -$ helm install coredns --namespace=kube-system coredns/coredns +$ helm --namespace=kube-system install coredns coredns/coredns ``` The command deploys CoreDNS on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists various ways to override default configuration during deployment. @@ -38,85 +39,87 @@ The command deploys CoreDNS on the Kubernetes cluster in the default configurati To uninstall/delete the `coredns` deployment: ```console -$ helm delete coredns +$ helm uninstall coredns ``` The command removes all the Kubernetes components associated with the chart and deletes the release. ## Configuration -| Parameter | Description | Default | -|:----------------------------------------|:--------------------------------------------------------------------------------------|:------------------------------------------------------------| -| `image.repository` | The image repository to pull from | coredns/coredns | -| `image.tag` | The image tag to pull from | `1.8.0` | -| `image.pullPolicy` | Image pull policy | IfNotPresent | -| `replicaCount` | Number of replicas | 1 | -| `resources.limits.cpu` | Container maximum CPU | `100m` | -| `resources.limits.memory` | Container maximum memory | `128Mi` | -| `resources.requests.cpu` | Container requested CPU | `100m` | -| `resources.requests.memory` | Container requested memory | `128Mi` | -| `serviceType` | Kubernetes Service type | `ClusterIP` | -| `prometheus.service.enabled` | Set this to `true` to create Service for Prometheus metrics | `false` | -| `prometheus.service.annotations` | Annotations to add to the metrics Service | `{prometheus.io/scrape: "true", prometheus.io/port: "9153"}`| -| `prometheus.monitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` | -| `prometheus.monitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | {} | -| `prometheus.monitor.namespace` | Selector to select which namespaces the Endpoints objects are discovered from. | `""` | -| `service.clusterIP` | IP address to assign to service | `""` | -| `service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` | -| `service.externalIPs` | External IP addresses | [] | -| `service.externalTrafficPolicy` | Enable client source IP preservation | [] | -| `service.annotations` | Annotations to add to service | {} | -| `serviceAccount.create` | If true, create & use serviceAccount | false | -| `serviceAccount.name` | If not set & create is true, use template fullname | | -| `rbac.create` | If true, create & use RBAC resources | true | -| `rbac.pspEnable` | Specifies whether a PodSecurityPolicy should be created. | `false` | -| `isClusterService` | Specifies whether chart should be deployed as cluster-service or normal k8s app. | true | -| `priorityClassName` | Name of Priority Class to assign pods | `""` | -| `servers` | Configuration for CoreDNS and plugins | See values.yml | -| `affinity` | Affinity settings for pod assignment | {} | -| `nodeSelector` | Node labels for pod assignment | {} | -| `tolerations` | Tolerations for pod assignment | [] | -| `zoneFiles` | Configure custom Zone files | [] | -| `extraVolumes` | Optional array of volumes to create | [] | -| `extraVolumeMounts` | Optional array of volumes to mount inside the CoreDNS container | [] | -| `extraSecrets` | Optional array of secrets to mount inside the CoreDNS container | [] | -| `customLabels` | Optional labels for Deployment(s), Pod, Service, ServiceMonitor objects | {} | -| `rollingUpdate.maxUnavailable` | Maximum number of unavailable replicas during rolling update | `1` | -| `rollingUpdate.maxSurge` | Maximum number of pods created above desired number of pods | `25%` | -| `podDisruptionBudget` | Optional PodDisruptionBudget | {} | -| `podAnnotations` | Optional Pod only Annotations | {} | -| `terminationGracePeriodSeconds` | Optional duration in seconds the pod needs to terminate gracefully. | 30 | -| `preStopSleep` | Definition of Kubernetes preStop hook executed before Pod termination | {} | -| `hpa.enabled` | Enable Hpa autoscaler instead of proportional one | `false` | -| `hpa.minReplicas` | Hpa minimum number of CoreDNS replicas | `1` | -| `hpa.maxReplicas` | Hpa maximum number of CoreDNS replicas | `2` | -| `hpa.metrics` | Metrics definitions used by Hpa to scale up and down | {} | -| `autoscaler.enabled` | Optionally enabled a cluster-proportional-autoscaler for CoreDNS | `false` | -| `autoscaler.coresPerReplica` | Number of cores in the cluster per CoreDNS replica | `256` | -| `autoscaler.nodesPerReplica` | Number of nodes in the cluster per CoreDNS replica | `16` | -| `autoscaler.min` | Min size of replicaCount | 0 | -| `autoscaler.max` | Max size of replicaCount | 0 (aka no max) | -| `autoscaler.includeUnschedulableNodes` | Should the replicas scale based on the total number or only schedulable nodes | `false` | -| `autoscaler.preventSinglePointFailure` | If true does not allow single points of failure to form | `true` | -| `autoscaler.image.repository` | The image repository to pull autoscaler from | k8s.gcr.io/cluster-proportional-autoscaler-amd64 | -| `autoscaler.image.tag` | The image tag to pull autoscaler from | `1.8.0` | -| `autoscaler.image.pullPolicy` | Image pull policy for the autoscaler | IfNotPresent | -| `autoscaler.priorityClassName` | Optional priority class for the autoscaler pod. `priorityClassName` used if not set. | `""` | -| `autoscaler.affinity` | Affinity settings for pod assignment for autoscaler | {} | -| `autoscaler.nodeSelector` | Node labels for pod assignment for autoscaler | {} | -| `autoscaler.tolerations` | Tolerations for pod assignment for autoscaler | [] | -| `autoscaler.resources.limits.cpu` | Container maximum CPU for cluster-proportional-autoscaler | `20m` | -| `autoscaler.resources.limits.memory` | Container maximum memory for cluster-proportional-autoscaler | `10Mi` | -| `autoscaler.resources.requests.cpu` | Container requested CPU for cluster-proportional-autoscaler | `20m` | -| `autoscaler.resources.requests.memory` | Container requested memory for cluster-proportional-autoscaler | `10Mi` | -| `autoscaler.configmap.annotations` | Annotations to add to autoscaler config map. For example to stop CI renaming them | {} | +| Parameter | Description | Default | +|:----------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------| +| `image.repository` | The image repository to pull from | coredns/coredns | +| `image.tag` | The image tag to pull from | `1.8.0` | +| `image.pullPolicy` | Image pull policy | IfNotPresent | +| `replicaCount` | Number of replicas | 1 | +| `resources.limits.cpu` | Container maximum CPU | `100m` | +| `resources.limits.memory` | Container maximum memory | `128Mi` | +| `resources.requests.cpu` | Container requested CPU | `100m` | +| `resources.requests.memory` | Container requested memory | `128Mi` | +| `serviceType` | Kubernetes Service type | `ClusterIP` | +| `prometheus.service.enabled` | Set this to `true` to create Service for Prometheus metrics | `false` | +| `prometheus.service.annotations` | Annotations to add to the metrics Service | `{prometheus.io/scrape: "true", prometheus.io/port: "9153"}`| +| `prometheus.monitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` | +| `prometheus.monitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | {} | +| `prometheus.monitor.namespace` | Selector to select which namespaces the Endpoints objects are discovered from. | `""` | +| `service.clusterIP` | IP address to assign to service | `""` | +| `service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` | +| `service.externalIPs` | External IP addresses | [] | +| `service.externalTrafficPolicy` | Enable client source IP preservation | [] | +| `service.annotations` | Annotations to add to service | {} | +| `serviceAccount.create` | If true, create & use serviceAccount | false | +| `serviceAccount.name` | If not set & create is true, use template fullname | | +| `rbac.create` | If true, create & use RBAC resources | true | +| `rbac.pspEnable` | Specifies whether a PodSecurityPolicy should be created. | `false` | +| `isClusterService` | Specifies whether chart should be deployed as cluster-service or normal k8s app. | true | +| `priorityClassName` | Name of Priority Class to assign pods | `""` | +| `servers` | Configuration for CoreDNS and plugins | See values.yml | +| `affinity` | Affinity settings for pod assignment | {} | +| `nodeSelector` | Node labels for pod assignment | {} | +| `tolerations` | Tolerations for pod assignment | [] | +| `zoneFiles` | Configure custom Zone files | [] | +| `extraVolumes` | Optional array of volumes to create | [] | +| `extraVolumeMounts` | Optional array of volumes to mount inside the CoreDNS container | [] | +| `extraSecrets` | Optional array of secrets to mount inside the CoreDNS container | [] | +| `customLabels` | Optional labels for Deployment(s), Pod, Service, ServiceMonitor objects | {} | +| `rollingUpdate.maxUnavailable` | Maximum number of unavailable replicas during rolling update | `1` | +| `rollingUpdate.maxSurge` | Maximum number of pods created above desired number of pods | `25%` | +| `podDisruptionBudget` | Optional PodDisruptionBudget | {} | +| `podAnnotations` | Optional Pod only Annotations | {} | +| `terminationGracePeriodSeconds` | Optional duration in seconds the pod needs to terminate gracefully. | 30 | +| `preStopSleep` | Definition of Kubernetes preStop hook executed before Pod termination | {} | +| `hpa.enabled` | Enable Hpa autoscaler instead of proportional one | `false` | +| `hpa.minReplicas` | Hpa minimum number of CoreDNS replicas | `1` | +| `hpa.maxReplicas` | Hpa maximum number of CoreDNS replicas | `2` | +| `hpa.metrics` | Metrics definitions used by Hpa to scale up and down | {} | +| `autoscaler.enabled` | Optionally enabled a cluster-proportional-autoscaler for CoreDNS | `false` | +| `autoscaler.coresPerReplica` | Number of cores in the cluster per CoreDNS replica | `256` | +| `autoscaler.nodesPerReplica` | Number of nodes in the cluster per CoreDNS replica | `16` | +| `autoscaler.min` | Min size of replicaCount | 0 | +| `autoscaler.max` | Max size of replicaCount | 0 (aka no max) | +| `autoscaler.includeUnschedulableNodes` | Should the replicas scale based on the total number or only schedulable nodes | `false` | +| `autoscaler.preventSinglePointFailure` | If true does not allow single points of failure to form | `true` | +| `autoscaler.image.repository` | The image repository to pull autoscaler from | k8s.gcr.io/cluster-proportional-autoscaler-amd64 | +| `autoscaler.image.tag` | The image tag to pull autoscaler from | `1.8.0` | +| `autoscaler.image.pullPolicy` | Image pull policy for the autoscaler | IfNotPresent | +| `autoscaler.priorityClassName` | Optional priority class for the autoscaler pod. `priorityClassName` used if not set. | `""` | +| `autoscaler.affinity` | Affinity settings for pod assignment for autoscaler | {} | +| `autoscaler.nodeSelector` | Node labels for pod assignment for autoscaler | {} | +| `autoscaler.tolerations` | Tolerations for pod assignment for autoscaler | [] | +| `autoscaler.resources.limits.cpu` | Container maximum CPU for cluster-proportional-autoscaler | `20m` | +| `autoscaler.resources.limits.memory` | Container maximum memory for cluster-proportional-autoscaler | `10Mi` | +| `autoscaler.resources.requests.cpu` | Container requested CPU for cluster-proportional-autoscaler | `20m` | +| `autoscaler.resources.requests.memory` | Container requested memory for cluster-proportional-autoscaler | `10Mi` | +| `autoscaler.configmap.annotations` | Annotations to add to autoscaler config map. For example to stop CI renaming them | {} | +| `deployment.enabled` | Optionally disable the main deployment and its respective resources. | `true` | +| `deployment.name` | Name of the deployment if `deployment.enabled` is true. Otherwise the name of an existing deployment for the autoscaler or HPA to target. | `""` | See `values.yaml` for configuration notes. Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, ```console $ helm install coredns \ - --set rbac.create=false \ - coredns/coredns + coredns/coredns \ + --set rbac.create=false ``` The above command disables automatic creation of RBAC rules. @@ -124,7 +127,7 @@ The above command disables automatic creation of RBAC rules. Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, ```console -$ helm install coredns --namespace=kube-system coredns/coredns -f values.yaml +$ helm install coredns coredns/coredns -f values.yaml ``` > **Tip**: You can use the default [values.yaml](values.yaml) diff --git a/stable/coredns/templates/clusterrole.yaml b/stable/coredns/templates/clusterrole.yaml index 5434baa..8544681 100644 --- a/stable/coredns/templates/clusterrole.yaml +++ b/stable/coredns/templates/clusterrole.yaml @@ -1,4 +1,4 @@ -{{- if .Values.rbac.create }} +{{- if and .Values.deployment.enabled .Values.rbac.create }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/stable/coredns/templates/clusterrolebinding.yaml b/stable/coredns/templates/clusterrolebinding.yaml index 49da9b5..1d3cb53 100644 --- a/stable/coredns/templates/clusterrolebinding.yaml +++ b/stable/coredns/templates/clusterrolebinding.yaml @@ -1,4 +1,4 @@ -{{- if .Values.rbac.create }} +{{- if and .Values.deployment.enabled .Values.rbac.create }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: diff --git a/stable/coredns/templates/configmap.yaml b/stable/coredns/templates/configmap.yaml index b7fa5b5..ebbea9b 100644 --- a/stable/coredns/templates/configmap.yaml +++ b/stable/coredns/templates/configmap.yaml @@ -1,3 +1,5 @@ +{{- if .Values.deployment.enabled }} +--- apiVersion: v1 kind: ConfigMap metadata: @@ -31,3 +33,4 @@ data: {{- range .Values.zoneFiles }} {{ .filename }}: {{ toYaml .contents | indent 4 }} {{- end }} +{{- end }} diff --git a/stable/coredns/templates/deployment-autoscaler.yaml b/stable/coredns/templates/deployment-autoscaler.yaml index c57c157..35e5fbb 100644 --- a/stable/coredns/templates/deployment-autoscaler.yaml +++ b/stable/coredns/templates/deployment-autoscaler.yaml @@ -71,7 +71,7 @@ spec: - /cluster-proportional-autoscaler - --namespace={{ .Release.Namespace }} - --configmap={{ template "coredns.fullname" . }}-autoscaler - - --target=Deployment/{{ template "coredns.fullname" . }} + - --target=Deployment/{{ default (include "coredns.fullname" .) .Values.deployment.name }} - --logtostderr=true - --v=2 {{- end }} diff --git a/stable/coredns/templates/deployment.yaml b/stable/coredns/templates/deployment.yaml index 5dd2b35..8ad7445 100644 --- a/stable/coredns/templates/deployment.yaml +++ b/stable/coredns/templates/deployment.yaml @@ -1,7 +1,9 @@ +{{- if .Values.deployment.enabled }} +--- apiVersion: apps/v1 kind: Deployment metadata: - name: {{ template "coredns.fullname" . }} + name: {{ default (include "coredns.fullname" .) .Values.deployment.name }} labels: app.kubernetes.io/managed-by: {{ .Release.Service | quote }} app.kubernetes.io/instance: {{ .Release.Name | quote }} @@ -145,3 +147,4 @@ spec: {{- if .Values.extraVolumes }} {{ toYaml .Values.extraVolumes | indent 8 }} {{- end }} +{{- end }} diff --git a/stable/coredns/templates/hpa.yaml b/stable/coredns/templates/hpa.yaml index 826eda5..bbc9edb 100644 --- a/stable/coredns/templates/hpa.yaml +++ b/stable/coredns/templates/hpa.yaml @@ -21,9 +21,9 @@ spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ template "coredns.fullname" . }} + name: {{ default (include "coredns.fullname" .) .Values.deployment.name }} minReplicas: {{ .Values.hpa.minReplicas }} maxReplicas: {{ .Values.hpa.maxReplicas }} metrics: {{ toYaml .Values.hpa.metrics | indent 4 }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/stable/coredns/templates/poddisruptionbudget.yaml b/stable/coredns/templates/poddisruptionbudget.yaml index 8ade224..7754896 100644 --- a/stable/coredns/templates/poddisruptionbudget.yaml +++ b/stable/coredns/templates/poddisruptionbudget.yaml @@ -1,4 +1,4 @@ -{{- if .Values.podDisruptionBudget -}} +{{- if and .Values.deployment.enabled .Values.podDisruptionBudget -}} apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: diff --git a/stable/coredns/templates/podsecuritypolicy.yaml b/stable/coredns/templates/podsecuritypolicy.yaml index 754943f..8a5d727 100644 --- a/stable/coredns/templates/podsecuritypolicy.yaml +++ b/stable/coredns/templates/podsecuritypolicy.yaml @@ -1,4 +1,4 @@ -{{- if .Values.rbac.pspEnable }} +{{- if and .Values.deployment.enabled .Values.rbac.pspEnable }} {{ if .Capabilities.APIVersions.Has "policy/v1beta1" }} apiVersion: policy/v1beta1 {{ else }} diff --git a/stable/coredns/templates/service-metrics.yaml b/stable/coredns/templates/service-metrics.yaml index 6c80a96..b91922d 100644 --- a/stable/coredns/templates/service-metrics.yaml +++ b/stable/coredns/templates/service-metrics.yaml @@ -1,4 +1,4 @@ -{{- if .Values.prometheus.service.enabled }} +{{- if and .Values.deployment.enabled .Values.prometheus.service.enabled }} apiVersion: v1 kind: Service metadata: diff --git a/stable/coredns/templates/service.yaml b/stable/coredns/templates/service.yaml index 2288eec..58d2b15 100644 --- a/stable/coredns/templates/service.yaml +++ b/stable/coredns/templates/service.yaml @@ -1,3 +1,5 @@ +{{- if .Values.deployment.enabled }} +--- apiVersion: v1 kind: Service metadata: @@ -40,3 +42,4 @@ spec: ports: {{ include "coredns.servicePorts" . | indent 2 -}} type: {{ default "ClusterIP" .Values.serviceType }} +{{- end }} diff --git a/stable/coredns/templates/serviceaccount.yaml b/stable/coredns/templates/serviceaccount.yaml index f8283be..a22f0cf 100644 --- a/stable/coredns/templates/serviceaccount.yaml +++ b/stable/coredns/templates/serviceaccount.yaml @@ -1,4 +1,4 @@ -{{- if .Values.serviceAccount.create }} +{{- if and .Values.deployment.enabled .Values.serviceAccount.create }} apiVersion: v1 kind: ServiceAccount metadata: diff --git a/stable/coredns/templates/servicemonitor.yaml b/stable/coredns/templates/servicemonitor.yaml index 0a4ffb5..7f53fdf 100644 --- a/stable/coredns/templates/servicemonitor.yaml +++ b/stable/coredns/templates/servicemonitor.yaml @@ -1,4 +1,4 @@ -{{- if .Values.prometheus.monitor.enabled }} +{{- if and .Values.deployment.enabled .Values.prometheus.monitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: diff --git a/stable/coredns/values.yaml b/stable/coredns/values.yaml index e5cc46e..6fb04ab 100644 --- a/stable/coredns/values.yaml +++ b/stable/coredns/values.yaml @@ -274,3 +274,7 @@ autoscaler: ## Annotations for the coredns-autoscaler configmap # i.e. strategy.spinnaker.io/versioned: "false" to ensure configmap isn't renamed annotations: {} + +deployment: + enabled: true + name: ""