-
Notifications
You must be signed in to change notification settings - Fork 867
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
Prometheus Analysis SigV4 Support #2458
Comments
Hi @zachaller We tried to leverage this feature using the
We use the following code in our AnalysisTemplate:
I'm not sure if should I create another issue since release 1.5 is not out yet... |
I think I see why this is happening. The RoundTripper should be initialized as a pointer and then passed as a reference.
should be:
Will submit a fix for this. |
@lewinkedrs would you be able to get a fix in soon, I was planning on cutting a a 1.5-rc here today or monday but will possibly hold for this even though it is a bug so could go in a patch release as well or 1.5 GA. |
submitted #2680 |
fixing nil pointer Signed-off-by: Kevin Lewin <[email protected]>
@zachaller @lewinkedrs Was it tested against the real AMP? I am trying to make it work but it still fails with the 403 error |
@danil-smirnov I was able to get this working with AMP. This is just using the go-sdk default provider chain. Do you have the proper environment variables/credential file set up to provide authorization to AMP? Does the error provide any additional details? |
@lewinkedrs I'm using AR Docker image with the Service Account attached. Not sure if this is enough to pass the credentials. I see only the following environment when describing the AR pod:
Also I can not exec into the pod to check the environment from inside since the image is distroless ( |
1234567890 looks like a placeholder value |
I've spoiled it intentionally. |
@lewinkedrs should this come with some documentation/read.me on how to use it? |
Are you using the same analysis template in your top level comment? The prometheus address needs to use the 'query' end point of amazon managed prometheus to accept the query. The address should look like this:
@jeromeinsf I will work on a write up for this. |
@lewinkedrs If I change that to |
@lewinkedrs Stil can't make this work. ( I'm getting 403 or 404 errors depending on the URL I use. Did you prepare any docs on how to use this feature already? |
@danil-smirnov I will work on writing this up now. But as long as the IRSA you are using has permissions to read and write from the AMP workspace you should have no problem. As a test, could you set up a regular prometheus server helm chart on your cluster using the same IRSA and see if you can remote-write to your AMP workspace? You can find instructions for that here. This PR just uses the same Sigv4 signing process that prometheus is using in their client so i'd like to see if you can reproduce your error there. If it works with prometheus but not argo, we may need to revisit this PR and figure out why the signing process is not working properly for you. |
Hi, I think there is an issue with IRSA in the current implementation. I'm trying to utilize AWS AMP in my AnalysisTemplates in EKS cluster. I configured Argo Rollouts controller pod to utilize IRSA and I'm still getting "403" when I try to run my analysis templates. To test my setup I just added a dummy Ubuntu pod configured with the same SA as that used for my AR controller pod. From within this dummy pod, I can list AMP workspaces using awscli and I used awscurl to successfully query the AMP workspace referred in my AnalysisTemplate. Then I copied partial go code from AR Prometheus metrics provider for testing purposes. Run it on my dummy test pod, and I got the same error "403" following my test code (this is my first time to write golang so pls mind any mistakes !!)
and my mod file is as following:
the output for my go run is:
|
@lewinkedrs In this comment you are insisting on |
The client api automatically appends the /api/v1/query suffix so that is not necessary. My apologies there. I am trying now to figure out why this worked when I built locally but not with IRSA.
On May 17, 2023, at 12:53, Danil Smirnov ***@***.***> wrote:
@lewinkedrs<https://github.com/lewinkedrs> In this comment<#2458 (comment)> you are insisting on /api/v1/query suffix for the query url.
But in this docs<#2777> you use it without the suffix in your example.
I'm now totally confused. Which URL should we use?
—
Reply to this email directly, view it on GitHub<#2458 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AXEM6FZZQBTD4MX4HZBXISDXGT673ANCNFSM6AAAAAASVR6C6U>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Ok I've partially figured out what is going on here. I was able to reproduce the error @danil-smirnov is seeing with a 403 when just trying to use the service account credentials. I believe it's because there is only a role provided but no region is provided. According to the docs it looks like a region is required to be passed in the signing key. I don't believe IRSA provides this and I did not catch this because I was testing in a local environment. Using the testing scenario above from @moharam-dev I am able to get the same 403 error when not providing a region.
But if I use the following code instead and explicitly provide a region to the sigv4 config. We have success:
This must be why other tools that provide sigV4 functionalities tend to just encourage a region be provided and not rely on one to be provided from the default provider chain. One example of this is the managed prometheus ingest documentation , which has the example written like this:
We probably need some way to just grab this from the yaml config and we can update the docs to inform others to include the region. |
Thank you for your research @lewinkedrs , is there any workaround for the time being? We are using the Argo Rollouts helm chart and we're already setting the region like this:
|
The best work around right now is probably to just a SigV4 proxy and then here it is as an admission controller If you prefer that method of deployment. I will work on putting together the fix to explicitly pass the region from yaml config, probably just in the analysis template we put it there. |
The sigv4 parameters need to be set in the yaml file which defines the analysistemplate. I think it should also be able to use the environment variables just like the Prometheus address field |
Summary
Prometheus analysis should support SigV4 when creating the prometheus client. This would allow it to query Amazon Managed Prometheus, which requires SigV4 authentication.
The prometheus client already supports a SigV4 RoundTripper. This can be used when constructing the client to allow a user to authenticate with Amazon Managed Prometheus using the default GO credential provider chain.
Use Cases
When performing prometheus analysis using Amazon Managed Prometheus as a metric data store.
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.
The text was updated successfully, but these errors were encountered: