Problem with Agent, Flux and Cluster Domain
I'm using the GitLab agent in conjunction with Flux CD for a Google Kubernetes Engine Cluster and I have encountered the following problem.
The cluster uses Cloud DNS with VPC scope instead of kube-dns. It uses the custom cluster domain mydomain.internal instead of the default cluster.local. I have deployed a GitLab agent as described in the documentation. However, the agent is not working because it can't resolve the webhook-receiver service. I found the following line in the agent logs (kubectl logs deployment/gitlab-agent-v2):
{"level":"error","time":"2024-04-29T11:21:37.240Z","msg":"Unable to trigger Receiver","mod_name":"flux","project_id":"REDACTED","error":"dial tcp: lookup webhook-receiver.flux-system.svc.cluster.local on X.X.X.X:X: no such host","agent_id":10}
I noticed that the agent tries to call webhook-receiver.flux-system.svc.cluster.local, which can't be resolved. I confirmed with nslookup:
# nslookup webhook-receiver.flux-system.svc.cluster.local
Server: X.X.X.X
Address: X.X.X.X#X
** server can't find webhook-receiver.flux-system.svc.cluster.local: NXDOMAIN
I believe the agent should try to call webhook-receiver.flux-system.svc.mydomain.internal instead, which can be resolved:
# nslookup webhook-receiver.flux-system.svc.mydomain.internal
Server: X.X.X.X
Address: X.X.X.X#X
Non-authoritative answer:
Name: webhook-receiver.flux-system.svc.mydomain.internal
Address: Y.Y.Y.Y
Is it possible to configure the agent to use the cluster domain mydomain.internal? I glanced over the code and found WebhookReceiverUrl in the FluxCF struct but I'm unsure how to set its value. I'm using the Helm chart to deploy the agent.