mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 18:23:25 -05:00
chore: Upgrade to golangci-lint v2 (#7236)
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
This commit is contained in:
@@ -140,8 +140,8 @@ func generateEndpointSlices(cidr string, client kubernetes.Interface) {
|
||||
Hostname: &hostname,
|
||||
},
|
||||
}
|
||||
eps.ObjectMeta.Name = "svc" + strconv.Itoa(count)
|
||||
eps.ObjectMeta.Labels = map[string]string{discovery.LabelServiceName: eps.ObjectMeta.Name}
|
||||
eps.Name = "svc" + strconv.Itoa(count)
|
||||
eps.Labels = map[string]string{discovery.LabelServiceName: eps.Name}
|
||||
_, err := client.DiscoveryV1().EndpointSlices("testns").Create(ctx, eps, meta.CreateOptions{})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -175,11 +175,12 @@ func generateSvcs(cidr string, svcType string, client kubernetes.Interface) {
|
||||
}
|
||||
default:
|
||||
for ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {
|
||||
if count%3 == 0 {
|
||||
switch count % 3 {
|
||||
case 0:
|
||||
createClusterIPSvc(count, client, ip)
|
||||
} else if count%3 == 1 {
|
||||
case 1:
|
||||
createHeadlessSvc(count, client, ip)
|
||||
} else if count%3 == 2 {
|
||||
case 2:
|
||||
createExternalSvc(count, client, ip)
|
||||
}
|
||||
count++
|
||||
|
||||
@@ -62,10 +62,11 @@ func (k *Kubernetes) External(state request.Request, headless bool) ([]msg.Servi
|
||||
|
||||
service := segs[last]
|
||||
last--
|
||||
if last == 0 {
|
||||
switch last {
|
||||
case 0:
|
||||
endpoint = stripUnderscore(segs[last])
|
||||
last--
|
||||
} else if last == 1 {
|
||||
case 1:
|
||||
protocol = stripUnderscore(segs[last])
|
||||
port = stripUnderscore(segs[last-1])
|
||||
last -= 2
|
||||
|
||||
@@ -332,10 +332,10 @@ func endpointHostname(addr object.EndpointAddress, endpointNameMode bool) string
|
||||
return addr.TargetRefName
|
||||
}
|
||||
if strings.Contains(addr.IP, ".") {
|
||||
return strings.Replace(addr.IP, ".", "-", -1)
|
||||
return strings.ReplaceAll(addr.IP, ".", "-")
|
||||
}
|
||||
if strings.Contains(addr.IP, ":") {
|
||||
return strings.Replace(addr.IP, ":", "-", -1)
|
||||
return strings.ReplaceAll(addr.IP, ":", "-")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -428,7 +428,7 @@ func (k *Kubernetes) findServices(r recordRequest, zone string) (services []msg.
|
||||
|
||||
zonePath := msg.Path(zone, coredns)
|
||||
for _, svc := range serviceList {
|
||||
if !(match(r.namespace, svc.Namespace) && match(r.service, svc.Name)) {
|
||||
if !match(r.namespace, svc.Namespace) || !match(r.service, svc.Name) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ func ToPod(obj meta.Object) (meta.Object, error) {
|
||||
Name: apiPod.GetName(),
|
||||
Labels: apiPod.GetLabels(),
|
||||
}
|
||||
t := apiPod.ObjectMeta.DeletionTimestamp
|
||||
t := apiPod.DeletionTimestamp
|
||||
if t != nil && !(*t).Time.IsZero() {
|
||||
// if the pod is in the process of termination, return an error so it can be ignored
|
||||
// during add/update event processing
|
||||
|
||||
Reference in New Issue
Block a user