Skip to content

Commit 0ca6e26

Browse files
committed
fix linters
1 parent 28afbc9 commit 0ca6e26

File tree

3 files changed

+47
-15
lines changed

3 files changed

+47
-15
lines changed

docs/flags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
| `--plural-cluster=""` | When using the plural provider, specify the cluster name you're running with |
159159
| `--plural-provider=""` | When using the plural provider, specify the provider name you're running with |
160160
| `--policy=sync` | Modify how DNS records are synchronized between sources and providers (default: sync, options: sync, upsert-only, create-only) |
161-
| `--registry=txt` | The registry implementation to use to keep track of DNS record ownership (default: txt, options: txt, noop, dynamodb, aws-sd) |
161+
| `--registry=txt` | The registry implementation to use to keep track of DNS record ownership (default: txt, options: aws-sd, crd, dynamodb, noop, txt) |
162162
| `--txt-owner-id="default"` | When using the TXT or DynamoDB registry, a name that identifies this instance of ExternalDNS (default: default) |
163163
| `--txt-prefix=""` | When using the TXT registry, a custom string that's prefixed to each ownership DNS record (optional). Could contain record type template like '%{record_type}-prefix-'. Mutual exclusive with txt-suffix! |
164164
| `--txt-suffix=""` | When using the TXT registry, a custom string that's suffixed to the host portion of each ownership DNS record (optional). Could contain record type template like '-%{record_type}-suffix'. Mutual exclusive with txt-prefix! |

registry/crd.go

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package registry
218

319
import (
@@ -76,8 +92,8 @@ func (dr DNSRecord) IsEndpoint(e *endpoint.Endpoint) bool {
7692
func (dr DNSRecord) EndpointLabels() endpoint.Labels {
7793
labels := endpoint.Labels{}
7894

79-
labels[endpoint.OwnerLabelKey] = dr.ObjectMeta.Labels[RecordOwnerLabel]
80-
labels[endpoint.ResourceLabelKey] = dr.ObjectMeta.Labels[RecordResourceLabel]
95+
labels[endpoint.OwnerLabelKey] = dr.Labels[RecordOwnerLabel]
96+
labels[endpoint.ResourceLabelKey] = dr.Labels[RecordResourceLabel]
8197
return labels
8298
}
8399

@@ -158,7 +174,7 @@ func NewCRDClientForAPIVersionKind(client kubernetes.Interface, kubeConfig, apiS
158174
)
159175
metav1.AddToGroupVersion(scheme, groupVersion)
160176

161-
config.ContentConfig.GroupVersion = &groupVersion
177+
config.GroupVersion = &groupVersion
162178
config.APIPath = "/apis"
163179
config.NegotiatedSerializer = serializer.WithoutConversionCodecFactory{CodecFactory: serializer.NewCodecFactory(scheme)}
164180

@@ -459,32 +475,32 @@ func (r *crdrequest) Body(obj interface{}) CRDRequest {
459475
}
460476

461477
func (r *crdrequest) Do(ctx context.Context) CRDResult {
462-
var real *rest.Request
478+
var req *rest.Request
463479
switch r.method {
464480
case "POST":
465-
real = r.client.Interface.Post()
481+
req = r.client.Interface.Post()
466482
case "PUT":
467-
real = r.client.Interface.Put()
483+
req = r.client.Interface.Put()
468484
case "DELETE":
469-
real = r.client.Interface.Delete()
485+
req = r.client.Interface.Delete()
470486
default:
471-
real = r.client.Interface.Get()
487+
req = r.client.Interface.Get()
472488
}
473489

474-
real = real.Namespace(r.namespace).Resource(r.resource.Name)
490+
req = req.Namespace(r.namespace).Resource(r.resource.Name)
475491
if r.name != "" {
476-
real = real.Name(r.name)
492+
req = req.Name(r.name)
477493
}
478494

479495
if r.params != nil {
480-
real = real.VersionedParams(r.params, r.client.codec)
496+
req = req.VersionedParams(r.params, r.client.codec)
481497
}
482498

483499
if r.body != nil {
484-
real = real.Body(r.body)
500+
req = req.Body(r.body)
485501
}
486502

487-
result := real.Do(ctx)
503+
result := req.Do(ctx)
488504
return &crdresult{result}
489505
}
490506

registry/crd_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package registry
218

319
import (
@@ -31,7 +47,6 @@ func inMemoryProviderWithEntries(t *testing.T, ctx context.Context, zone string,
3147
err := p.ApplyChanges(ctx, &plan.Changes{
3248
Create: endpoints,
3349
})
34-
3550
if err != nil {
3651
t.Fatal("Could not create an in memory provider", err)
3752
}
@@ -464,6 +479,7 @@ func (mr *mockRequest) Name(name string) CRDRequest {
464479
mr.name = name
465480
return mr
466481
}
482+
467483
func (mr *mockRequest) Namespace(namespace string) CRDRequest {
468484
mr.namespace = namespace
469485
return mr

0 commit comments

Comments
 (0)