Skip to content

Commit 5bbdd1d

Browse files
committed
remove unecessary dependencies
1 parent 8b2de96 commit 5bbdd1d

4 files changed

Lines changed: 58 additions & 63 deletions

File tree

cmd/webhook/main_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import (
77
"testing"
88

99
acmetest "github.com/cert-manager/cert-manager/test/acme"
10-
"github.com/go-logr/logr"
1110
"github.com/ionos-cloud/cert-manager-webhook-ionos-cloud/internal/resolver"
1211
"go.uber.org/zap"
13-
controller_runtime_log "sigs.k8s.io/controller-runtime/pkg/log"
1412
)
1513

1614
var zone = os.Getenv("TEST_ZONE_NAME")
@@ -24,9 +22,6 @@ func TestBasicConformance(t *testing.T) {
2422
t.Fatal(err.Error())
2523
}
2624

27-
// this is to remove a log message warning in controller runtime
28-
controller_runtime_log.SetLogger(logr.New(controller_runtime_log.NullLogSink{}))
29-
3025
solver := resolver.NewResolver("basic-present-record", resolver.DefaultK8FactoryFactory,
3126
resolver.DefaultDNSAPIFactory, logger)
3227
fixture := acmetest.NewFixture(solver,
@@ -47,9 +42,6 @@ func TestExtendedConformance(t *testing.T) {
4742
t.Fatal(err.Error())
4843
}
4944

50-
// this is to remove a log message warning in controller runtime
51-
controller_runtime_log.SetLogger(logr.New(controller_runtime_log.NullLogSink{}))
52-
5345
solver := resolver.NewResolver("extended-supports-multiple-same-domain", resolver.DefaultK8FactoryFactory,
5446
resolver.DefaultDNSAPIFactory, logger)
5547
fixture := acmetest.NewFixture(solver,

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@ go 1.25.1
66
// please place any replace statements here at the top for visibility and add a
77
// comment to it as to when it can be removed
88

9-
replace sigs.k8s.io/structured-merge-diff/v4 => sigs.k8s.io/structured-merge-diff/v4 v4.5.0
9+
//replace sigs.k8s.io/structured-merge-diff/v4 => sigs.k8s.io/structured-merge-diff/v4 v4.5.0
1010

1111
require (
1212
github.com/cert-manager/cert-manager v1.18.1
13-
github.com/go-logr/logr v1.4.3
1413
github.com/ionos-cloud/sdk-go-dns v1.4.0
1514
github.com/stretchr/testify v1.10.0
1615
go.uber.org/zap v1.27.0
1716
k8s.io/api v0.33.1
1817
k8s.io/apiextensions-apiserver v0.32.2
1918
k8s.io/apimachinery v0.33.1
2019
k8s.io/client-go v0.33.1
21-
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e
22-
sigs.k8s.io/controller-runtime v0.20.4
2320
)
2421

2522
require (
@@ -211,6 +208,7 @@ require (
211208
github.com/go-git/go-billy/v5 v5.6.1 // indirect
212209
github.com/go-git/go-git/v5 v5.13.1 // indirect
213210
github.com/go-jose/go-jose/v4 v4.1.0 // indirect
211+
github.com/go-logr/logr v1.4.3 // indirect
214212
github.com/go-logr/stdr v1.2.2 // indirect
215213
github.com/go-logr/zapr v1.3.0 // indirect
216214
github.com/go-openapi/analysis v0.23.0 // indirect
@@ -542,10 +540,12 @@ require (
542540
k8s.io/klog/v2 v2.130.1 // indirect
543541
k8s.io/kms v0.32.2 // indirect
544542
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
543+
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e // indirect
545544
lukechampine.com/blake3 v1.2.1 // indirect
546545
mvdan.cc/gofumpt v0.8.0 // indirect
547546
mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4 // indirect
548547
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.1 // indirect
548+
sigs.k8s.io/controller-runtime v0.20.4 // indirect
549549
sigs.k8s.io/gateway-api v1.1.0 // indirect
550550
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
551551
sigs.k8s.io/kind v0.27.0 // indirect

go.sum

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,10 +1710,11 @@ sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7np
17101710
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
17111711
sigs.k8s.io/kind v0.27.0 h1:PQ3f0iAWNIj66LYkZ1ivhEg/+Zb6UPMbO+qVei/INZA=
17121712
sigs.k8s.io/kind v0.27.0/go.mod h1:RZVFmy6qcwlSWwp6xeIUv7kXCPF3i8MXsEXxW/J+gJY=
1713+
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
17131714
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
17141715
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
1715-
sigs.k8s.io/structured-merge-diff/v4 v4.5.0 h1:nbCitCK2hfnhyiKo6uf2HxUPTCodY6Qaf85SbDIaMBk=
1716-
sigs.k8s.io/structured-merge-diff/v4 v4.5.0/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4=
1716+
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 h1:IUA9nvMmnKWcj5jl84xn+T5MnlZKThmUW1TdblaLVAc=
1717+
sigs.k8s.io/structured-merge-diff/v4 v4.6.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps=
17171718
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
17181719
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
17191720
software.sslmate.com/src/go-pkcs12 v0.5.0 h1:EC6R394xgENTpZ4RltKydeDUjtlM5drOYIG9c6TVj2M=

internal/resolver/resolver_test.go

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ import (
2020
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2121
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/client-go/rest"
23-
"k8s.io/utils/ptr"
2423
)
2524

2625
var (
27-
typeTxtRecord = ptr.To(dnsclient.RecordType("TXT"))
28-
emptyConfig = &apiextensionsv1.JSON{Raw: []byte("{}")}
26+
typeTxtRecord = toPTR(dnsclient.RecordType("TXT"))
2927
errK8Client = errors.New("k8 client error")
3028
)
3129

@@ -111,11 +109,11 @@ func (s *ResolverTestSuite) TestPresent() {
111109
name: "zone already exists",
112110
givenZones: []dnsclient.ZoneRead{
113111
{
114-
Id: ptr.To("test-zone-id"),
112+
Id: toPTR("test-zone-id"),
115113
Properties: &dnsclient.Zone{
116-
ZoneName: ptr.To("test.com"),
114+
ZoneName: toPTR("test.com"),
117115
},
118-
Type: ptr.To("NATIVE"),
116+
Type: toPTR("NATIVE"),
119117
},
120118
},
121119
givenRecords: []dnsclient.RecordRead{},
@@ -132,20 +130,20 @@ func (s *ResolverTestSuite) TestPresent() {
132130
name: "record with the same name and key already exists",
133131
givenZones: []dnsclient.ZoneRead{
134132
{
135-
Id: ptr.To("test-zone-id"),
133+
Id: toPTR("test-zone-id"),
136134
Properties: &dnsclient.Zone{
137-
ZoneName: ptr.To("test.com"),
135+
ZoneName: toPTR("test.com"),
138136
},
139-
Type: ptr.To("NATIVE"),
137+
Type: toPTR("NATIVE"),
140138
},
141139
},
142140
givenRecords: []dnsclient.RecordRead{
143141
{
144-
Id: ptr.To("test-record-id"),
142+
Id: toPTR("test-record-id"),
145143
Properties: &dnsclient.Record{
146-
Name: ptr.To("_acme-challenge"),
144+
Name: toPTR("_acme-challenge"),
147145
Type: typeTxtRecord,
148-
Content: ptr.To("test-key"),
146+
Content: toPTR("test-key"),
149147
},
150148
},
151149
},
@@ -162,20 +160,20 @@ func (s *ResolverTestSuite) TestPresent() {
162160
name: "record with the same name but different key already exists",
163161
givenZones: []dnsclient.ZoneRead{
164162
{
165-
Id: ptr.To("test-zone-id"),
163+
Id: toPTR("test-zone-id"),
166164
Properties: &dnsclient.Zone{
167-
ZoneName: ptr.To("test.com"),
165+
ZoneName: toPTR("test.com"),
168166
},
169-
Type: ptr.To("NATIVE"),
167+
Type: toPTR("NATIVE"),
170168
},
171169
},
172170
givenRecords: []dnsclient.RecordRead{
173171
{
174-
Id: ptr.To("test-record-id"),
172+
Id: toPTR("test-record-id"),
175173
Properties: &dnsclient.Record{
176-
Name: ptr.To("_acme-challenge"),
174+
Name: toPTR("_acme-challenge"),
177175
Type: typeTxtRecord,
178-
Content: ptr.To("different-key"),
176+
Content: toPTR("different-key"),
179177
},
180178
},
181179
},
@@ -205,11 +203,11 @@ func (s *ResolverTestSuite) TestPresent() {
205203
name: "error fetching records",
206204
givenZones: []dnsclient.ZoneRead{
207205
{
208-
Id: ptr.To("test-zone-id"),
206+
Id: toPTR("test-zone-id"),
209207
Properties: &dnsclient.Zone{
210-
ZoneName: ptr.To("test.com"),
208+
ZoneName: toPTR("test.com"),
211209
},
212-
Type: ptr.To("NATIVE"),
210+
Type: toPTR("NATIVE"),
213211
},
214212
},
215213
givenRecords: []dnsclient.RecordRead{},
@@ -227,11 +225,11 @@ func (s *ResolverTestSuite) TestPresent() {
227225
name: "error creating record",
228226
givenZones: []dnsclient.ZoneRead{
229227
{
230-
Id: ptr.To("test-zone-id"),
228+
Id: toPTR("test-zone-id"),
231229
Properties: &dnsclient.Zone{
232-
ZoneName: ptr.To("test.com"),
230+
ZoneName: toPTR("test.com"),
233231
},
234-
Type: ptr.To("NATIVE"),
232+
Type: toPTR("NATIVE"),
235233
},
236234
},
237235
givenRecords: []dnsclient.RecordRead{},
@@ -270,7 +268,7 @@ func (s *ResolverTestSuite) TestPresent() {
270268
if tc.thenRecordCreateKey != "" {
271269
s.dnsAPIMock.EXPECT().CreateTXTRecord("test-zone-id", "_acme-challenge", tc.thenRecordCreateKey).
272270
Return(dnsclient.RecordRead{
273-
Id: ptr.To("test-record-id"),
271+
Id: toPTR("test-record-id"),
274272
}, tc.whenRecordCreateError)
275273
}
276274
}
@@ -346,11 +344,11 @@ func (s *ResolverTestSuite) TestCleanUp() {
346344
name: "zone exists, but no record",
347345
givenZones: []dnsclient.ZoneRead{
348346
{
349-
Id: ptr.To("test-zone-id"),
347+
Id: toPTR("test-zone-id"),
350348
Properties: &dnsclient.Zone{
351-
ZoneName: ptr.To("test.com"),
349+
ZoneName: toPTR("test.com"),
352350
},
353-
Type: ptr.To("NATIVE"),
351+
Type: toPTR("NATIVE"),
354352
},
355353
},
356354
givenRecords: []dnsclient.RecordRead{},
@@ -368,20 +366,20 @@ func (s *ResolverTestSuite) TestCleanUp() {
368366
name: "zone and record with same name exists, but has a different key",
369367
givenZones: []dnsclient.ZoneRead{
370368
{
371-
Id: ptr.To("test-zone-id"),
369+
Id: toPTR("test-zone-id"),
372370
Properties: &dnsclient.Zone{
373-
ZoneName: ptr.To("test.com"),
371+
ZoneName: toPTR("test.com"),
374372
},
375-
Type: ptr.To("NATIVE"),
373+
Type: toPTR("NATIVE"),
376374
},
377375
},
378376
givenRecords: []dnsclient.RecordRead{
379377
{
380-
Id: ptr.To("test-record-id"),
378+
Id: toPTR("test-record-id"),
381379
Properties: &dnsclient.Record{
382-
Name: ptr.To("_acme-challenge"),
380+
Name: toPTR("_acme-challenge"),
383381
Type: typeTxtRecord,
384-
Content: ptr.To("different-key"),
382+
Content: toPTR("different-key"),
385383
},
386384
},
387385
},
@@ -412,11 +410,11 @@ func (s *ResolverTestSuite) TestCleanUp() {
412410
name: "record read error",
413411
givenZones: []dnsclient.ZoneRead{
414412
{
415-
Id: ptr.To("test-zone-id"),
413+
Id: toPTR("test-zone-id"),
416414
Properties: &dnsclient.Zone{
417-
ZoneName: ptr.To("test.com"),
415+
ZoneName: toPTR("test.com"),
418416
},
419-
Type: ptr.To("NATIVE"),
417+
Type: toPTR("NATIVE"),
420418
},
421419
},
422420
givenRecords: []dnsclient.RecordRead{},
@@ -434,20 +432,20 @@ func (s *ResolverTestSuite) TestCleanUp() {
434432
name: "record delete error",
435433
givenZones: []dnsclient.ZoneRead{
436434
{
437-
Id: ptr.To("test-zone-id"),
435+
Id: toPTR("test-zone-id"),
438436
Properties: &dnsclient.Zone{
439-
ZoneName: ptr.To("test.com"),
437+
ZoneName: toPTR("test.com"),
440438
},
441-
Type: ptr.To("NATIVE"),
439+
Type: toPTR("NATIVE"),
442440
},
443441
},
444442
givenRecords: []dnsclient.RecordRead{
445443
{
446-
Id: ptr.To("test-record-id"),
444+
Id: toPTR("test-record-id"),
447445
Properties: &dnsclient.Record{
448-
Name: ptr.To("_acme-challenge"),
446+
Name: toPTR("_acme-challenge"),
449447
Type: typeTxtRecord,
450-
Content: ptr.To("test-key"),
448+
Content: toPTR("test-key"),
451449
},
452450
},
453451
},
@@ -466,20 +464,20 @@ func (s *ResolverTestSuite) TestCleanUp() {
466464
name: "record with key exists",
467465
givenZones: []dnsclient.ZoneRead{
468466
{
469-
Id: ptr.To("test-zone-id"),
467+
Id: toPTR("test-zone-id"),
470468
Properties: &dnsclient.Zone{
471-
ZoneName: ptr.To("test.com"),
469+
ZoneName: toPTR("test.com"),
472470
},
473-
Type: ptr.To("NATIVE"),
471+
Type: toPTR("NATIVE"),
474472
},
475473
},
476474
givenRecords: []dnsclient.RecordRead{
477475
{
478-
Id: ptr.To("test-record-id"),
476+
Id: toPTR("test-record-id"),
479477
Properties: &dnsclient.Record{
480-
Name: ptr.To("_acme-challenge"),
478+
Name: toPTR("_acme-challenge"),
481479
Type: typeTxtRecord,
482-
Content: ptr.To("test-key"),
480+
Content: toPTR("test-key"),
483481
},
484482
},
485483
},
@@ -555,3 +553,7 @@ func setUpK8ClientExpectations(k8Client *mocks.K8Client, err error, t *testing.T
555553

556554
k8Client.EXPECT().CoreV1().Return(coreV1Interface)
557555
}
556+
557+
func toPTR[C any](c C) *C {
558+
return &c
559+
}

0 commit comments

Comments
 (0)