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

feat: Provide scaler for Amazon managed service for Prometheus #5315

Closed
wants to merge 0 commits into from

Conversation

sguruvar
Copy link
Contributor

@sguruvar sguruvar commented Dec 24, 2023

Provide a description of what has been changed

Checklist

  • When introducing a new scaler, I agree with the scaling governance policy
  • [X ] I have verified that my change is according to the deprecations & breaking changes policy
  • [ X] Tests have been added
  • Changelog has been updated and is aligned with our changelog requirements
  • A PR is opened to update our Helm chart (repo) (if applicable, ie. when deployment manifests are modified)
  • A PR is opened to update the documentation on (repo) (if applicable)
  • Commits are signed with Developer Certificate of Origin (DCO - learn more)

Fixes #2214 (comment)

Relates to #

@sguruvar sguruvar requested a review from a team as a code owner December 24, 2023 04:55
Copy link

Thank you for your contribution! 🙏 We will review your PR as soon as possible.

While you are waiting, make sure to:

Learn more about:

@tomkerkhove tomkerkhove changed the title Fix for https://github.com/kedacore/keda/issues/2214 feat: Provide scaler for Amazon managed service for Prometheus Jan 2, 2024
Copy link
Member

@tomkerkhove tomkerkhove left a comment

Choose a reason for hiding this comment

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

Can you add some e2e tests please

@sguruvar
Copy link
Contributor Author

sguruvar commented Jan 2, 2024

Can you add some e2e tests please

hi @tomkerkhove : Added e2e tests here https://github.com/sguruvar/keda/blob/main/tests/scalers/aws/aws_managed_prometheus/aws_managed_prometheus_test.go.. I believe this is part of the PR. Please let me know for any changes/issues. Thanks

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

Nice improvement! some comments inline

pkg/scalers/aws_sigv4.go Outdated Show resolved Hide resolved
pkg/scalers/aws_sigv4.go Outdated Show resolved Hide resolved
@sguruvar
Copy link
Contributor Author

sguruvar commented Jan 3, 2024

Incorporated review comments.

Comment on lines 71 to 76
cs, err := awsCfg.Credentials.Retrieve(context.Background())
if err != nil {
return nil, err
}
creds := credentials.NewStaticCredentials(cs.AccessKeyID, cs.SecretAccessKey, "")
signer := v4.NewSigner(creds)
Copy link
Member

Choose a reason for hiding this comment

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

can't you just do something like:

Suggested change
cs, err := awsCfg.Credentials.Retrieve(context.Background())
if err != nil {
return nil, err
}
creds := credentials.NewStaticCredentials(cs.AccessKeyID, cs.SecretAccessKey, "")
signer := v4.NewSigner(creds)
signer := v4.NewSigner(awsCfg.Credentials)

I'm afraid in case of podIdentity what will happen with cs.AccessKeyID, cs.SecretAccessKey

Copy link
Contributor Author

@sguruvar sguruvar Jan 3, 2024

Choose a reason for hiding this comment

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

NewSigner doesnt take awsCfg.credentials.. this works with the pod identity e2e testing for aws_managed_prometheus

Copy link
Member

@JorTurFer JorTurFer Jan 9, 2024

Choose a reason for hiding this comment

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

@JorTurFer
Copy link
Member

JorTurFer commented Jan 3, 2024

/run-e2e aws_managed_prometheus
Update: You can check the progress here

@JorTurFer
Copy link
Member

please, execute also:

go mod tidy
go mod vendor

and push the changes too.
We use vendor folder, so you need to update the deps as they look inconsistent

@sguruvar
Copy link
Contributor Author

sguruvar commented Jan 3, 2024

please, execute also:

go mod tidy
go mod vendor

and push the changes too. We use vendor folder, so you need to update the deps as they look inconsistent

Pushed

@sguruvar
Copy link
Contributor Author

sguruvar commented Jan 3, 2024

please, execute also:

go mod tidy
go mod vendor

and push the changes too. We use vendor folder, so you need to update the deps as they look inconsistent

Pusehd

@sguruvar sguruvar closed this Jan 3, 2024
@sguruvar sguruvar reopened this Jan 3, 2024
@sguruvar
Copy link
Contributor Author

sguruvar commented Jan 5, 2024

Appreciate any updates on the merge.. thanks

@JorTurFer
Copy link
Member

Please rebase your PR. We've added a new authentication way. All the conflicts are related with deps (go.mod and go.sum + vendor).

There is also an small change to be done in the authentication part. We've updated this method that has to be used because it supports all the podIdentities out-of-the-box and also it manages credentials caching/sharing to reduce the amount of tokens for the same roleArn.

go.mod Outdated
@@ -24,9 +24,11 @@ require (
github.com/IBM/sarama v1.41.2
github.com/antonmedv/expr v1.15.3
github.com/arangodb/go-driver v1.6.0
github.com/aws/aws-sdk-go-v2 v1.21.0
github.com/aws/aws-sdk-go v1.49.10
Copy link
Member

Choose a reason for hiding this comment

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

We have migrated to github.com/aws/aws-sdk-go-v2, please don't use github.com/aws/aws-sdk-go

pkg/scalers/aws_sigv4.go Outdated Show resolved Hide resolved
Copy link

semgrep-app bot commented Jan 15, 2024

Semgrep found 1 hash-sum-without-write finding:

  • pkg/scalers/aws_sigv4.go: L46-47

odd hash.Sum call flow

Ignore this finding from hash-sum-without-write.

Copy link

semgrep-app bot commented Jan 16, 2024

Semgrep found 1 hash-sum-without-write finding:

  • pkg/scalers/aws_sigv4.go: L40-41

odd hash.Sum call flow

Ignore this finding from hash-sum-without-write.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scaler for Amazon managed service for Prometheus
3 participants