Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle STS Credentials region #8605

Merged
merged 43 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8a0961c
update API
ben-taussig-solo Aug 22, 2023
5d6e4d1
explicitly set region in serviceAccountCredentials
ben-taussig-solo Aug 22, 2023
621afc3
add changelog entry
ben-taussig-solo Aug 22, 2023
c32379a
relocate changelog entry to proper release
ben-taussig-solo Aug 22, 2023
8d632a5
update test fixture in helm tests
ben-taussig-solo Aug 22, 2023
cb65a43
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Aug 22, 2023
991d269
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Aug 23, 2023
89db236
Adding changelog file to new location
Aug 29, 2023
49b3f1b
Deleting changelog file from old location
Aug 29, 2023
e42752b
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Aug 29, 2023
96cc759
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Aug 29, 2023
1b685aa
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Aug 31, 2023
b66da6c
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Aug 31, 2023
de28913
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Aug 31, 2023
266ab65
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Aug 31, 2023
72248c4
Adding changelog file to new location
Sep 1, 2023
8e77463
Deleting changelog file from old location
Sep 1, 2023
856e951
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 1, 2023
e7d58ba
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 1, 2023
d82f5f8
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 5, 2023
646c7fc
add STS tests
ben-taussig-solo Sep 6, 2023
c3a746e
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 6, 2023
0c76c8f
Adding changelog file to new location
Sep 6, 2023
9ccd10d
Deleting changelog file from old location
Sep 6, 2023
6dca8c7
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 6, 2023
a0b8df8
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 6, 2023
f8bbc95
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 7, 2023
e8201e7
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 7, 2023
f94a42f
Adding changelog file to new location
Sep 7, 2023
4a238be
Deleting changelog file from old location
Sep 7, 2023
f525a15
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 7, 2023
1b08606
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 8, 2023
4d7d42c
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 8, 2023
8e7f1f2
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 8, 2023
7679dc7
Merge refs/heads/main into handle-sts-credentials-region
soloio-bulldozer[bot] Sep 9, 2023
5a54772
Adding changelog file to new location
Sep 11, 2023
ce9e7ce
Deleting changelog file from old location
Sep 11, 2023
f52cad4
make region not required
ben-taussig-solo Sep 12, 2023
b3ea57b
add e2e tests against default region
ben-taussig-solo Sep 12, 2023
7afd3bb
Merge branch 'handle-sts-credentials-region' of github.com:solo-io/gl…
ben-taussig-solo Sep 12, 2023
e853181
correct typo in aws e2e tests
ben-taussig-solo Sep 12, 2023
2544b70
bump envoy-gloo version
ben-taussig-solo Sep 13, 2023
776da72
remove unnecessary tests from AWS e2e test
ben-taussig-solo Sep 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ VERSION ?= 1.0.1-dev

SOURCES := $(shell find . -name "*.go" | grep -v test.go)

ENVOY_GLOO_IMAGE ?= quay.io/solo-io/envoy-gloo:1.26.4-patch1
ENVOY_GLOO_IMAGE ?= quay.io/solo-io/envoy-gloo:1.26.4-patch3
LDFLAGS := "-X github.com/solo-io/gloo/pkg/version.Version=$(VERSION)"
GCFLAGS := all="-N -l"

Expand Down Expand Up @@ -595,8 +595,7 @@ package-chart: generate-helm-files
# https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html#SEC59
git_tag = $(shell git describe --abbrev=0 --tags)
# Semantic versioning format https://semver.org/
# Regex copied from: https://github.com/solo-io/go-utils/blob/16d4d94e4e5f182ca8c10c5823df303087879dea/versionutils/version.go#L338
tag_regex := v[0-9]+[.][0-9]+[.][0-9]+(-[a-z]+)*(-[a-z]+[0-9]*)?$
tag_regex := ^v([0-9]{1,}\.){2}[0-9]{1,}$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you accidentally reverted this change from #8653


