@@ -16,7 +16,6 @@ import (
1616 "github.com/aws/aws-sdk-go/service/ecr"
1717 "github.com/aws/aws-sdk-go/service/ecr/ecriface"
1818 ctypes "github.com/containers/image/v5/types"
19- "github.com/dgraph-io/ristretto"
2019 "github.com/estahn/k8s-image-swapper/pkg/backend"
2120 "github.com/estahn/k8s-image-swapper/pkg/config"
2221 "github.com/go-co-op/gocron"
@@ -27,7 +26,6 @@ type ECRClient struct {
2726 client ecriface.ECRAPI
2827 ecrDomain string
2928 authToken []byte
30- cache * ristretto.Cache
3129 scheduler * gocron.Scheduler
3230 targetAccount string
3331 accessPolicy string
@@ -36,7 +34,7 @@ type ECRClient struct {
3634 backend backend.Backend
3735}
3836
39- func NewECRClient (clientConfig config.AWS , imageBackend backend.Backend , cache * ristretto. Cache ) (* ECRClient , error ) {
37+ func NewECRClient (clientConfig config.AWS , imageBackend backend.Backend ) (* ECRClient , error ) {
4038 ecrDomain := clientConfig .EcrDomain ()
4139
4240 var sess * session.Session
@@ -73,7 +71,6 @@ func NewECRClient(clientConfig config.AWS, imageBackend backend.Backend, cache *
7371 client := & ECRClient {
7472 client : ecrClient ,
7573 ecrDomain : ecrDomain ,
76- cache : cache ,
7774 scheduler : scheduler ,
7875 targetAccount : clientConfig .AccountID ,
7976 accessPolicy : clientConfig .ECROptions .AccessPolicy ,
@@ -94,10 +91,6 @@ func (e *ECRClient) Credentials() string {
9491}
9592
9693func (e * ECRClient ) CreateRepository (ctx context.Context , name string ) error {
97- if _ , found := e .cache .Get (name ); found {
98- return nil
99- }
100-
10194 log .Ctx (ctx ).Debug ().Str ("repository" , name ).Msg ("create repository" )
10295
10396 _ , err := e .client .CreateRepositoryWithContext (ctx , & ecr.CreateRepositoryInput {
@@ -153,8 +146,6 @@ func (e *ECRClient) CreateRepository(ctx context.Context, name string) error {
153146 }
154147 }
155148
156- e .cache .Set (name , "" , 1 )
157-
158149 return nil
159150}
160151
@@ -189,12 +180,6 @@ func (e *ECRClient) ImageExists(ctx context.Context, imageRef ctypes.ImageRefere
189180 Creds : e .Credentials (),
190181 }
191182
192- ref := imageRef .DockerReference ().String ()
193- if _ , found := e .cache .Get (ref ); found {
194- log .Ctx (ctx ).Trace ().Str ("ref" , ref ).Msg ("found in cache" )
195- return true
196- }
197-
198183 exists , err := e .backend .Exists (ctx , imageRef , creds )
199184 if err != nil {
200185 log .Error ().Err (err ).Msg ("unable to check existence of image" )
@@ -266,7 +251,6 @@ func NewMockECRClient(ecrClient ecriface.ECRAPI, region string, ecrDomain string
266251 client := & ECRClient {
267252 client : ecrClient ,
268253 ecrDomain : ecrDomain ,
269- cache : nil ,
270254 scheduler : nil ,
271255 targetAccount : targetAccount ,
272256 authToken : []byte ("mock-ecr-client-fake-auth-token" ),
0 commit comments