canonical/microk8s-core-addons

Extending DNS addon args

Opened this issue · 1 comments

Summary

Please, could you extend the DNS addon args by a third argument representing the cluster-domain?
I just used the launch configuration to set up a new MicroK8s (v1.29) cluster , when I realized there is a lack of opportunities to definine the cluster-domain the for the DNS configmap. After a short glance into the code I noticed the cluster-domain value is fixed to cluster.local.

Why is this important?

It would be allow to set up a MicroK8s cluster in a programmatically way without patching the DNS configmap afterward.

Are you interested in contributing to this feature?

I couldn't test any of the following code snippets. However, maybe it helps to get it done.

Changes in file microk8s-core-addons/addons/dns/enable:

#new after line 57:
CLUSTER_DOMAIN="$3"
if [ -z "$CLUSTER_DOMAIN" ]; then
  CLUSTER_DOMAIN="cluster.local"

#new after line 67:
map[\$CLUSTERDOMAIN]="$CLUSTER_DOMAIN"

# change line 75:
if ! grep -q -- "--cluster-domain=$CLUSTER_DOMAIN" "${SNAP_DATA}/args/kubelet"; then

# change line 81:
refresh_opt_in_config "cluster-domain" "$CLUSTER_DOMAIN" kubelet

And change line 30 in file microk8s-core-addons/addons/dns/coredns.yaml:

        kubernetes $CLUSTERDOMAIN in-addr.arpa ip6.arpa {

Thanks, I appreciate your effort!

Thanks @TecIntelli

That would indeed be a useful addition. Contributions are welcome, i've added a good-first-issue label.