ifneq (,$(TEST_ASSET_ID))
PUBLISH_CONTEXT := PULL_REQUEST
Expand Down
10 changes: 10 additions & 0 deletions changelog/v1.16.0-beta10/handle-sts-credentials-region.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/gloo/issues/8578
resolvesIssue: false
description: >
Support role chaining using EKS ServiceAccounts outside of us-east-1
- type: DEPENDENCY_BUMP
dependencyOwner: solo-io
dependencyRepo: envoy-gloo
dependencyTag: v1.26.4-patch3

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ spec:
properties:
cluster:
type: string
region:
type: string
timeout:
type: string
uri:
Expand Down
2 changes: 2 additions & 0 deletions install/helm/gloo/templates/18-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ spec:
cluster: aws_sts_cluster
{{- if not .Values.settings.aws.stsCredentialsRegion }}
uri: sts.amazonaws.com
region: us-east-1
{{- else }}
uri: sts.{{ .Values.settings.aws.stsCredentialsRegion }}.amazonaws.com
region: {{ .Values.settings.aws.stsCredentialsRegion }}
{{- end }}
{{- else if .Values.settings.aws.enableCredentialsDiscovery }}
enableCredentialsDiscovey: true
Expand Down
1 change: 1 addition & 0 deletions install/test/fixtures/settings/sts_discovery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
serviceAccountCredentials:
cluster: aws_sts_cluster
uri: sts.us-east-2.amazonaws.com
region: us-east-2
propagateOriginalRouting: true
kubernetesArtifactSource: {}
kubernetesConfigSource: {}
Expand Down
2 changes: 2 additions & 0 deletions projects/gloo/api/external/envoy/extensions/aws/filter.proto
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ message AWSLambdaConfig {
string uri = 2 [ (validate.rules).string.min_bytes = 1 ];
// timeout for the request
google.protobuf.Duration timeout = 3;
// Region for the sts endpoint. Defaults to us-east-1
string region = 4;
}

