mirror of
https://github.com/tailscale/tailscale.git
synced 2025-05-09 17:16:50 +00:00
k8s-operator: adding check for advertised services before setting ingress status
Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
This commit is contained in:
parent
31c2c61e77
commit
b87c72e788
@ -356,19 +356,31 @@ func (r *HAServiceReconciler) maybeProvision(ctx context.Context, hostname strin
|
||||
return false, fmt.Errorf("failed to update tailscaled config: %w", err)
|
||||
}
|
||||
|
||||
// TODO: is it ready?
|
||||
if svc.Spec.Type != corev1.ServiceTypeLoadBalancer {
|
||||
return false, nil
|
||||
}
|
||||
dnsName, err := r.dnsNameForService(ctx, serviceName)
|
||||
|
||||
count, err := r.numberPodsAdvertising(ctx, pgName, serviceName)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("error getting DNS name for Service: %w", err)
|
||||
return false, fmt.Errorf("failed to get number of advertised Pods: %w", err)
|
||||
}
|
||||
ingress := []corev1.LoadBalancerIngress{
|
||||
{Hostname: dnsName,
|
||||
IP: vipv4.String()},
|
||||
|
||||
var lbs []corev1.LoadBalancerIngress
|
||||
if count != 0 {
|
||||
dnsName, err := r.dnsNameForService(ctx, serviceName)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("error getting DNS name for Service: %w", err)
|
||||
}
|
||||
|
||||
lbs = []corev1.LoadBalancerIngress{
|
||||
{
|
||||
Hostname: dnsName,
|
||||
IP: vipv4.String(),
|
||||
},
|
||||
}
|
||||
}
|
||||
svc.Status.LoadBalancer.Ingress = ingress
|
||||
|
||||
svc.Status.LoadBalancer.Ingress = lbs
|
||||
|
||||
// if apiequality.Semantic.DeepEqual(oldStatus, &ing.Status) {
|
||||
// return svcsChanged, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user