Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marcmognol committed Mar 15, 2024
1 parent a5dc994 commit 8db8728
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/templates/danglingservice/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ func init() {
Message: "service has no selector specified",
}}
} else {
// Check if Service is linked to Endpoints
for _, obj := range lintCtx.Objects() {
if obj.(type) = *batchV1Beta1.Endpoints {

endpoints, ok := object.K8sObject.(*v1.Endpoints)
if !ok {
continue
}
if service.Namespace != obj.K8sObject.GetNamespace() {
if endpoints.Namespace != obj.K8sObject.GetNamespace() {
continue
}
if service.Spec.Name == endpointTemplateSpec.Spec.Name {
if endpoints.Name == obj.GetK8sObjectName().Name {
// Found!
return nil
}
Expand Down

0 comments on commit 8db8728

Please sign in to comment.