Skip to content

Commit cb5f15b

Browse files
authored
Merge pull request #393 from fluxcd/fix-conn-leak
Update source-controller to v0.25.7
2 parents adae8fb + ec89ad4 commit cb5f15b

File tree

7 files changed

+28
-17
lines changed

7 files changed

+28
-17
lines changed

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.17
44

55
require (
66
github.com/fluxcd/pkg/apis/meta v0.14.2
7-
github.com/fluxcd/source-controller/api v0.25.5
7+
github.com/fluxcd/source-controller/api v0.25.7
88
k8s.io/apimachinery v0.24.1
99
sigs.k8s.io/controller-runtime v0.11.2
1010
)

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ github.com/fluxcd/pkg/apis/acl v0.0.3 h1:Lw0ZHdpnO4G7Zy9KjrzwwBmDZQuy4qEjaU/RvA6
2121
github.com/fluxcd/pkg/apis/acl v0.0.3/go.mod h1:XPts6lRJ9C9fIF9xVWofmQwftvhY25n1ps7W9xw0XLU=
2222
github.com/fluxcd/pkg/apis/meta v0.14.2 h1:/Hf7I/Vz01vv3m7Qx7DtQvrzAL1oVt0MJcLb/I1Y1HE=
2323
github.com/fluxcd/pkg/apis/meta v0.14.2/go.mod h1:ijZ61VG/8T3U17gj0aFL3fdtZL+mulD6V8VrLLUCAgM=
24-
github.com/fluxcd/source-controller/api v0.25.5 h1:64rLb5cuHhZ3LcRIxkp+/oAVCyVtjOhQ9kbphdFfR/s=
25-
github.com/fluxcd/source-controller/api v0.25.5/go.mod h1:/e7YRDOqb8z8I3N8ifbDF1mknf8zFsoADtS/Q93iWPs=
24+
github.com/fluxcd/source-controller/api v0.25.7 h1:vXGKBTGT9bcx9sRI7MbmaebEeKoq17vQoPI8IOObpXk=
25+
github.com/fluxcd/source-controller/api v0.25.7/go.mod h1:/e7YRDOqb8z8I3N8ifbDF1mknf8zFsoADtS/Q93iWPs=
2626
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
2727
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
2828
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=

controllers/suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"testing"
2525
"time"
2626

27-
"github.com/go-logr/logr"
2827
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
2928
"k8s.io/client-go/kubernetes/scheme"
3029
ctrl "sigs.k8s.io/controller-runtime"
@@ -63,7 +62,7 @@ func TestMain(m *testing.M) {
6362
filepath.Join("testdata", "crds"),
6463
))
6564

66-
managed.InitManagedTransport(logr.Discard())
65+
managed.InitManagedTransport()
6766

