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: add retry logic for rate limit for entitlement #874

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

lechnerc77
Copy link
Member

Purpose

Does this introduce a breaking change?

[ ] Yes
[X] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[X] Feature
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Test the code via automated test
go test ./...
  • Additional test steps
Execute assignment of entitlements in parallel to hit rate limit error

What to Check

Verify that the following are valid:

  • Automated tests are executed successfully
  • Verify that rate limit error is mitigated by retries

Other Information

  • Adding the retry context which anyway wraps the state change context is not necessary as we can add the logic to the existing waiting logic

Checklist for reviewer

The following organizational tasks must be completed before merging this PR:

  • The PR is assigned to the Terraform project and a status is set (typically "in review").
  • The PR has the matching labels assigned to it.
  • The PR has a milestone assigned to it.
  • If the PR closes an issue, the issue is referenced.
  • Possible follow-up items are created and linked.

@lechnerc77 lechnerc77 added this to the 1.6.0 milestone Jul 31, 2024
@lechnerc77 lechnerc77 added the enhancement New feature or request label Jul 31, 2024
@lechnerc77 lechnerc77 self-assigned this Jul 31, 2024
@lechnerc77 lechnerc77 marked this pull request as ready for review July 31, 2024 07:29
@lechnerc77
Copy link
Member Author

Sonar Cloud fails, which is acceptable, as we cannot test the rate limit error with our test fixture recordings

@sp1goyal
Copy link
Contributor

sp1goyal commented Aug 6, 2024

Hello Christian

We tried to reproduce the issue by adding 19 entitlements to 6 sub-accounts and then 12 sub-accounts, in both the cases the entitlements are being added and the rate limit issue couldn't be reproduced. Attaching the configuration for your reference.

variable "entitlements" {
  type        = map(list(string))
  description = "Map with all expected entitlements"
  default = {
    # Alert Notification Service
    "alert-notification" = ["standard", "lite", "free"]

    # Audit Log Viewer Service
    "auditlog-viewer" = ["free", "default"]

    # BTP LLM Proxy
    "azure-openai-service-demo" = ["default"]

    # Cloud Management Service
    "cis" = ["local", "cloud-automation", "central-viewer", "local-viewer"]

    # Cloud Portal Service
    "PortalApplication" = ["standard"]

    # Event Mesh
    "enterprise-messaging" = ["default"]

    # Forms Service by Adobe
    "ads" = ["free", "standard"]

    # SAP AI Core
    "aicore" = ["standard"]

    # SAP HANA Schemas & HDI Containers
    "hana" = ["hdi-shared"]

    #SAPLaunchpad
    "SAPLaunchpad" = ["foundation","standard"]
  }
}

Attaching the terraform script as well to run this configuration via the module mentioned in the link.

resource "btp_subaccount" "my_project" {
  count = 12
  name      = "sarthak_test${count.index+1}"
  subdomain = "sgoyal-${count.index+1}"
  region    = "eu12"
}

module "sap-btp-entitlements" {
  count = 12
  source  = "aydin-ozcan/sap-btp-entitlements/btp"
  version = "1.0.1"
  subaccount = btp_subaccount.my_project[count.index].id
  entitlements = var.entitlements
}

Please let us know if anything needs to be updated so as to reproduce the issue.
Thanks & Regards
Sarthak Goyal

Copy link
Contributor

@sp1goyal sp1goyal left a comment

Choose a reason for hiding this comment

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

Tested. Working fine.

Copy link
Member

@vipinvkmenon vipinvkmenon left a comment

Choose a reason for hiding this comment

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

LGTM

@vipinvkmenon vipinvkmenon merged commit 37423b7 into main Aug 12, 2024
21 of 22 checks passed
@vipinvkmenon vipinvkmenon deleted the feat/issue-872 branch August 12, 2024 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Retry Logic to resources to avoid rate limiting issues
3 participants