-
-
Notifications
You must be signed in to change notification settings - Fork 499
Open
Description
It would be nice to provide some hooks for the lifecycle of the k3d clusters. These hooks would be invoked, for example, after a cluster is created, before a cluster is destroyed, after the registry is created, etc. They would receive some information from k3d in environment variables.
For example, in the k3d config file located at $HOME/.config/k3d/config
:
hooks:
post-create: $HOME/.kd3/post-create.sh
And post-create.sh
:
#!/bin/sh
# input: some variables like K3D_CLUSTER_NAME, K3D_MASTER_IP, K3D_CLUSTER_IPS, etc
dns_server="" # TODO: calculate the DNS server from $K3D_CLUSTER_IPS
# route all the 10.0.x.x traffic to the cluster via the master
sudo ip route add $K3D_CLUSTER_IPS via $K3D_MASTER_IP
# this would resolve (from the host) all the services running in this k3d cluster
# with the DNS server inside the cluster
cat<<EOF > /etc/NetworkManager/dnsmasq.d/$K3D_CLUSTER_NAME.conf
server=/$K3D_CLUSTER.local/$dns_server
local=/$K3D_CLUSTER.local/
EOF
Depends on #204
ajprok
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request