Skip to content

Commit

Permalink
Stub out isRegistered
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Eckert committed Nov 15, 2021
1 parent 50b1861 commit 7a21d1f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion control-plane/connect-inject/endpoints_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ func (r *EndpointsController) Reconcile(ctx context.Context, req ctrl.Request) (
// If the endpoints object has the label "connect-ignore" set to true, deregister all instances in Consul for this service.
// It is possible that the endpoints object has never been registered, in which case deregistration is a no-op.
if value, ok := serviceEndpoints.Labels[labelServiceIgnore]; ok && value == "true" {
return r.deregisterServiceOnAllAgents(ctx, req.Name, req.Namespace, nil, endpointPods)
if isRegistered() {
return r.deregisterServiceOnAllAgents(ctx, req.Name, req.Namespace, nil, endpointPods)
}
return ctrl.Result{}, nil
}

r.Log.Info("retrieved", "name", serviceEndpoints.Name, "ns", serviceEndpoints.Namespace)
Expand Down Expand Up @@ -1019,3 +1022,11 @@ func mapAddresses(addresses corev1.EndpointSubset) map[corev1.EndpointAddress]st

return m
}

// isRegistered checks if the endpoint is registered in Consul.
func isRegistered() bool {
// TODO: Implement this.
// _, err := r.consul.Catalog().Service(endpoint.ServiceName, "", nil)
// return err == nil
return true
}

0 comments on commit 7a21d1f

Please sign in to comment.