6867
controllerName := "image-automation-controller"
6968
if err := (&ImageUpdateAutomationReconciler{

controllers/update_test.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,10 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
479479
// test cases and cleanup at the end.
480480

481481
t.Run("PushSpec", func(t *testing.T) {
482+
g := NewWithT(t)
483+
482484
// Clone the repo locally.
483-
cloneCtx, cancel := context.WithTimeout(ctx, time.Second*10)
485+
cloneCtx, cancel := context.WithTimeout(ctx, timeout)
484486
defer cancel()
485487
localRepo, err := clone(cloneCtx, cloneLocalRepoURL, branch)
486488
g.Expect(err).ToNot(HaveOccurred(), "failed to clone git repo")
@@ -499,6 +501,8 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
499501
pushBranch := "pr-" + randStringRunes(5)
500502

501503
t.Run("update with PushSpec", func(t *testing.T) {
504+
g := NewWithT(t)
505+
502506
preChangeCommitId := commitIdFromBranch(localRepo, branch)
503507
commitInRepo(g, cloneLocalRepoURL, branch, "Install setter marker", func(tmp string) {
504508
g.Expect(replaceMarker(tmp, policyKey)).To(Succeed())
@@ -536,6 +540,8 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
536540
})
537541

538542
t.Run("push branch gets updated", func(t *testing.T) {
543+
g := NewWithT(t)
544+
539545
initialHead, err := headFromBranch(localRepo, branch)
540546
g.Expect(err).ToNot(HaveOccurred())
541547
defer initialHead.Free()
@@ -566,6 +572,8 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
566572
})
567573

568574
t.Run("still pushes to the push branch after it's merged", func(t *testing.T) {
575+
g := NewWithT(t)
576+
569577
initialHead, err := headFromBranch(localRepo, branch)
570578
g.Expect(err).ToNot(HaveOccurred())
571579
defer initialHead.Free()
@@ -610,13 +618,15 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
610618
})
611619

612620
t.Run("with update strategy setters", func(t *testing.T) {
621+
g := NewWithT(t)
622+
613623
// Clone the repo locally.
614624
// NOTE: A new localRepo is created here instead of reusing the one
615625
// in the previous case due to a bug in some of the git operations
616626
// test helper. When switching branches, the localRepo seems to get
617627
// stuck in one particular branch. As a workaround, create a
618628
// separate localRepo.
619-
cloneCtx, cancel := context.WithTimeout(ctx, time.Second*10)
629+
cloneCtx, cancel := context.WithTimeout(ctx, timeout)
620630
defer cancel()
621631
localRepo, err := clone(cloneCtx, cloneLocalRepoURL, branch)
622632
g.Expect(err).ToNot(HaveOccurred(), "failed to clone git repo")
@@ -677,6 +687,8 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
677687
})
678688

679689
t.Run("no reconciliation when object is suspended", func(t *testing.T) {
690+
g := NewWithT(t)
691+
680692
err = createImagePolicyWithLatestImage(testEnv, imagePolicyName, namespace, "not-expected-to-exist", "1.x", latestImage)
681693
g.Expect(err).ToNot(HaveOccurred(), "failed to create ImagePolicy resource")
682694

@@ -863,7 +875,7 @@ func compareRepoWithExpected(g *WithT, repoURL, branch, fixture string, changeFi
863875

864876
copy.Copy(fixture, expected)
865877
changeFixture(expected)
866-
cloneCtx, cancel := context.WithTimeout(ctx, time.Second*10)
878+
cloneCtx, cancel := context.WithTimeout(ctx, timeout)
867879
defer cancel()
868880
repo, err := clone(cloneCtx, repoURL, branch)
869881
g.Expect(err).ToNot(HaveOccurred())
@@ -909,7 +921,7 @@ func configureTransportOptsForRepo(repo *libgit2.Repository) (func(), error) {
909921
}
910922

911923
func commitInRepo(g *WithT, repoURL, branch, msg string, changeFiles func(path string)) *libgit2.Oid {
912-
cloneCtx, cancel := context.WithTimeout(ctx, time.Second*10)
924+
cloneCtx, cancel := context.WithTimeout(ctx, timeout)
913925
defer cancel()
914926
repo, err := clone(cloneCtx, repoURL, branch)
915927
g.Expect(err).ToNot(HaveOccurred())
@@ -1443,7 +1455,7 @@ func testWithCustomRepoAndImagePolicy(
14431455

14441456
// Clone the repo.
14451457
repoURL := gitServer.HTTPAddressWithCredentials() + repositoryPath
1446-
cloneCtx, cancel := context.WithTimeout(ctx, time.Second*10)
1458+
cloneCtx, cancel := context.WithTimeout(ctx, timeout)
14471459
defer cancel()
14481460
localRepo, err := clone(cloneCtx, repoURL, args.branch)
14491461
g.Expect(err).ToNot(HaveOccurred(), "failed to clone git repo")

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ require (
1515
github.com/fluxcd/pkg/gittestserver v0.5.4
1616
github.com/fluxcd/pkg/runtime v0.16.2
1717
github.com/fluxcd/pkg/ssh v0.5.0
18-
github.com/fluxcd/source-controller v0.25.5
19-
github.com/fluxcd/source-controller/api v0.25.5
18+
github.com/fluxcd/source-controller v0.25.7
19+
github.com/fluxcd/source-controller/api v0.25.7
2020
github.com/go-logr/logr v1.2.3
2121
github.com/google/go-containerregistry v0.9.0
2222
github.com/libgit2/git2go/v33 v33.0.9

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ github.com/fluxcd/pkg/ssh v0.5.0 h1:jE9F2XvUXC2mgseeXMATvO014fLqdB30/VzlPLKsk20=
198198
github.com/fluxcd/pkg/ssh v0.5.0/go.mod h1:KGgOUOy1uI6RC6+qxIBLvP1AeOOs/nLB25Ca6TZMIXE=
199199
github.com/fluxcd/pkg/version v0.1.0 h1:v+SmCanmCB5Tj2Cx9TXlj+kNRfPGbAvirkeqsp7ZEAQ=
200200
github.com/fluxcd/pkg/version v0.1.0/go.mod h1:V7Z/w8dxLQzv0FHqa5ox5TeyOd2zOd49EeuWFgnwyj4=
201-
github.com/fluxcd/source-controller v0.25.5 h1:a96qa3/PQPXZ7OcfLTaDmMKee/Qhxr9G8C21+/MnqhM=
202-
github.com/fluxcd/source-controller v0.25.5/go.mod h1:401D+j+jFZcy9iuH7RrOMbkXJazsQK4Ce5q8pgKaXBI=
203-
github.com/fluxcd/source-controller/api v0.25.5 h1:64rLb5cuHhZ3LcRIxkp+/oAVCyVtjOhQ9kbphdFfR/s=
204-
github.com/fluxcd/source-controller/api v0.25.5/go.mod h1:/e7YRDOqb8z8I3N8ifbDF1mknf8zFsoADtS/Q93iWPs=
201+
github.com/fluxcd/source-controller v0.25.7 h1:gksopk/IVPnL+bkBRwpFnvQUr+72tJvxzJ+D+UZohD4=
202+
github.com/fluxcd/source-controller v0.25.7/go.mod h1:ZUZGoDPpDE8PDamRLbaXcjFfpVGhgu9bAx9sfohLs2k=
203+
github.com/fluxcd/source-controller/api v0.25.7 h1:vXGKBTGT9bcx9sRI7MbmaebEeKoq17vQoPI8IOObpXk=
204+
github.com/fluxcd/source-controller/api v0.25.7/go.mod h1:/e7YRDOqb8z8I3N8ifbDF1mknf8zFsoADtS/Q93iWPs=
205205
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
206206
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
207207
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func main() {
162162
// +kubebuilder:scaffold:builder
163163

164164
if enabled, _ := features.Enabled(features.GitManagedTransport); enabled {
165-
managed.InitManagedTransport(ctrl.Log.WithName("managed-transport"))
165+
managed.InitManagedTransport()
166166
}
167167

168168
setupLog.Info("starting manager")

0 commit comments

Comments
 (0)