Skip to content

Commit

Permalink
Allow configuration of extra coredns server blocks (#1709)
Browse files Browse the repository at this point in the history
The goal of this PR is to allow configuration of the glue records of the other clusters in k8gb's coreDNS.
I know this defies DNS best practices because k8gb is not authoritative for the parent zone. However, it allows k8gb to do cluster discovery without depending on any infrastructure outside of the cluster.

The configuration is quite generic, giving the users freedom to configure what they desire, therefore we could add it to the chart.

Example configuration:
```
    extraServerBlocks: |
      example.com:5353 {
        errors
        health
        ready
        prometheus 0.0.0.0:9153
        forward . /etc/resolv.conf
        k8s_crd {
            filter k8gb.absa.oss/dnstype=glue
            negttl {{ .Values.k8gb.dnsZoneNegTTL }}
            loadbalance weight
        }
      }
```

Testing:
```
helm package . && helm template k8gb k8gb-v0.13.0.tgz > manifests.yaml
```

Signed-off-by: abaguas <andre.aguas@protonmail.com>
  • Loading branch information
abaguas committed Sep 17, 2024
1 parent 283a7d6 commit 518a2ce
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion chart/k8gb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ For Kubernetes `< 1.19` use this chart and k8gb in version `0.8.8` or lower.
| infoblox.wapiVersion | string | `"2.3.1"` | WAPI version |
| istio.enabled | bool | `true` | install istio RBAC |
| k8gb.clusterGeoTag | string | `"eu"` | used for places where we need to distinguish between different Gslb instances |
| k8gb.coredns | object | `{"extra_plugins":[]}` | Extra CoreDNS plugins to be enabled (yaml object) |
| k8gb.coredns.extraServerBlocks | string | `""` | Extra CoreDNS server blocks |
| k8gb.coredns.extra_plugins | list | `[]` | Extra CoreDNS plugins to be enabled |
| k8gb.deployCrds | bool | `true` | whether it should also deploy the gslb and dnsendpoints CRDs |
| k8gb.deployRbac | bool | `true` | whether it should also deploy the service account, cluster role and cluster role binding |
| k8gb.dnsZone | string | `"cloud.example.com"` | dnsZone controlled by gslb |
Expand Down
3 changes: 3 additions & 0 deletions chart/k8gb/templates/coredns-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ data:
loadbalance weight
}
}
{{- with .Values.k8gb.coredns.extraServerBlocks -}}
{{- tpl . $ | nindent 4 }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions chart/k8gb/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@
"array",
"null"
]
},
"extraServerBlocks": {
"type": "string"
}
},
"title": "k8gbCoredns"
Expand Down
4 changes: 3 additions & 1 deletion chart/k8gb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ k8gb:
extGslbClustersGeoTags: "us"
# -- Reconcile time in seconds
reconcileRequeueSeconds: 30
# -- Extra CoreDNS plugins to be enabled (yaml object)
coredns:
# -- Extra CoreDNS server blocks
extraServerBlocks: ""
# -- Extra CoreDNS plugins to be enabled
extra_plugins: []
log:
# -- log format (simple,json)
Expand Down

0 comments on commit 518a2ce

Please sign in to comment.