// Send downstream path and method as `x-envoy-original-path` and
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 27 additions & 17 deletions projects/gloo/pkg/api/external/envoy/extensions/aws/filter.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 58 additions & 28 deletions test/e2e/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ import (

var _ = Describe("AWS Lambda", func() {
const (
region = "us-east-1"
defaultRegion = "us-east-1"
secondaryRegion = "us-east-2"
webIdentityTokenFile = "AWS_WEB_IDENTITY_TOKEN_FILE"
jwtPrivateKey = "JWT_PRIVATE_KEY"
awsRoleArn = "AWS_ROLE_ARN"
Expand Down Expand Up @@ -160,11 +161,11 @@ var _ = Describe("AWS Lambda", func() {
upstream = &gloov1.Upstream{
Metadata: &core.Metadata{
Namespace: "default",
Name: region,
Name: defaultRegion,
},
UpstreamType: &gloov1.Upstream_Aws{
Aws: &aws_plugin.UpstreamSpec{
Region: region,
Region: defaultRegion,
SecretRef: secret.Metadata.Ref(),
},
},
Expand Down Expand Up @@ -199,7 +200,7 @@ var _ = Describe("AWS Lambda", func() {
},
UpstreamType: &gloov1.Upstream_Aws{
Aws: &aws_plugin.UpstreamSpec{
Region: region,
Region: defaultRegion,
SecretRef: secret.Metadata.Ref(),
// this is a separate account ID from the one that all other lambda
// functions tested in this file are in
Expand Down Expand Up @@ -544,7 +545,7 @@ var _ = Describe("AWS Lambda", func() {
secret = &gloov1.Secret{
Metadata: &core.Metadata{
Namespace: "default",
Name: region,
Name: defaultRegion,
},
Kind: &gloov1.Secret_Aws{
Aws: &gloov1.AwsSecret{
Expand Down Expand Up @@ -599,7 +600,7 @@ var _ = Describe("AWS Lambda", func() {

addCredentials := func() {
localAwsCredentials := credentials.NewSharedCredentials("", "")
sess, err := session.NewSession(&aws.Config{Region: aws.String(region), Credentials: localAwsCredentials})
sess, err := session.NewSession(&aws.Config{Region: aws.String(defaultRegion), Credentials: localAwsCredentials})
if err != nil {
Fail("no AWS creds available")
}
Expand All @@ -611,7 +612,7 @@ var _ = Describe("AWS Lambda", func() {
secret = &gloov1.Secret{
Metadata: &core.Metadata{
Namespace: "default",
Name: region,
Name: defaultRegion,
},
Kind: &gloov1.Secret_Aws{
Aws: &gloov1.AwsSecret{
Expand Down Expand Up @@ -707,7 +708,7 @@ var _ = Describe("AWS Lambda", func() {
}
}

addUpstreamSts := func() {
addUpstreamSts := func(region string) {
upstream = &gloov1.Upstream{
Metadata: &core.Metadata{
Namespace: "default",
Expand Down Expand Up @@ -741,11 +742,19 @@ var _ = Describe("AWS Lambda", func() {
}))
}

setupEnvoySts := func(justGloo bool) {
setupEnvoySts := func(justGloo bool, region string) {
ctx, cancel = context.WithCancel(context.Background())

envoyInstance = envoyFactory.NewInstance()

var uri string
if region == "" {
region = defaultRegion
uri = "sts.amazonaws.com"
} else {
uri = fmt.Sprintf("sts.%s.amazonaws.com", region)
}

ns := defaults.GlooSystem
ro := &services.RunOptions{
NsToWrite: ns,
Expand All @@ -759,7 +768,8 @@ var _ = Describe("AWS Lambda", func() {
CredentialsFetcher: &gloov1.GlooOptions_AWSOptions_ServiceAccountCredentials{
ServiceAccountCredentials: &aws2.AWSLambdaConfig_ServiceAccountCredentials{
Cluster: "aws_sts_cluster",
Uri: "sts.amazonaws.com",
Uri: uri,
Region: region,
},
},
},
Expand All @@ -783,29 +793,49 @@ var _ = Describe("AWS Lambda", func() {
os.Unsetenv(webIdentityTokenFile)
})
Context("No gateway translation ", func() {
BeforeEach(func() {
setupEnvoySts(true)
addCredentialsSts()
addUpstreamSts()
Context("primary region", func() {
BeforeEach(func() {
setupEnvoySts(true, defaultRegion)
addCredentialsSts()
addUpstreamSts(defaultRegion)
})
/*
* these tests can start failing if certs get rotated underneath us.
* the fix is to update the rotated thumbprint on our fake AWS OIDC per
* https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc_verify-thumbprint.html
*/
It("should be able to call lambda", testProxy)

It("should be able to call lambda with response transform", testProxyWithResponseTransform)

It("should be able to call lambda with request transform", testProxyWithRequestTransform)

It("should be able to call lambda with request and response transforms", testProxyWithRequestAndResponseTransforms)
})
Context("secondary region", func() {
BeforeEach(func() {
setupEnvoySts(true, secondaryRegion)
addCredentialsSts()
addUpstreamSts(secondaryRegion)
})

It("should be able to call lambda", testProxy)
})
Context("default region", func() {
BeforeEach(func() {
setupEnvoySts(true, "")
addCredentialsSts()
addUpstreamSts(defaultRegion)
})

It("should be able to call lambda", testProxy)
})
/*
* these tests can start failing if certs get rotated underneath us.
* the fix is to update the rotated thumbprint on our fake AWS OIDC per
* https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc_verify-thumbprint.html
*/
It("should be able to call lambda", testProxy)

It("should be able to call lambda with response transform", testProxyWithResponseTransform)

It("should be able to call lambda with request transform", testProxyWithRequestTransform)

It("should be able to call lambda with request and response transforms", testProxyWithRequestAndResponseTransforms)
})
Context("With gateway translation", func() {
BeforeEach(func() {
setupEnvoySts(false)
setupEnvoySts(false, defaultRegion)
addCredentialsSts()
addUpstreamSts()
addUpstreamSts(defaultRegion)
})
It("should be able to call lambda via gateway", testLambdaWithVirtualService)

Expand Down