-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implement entitlement verification and AWS metering #42
Conversation
234b6f7
to
709ef60
Compare
|
||
// NewAmazonClient creates a new AmazonClient using the default | ||
// AWS configuration and the current region. | ||
func NewAmazonClient(vendor string) (*AmazonClient, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have a test for this. I believe we can use WithEndpointResolverV2()
for that purpose.
type endpointResolverV2 struct {
URL url.URL
}
func (e *endpointResolverV2) ResolveEndpoint(ctx context.Context, params marketplacemetering.EndpointParameters) (smithyendpoints.Endpoint, error) {
return smithyendpoints.Endpoint{
URI: e.URL,
}, nil
}
func TestMarketplaceClient() {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
...
}))
defer srv.Close()
opt := marketplacemetering.WithEndpointResolverV2(&endpointResolverV2{URL: url.URL{Scheme: "http", Host: srv.URL}})
mc := marketplacemetering.NewFromConfig(cfg, opt)
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mocking the AWS APIs could come later after we release a version with metering and we tests it on EKS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this PR on EKS with an IRSA for AWSMarketplaceMeteringRegisterUsage
and all works, the usage is registered and the resulting token is valid 🎉
709ef60
to
8208796
Compare
Signed-off-by: Stefan Prodan <[email protected]>
8208796
to
a7d71e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Signed-off-by: Stefan Prodan <[email protected]>
31e3ac3
to
246e88c
Compare
This PR adds entitlement verification and metering for AWS Marketplace service.
Ref: controlplaneio-fluxcd/distribution#88
PS. When the operator is not installed from the AWS Marketplace, an offline entitlement client is employed that generates
a perpetual license token.