Skip to content

Commit

Permalink
refactor: removing community galleries fake method for GET since this…
Browse files Browse the repository at this point in the history
… implementation doesn't use it
  • Loading branch information
Bryce-Soghigian committed Dec 9, 2024
1 parent c0add8d commit c5dfa26
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
13 changes: 0 additions & 13 deletions pkg/fake/communityimageversionsapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ package fake

import (
"context"
"fmt"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
"github.com/samber/lo"

"github.com/Azure/karpenter-provider-azure/pkg/providers/imagefamily"
)
Expand Down Expand Up @@ -53,17 +51,6 @@ func (c *CommunityGalleryImageVersionsAPI) NewListPager(_ string, _ string, _ st
return runtime.NewPager(pagingHandler)
}

func (c *CommunityGalleryImageVersionsAPI) Get(_ context.Context, location string, publicGalleryName string, galleryImageName string, galleryImageVersionName string, options *armcompute.CommunityGalleryImageVersionsClientGetOptions) (armcompute.CommunityGalleryImageVersionsClientGetResponse, error) {
// TODO: Add case where this get doesn't work or succeed
return armcompute.CommunityGalleryImageVersionsClientGetResponse{
CommunityGalleryImageVersion: armcompute.CommunityGalleryImageVersion{
Identifier: &armcompute.CommunityGalleryIdentifier{
UniqueID: lo.ToPtr(fmt.Sprintf("/CommunityGalleries/%s/images/%s/versions/%s", publicGalleryName, galleryImageName, galleryImageVersionName)),
},
},
}, nil
}

func (c *CommunityGalleryImageVersionsAPI) Reset() {
if c == nil {
return
Expand Down
1 change: 1 addition & 0 deletions pkg/providers/imagefamily/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (p *Provider) GetLatestImageID(ctx context.Context, defaultImage DefaultIma
return "", err
}
p.imageCache.Set(key, imageID, imageExpirationInterval)
logging.FromContext(ctx).With("image-id", imageID).Info("discovered new image id")
return imageID, nil
}

Expand Down
1 change: 0 additions & 1 deletion pkg/providers/imagefamily/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (d *DefaultImageOutput) PopulateImageTraitsFromID(imageID string) {
// CommunityGalleryImageVersionsAPI is used for listing community gallery image versions.
type CommunityGalleryImageVersionsAPI interface {
NewListPager(location string, publicGalleryName string, galleryImageName string, options *armcomputev5.CommunityGalleryImageVersionsClientListOptions) *runtime.Pager[armcomputev5.CommunityGalleryImageVersionsClientListResponse]
Get(ctx context.Context, location string, publicGalleryName string, galleryImageName string, galleryImageVersionName string, options *armcomputev5.CommunityGalleryImageVersionsClientGetOptions) (armcomputev5.CommunityGalleryImageVersionsClientGetResponse, error)
}

type NodeImageVersion struct {
Expand Down

0 comments on commit c5dfa26

Please sign in to comment.