Skip to content

Commit

Permalink
remove aws-sdk override, lattice service now available
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-aws committed Aug 10, 2023
1 parent 662a1fb commit ab36584
Show file tree
Hide file tree
Showing 15 changed files with 166 additions and 6,519 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Keep this until the APIs upstreamed
scripts/aws_sdk_model_override/aws-sdk-go
coverage.out
deploy.yaml

Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY scripts/aws_sdk_model_override/aws-sdk-go/go.mod scripts/aws_sdk_model_override/aws-sdk-go/go.mod
COPY scripts/aws_sdk_model_override/aws-sdk-go/go.sum scripts/aws_sdk_model_override/aws-sdk-go/go.sum


# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ test: ## Run tests.
.PHONY: toolchain
toolchain: ## Install developer toolchain
./hack/toolchain.sh
./setup.sh
./scripts/gen_mocks.sh

##@ Deployment
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/aws/aws-application-networking-k8s
go 1.20

require (
github.com/aws/aws-sdk-go v1.44.136
github.com/aws/aws-sdk-go v1.44.321
github.com/go-logr/logr v1.2.3
github.com/golang/glog v1.0.0
github.com/golang/mock v1.6.0
Expand Down Expand Up @@ -84,5 +84,3 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/aws/aws-sdk-go => ./scripts/aws_sdk_model_override/aws-sdk-go
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws/aws-sdk-go v1.44.321 h1:iXwFLxWjZPjYqjPq0EcCs46xX7oDLEELte1+BzgpKk8=
github.com/aws/aws-sdk-go v1.44.321/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down
2 changes: 2 additions & 0 deletions pkg/aws/services/eks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/aws/aws-sdk-go/service/eks/eksiface"
)

//go:generate mockgen -destination eks_mocks.go -package services github.com/aws/aws-application-networking-k8s/pkg/aws/services EKS

type EKS interface {
eksiface.EKSAPI
}
Expand Down
104 changes: 52 additions & 52 deletions pkg/aws/services/eks_mocks.go

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions pkg/aws/services/vpclattice.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ package services

import (
"context"
"os"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/vpclattice"
"github.com/aws/aws-sdk-go/service/vpclattice/vpclatticeiface"
"github.com/golang/glog"
"os"
)

//go:generate mockgen -destination vpclattice_mocks.go -package services github.com/aws/aws-application-networking-k8s/pkg/aws/services Lattice

type Lattice interface {
vpclatticeiface.VpcLatticeAPI
vpclatticeiface.VPCLatticeAPI
ListServiceNetworksAsList(ctx context.Context, input *vpclattice.ListServiceNetworksInput) ([]*vpclattice.ServiceNetworkSummary, error)
ListServicesAsList(ctx context.Context, input *vpclattice.ListServicesInput) ([]*vpclattice.ServiceSummary, error)
ListTargetGroupsAsList(ctx context.Context, input *vpclattice.ListTargetGroupsInput) ([]*vpclattice.TargetGroupSummary, error)
Expand All @@ -21,11 +24,11 @@ type Lattice interface {
}

type defaultLattice struct {
vpclatticeiface.VpcLatticeAPI
vpclatticeiface.VPCLatticeAPI
}

func NewDefaultLattice(sess *session.Session, region string) *defaultLattice {
var latticeSess vpclatticeiface.VpcLatticeAPI
var latticeSess vpclatticeiface.VPCLatticeAPI

latticeEndpoint := "https://vpc-lattice." + region + ".amazonaws.com"
endpoint := os.Getenv("LATTICE_ENDPOINT")
Expand All @@ -38,7 +41,7 @@ func NewDefaultLattice(sess *session.Session, region string) *defaultLattice {

glog.V(2).Infoln("Lattice Service EndPoint:", endpoint)

return &defaultLattice{VpcLatticeAPI: latticeSess}
return &defaultLattice{latticeSess}
}

func (d *defaultLattice) ListServiceNetworksAsList(ctx context.Context, input *vpclattice.ListServiceNetworksInput) ([]*vpclattice.ServiceNetworkSummary, error) {
Expand Down
173 changes: 86 additions & 87 deletions pkg/aws/services/vpclattice_mocks.go

Large diffs are not rendered by default.

Loading

0 comments on commit ab36584

Please sign in to comment.