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

Adding multi environment support for APK #1770

Merged
merged 24 commits into from
Oct 23, 2023
Merged

Conversation

pubudu538
Copy link
Contributor

@pubudu538 pubudu538 commented Sep 26, 2023

Purpose

Adds the multi environment support for APK where single gateway can be shared among multiple environments. The following changes added.

  1. Configuration called Environment is added to identify the environment of the data plane. This is used for onprem APK. When sending the analytics events, this environment is used.
  2. Environment field is added to the API and TokenIssuer CRs.
  3. Used environment field instead of the vhost for rate limiting.
  4. Combination of Organization, Base Path and Environment is taken as the unique key for the API. Webhook validation is adjusted for this.
  5. Environment is taken as the environmentID for Choreo Analytics.
  6. Environment field is added to the APK-Conf.
  7. Added a common config called dp.environment for the helm chart.
  8. When the environment is given in the API CR, it is taken for the vhost that gets generated. For example, if the environment is dev, vhost will be orgid-dev.gw.wso2.com

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a8155ab) 26.00% compared to head (c3b9896) 25.66%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1770      +/-   ##
==========================================
- Coverage   26.00%   25.66%   -0.34%     
==========================================
  Files         250      130     -120     
  Lines       29536    14999   -14537     
  Branches     4894     2453    -2441     
==========================================
- Hits         7680     3850    -3830     
+ Misses      21594    11018   -10576     
+ Partials      262      131     -131     
Flag Coverage Δ
adapter 25.44% <ø> (-0.12%) ⬇️
common-controller 1.12% <ø> (+<0.01%) ⬆️
config-deployer-service 28.38% <ø> (+0.03%) ⬆️
idp-domain-service 80.18% <ø> (ø)
router ∅ <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 170 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pubudu538 pubudu538 force-pushed the apk-envs branch 2 times, most recently from 4c96d9b to decc78e Compare October 4, 2023 06:57
@pubudu538 pubudu538 marked this pull request as ready for review October 6, 2023 13:18

func getTokenIssuerEnvironments(environments []string) []string {

resolvedEnvirenvironments := []string{}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is fixed.

@@ -45,6 +45,8 @@ public class APIConstants {
public static final String AUTHORIZATION_BEARER = "Bearer ";
public static final String API_KEY_TYPE_PRODUCTION = "PRODUCTION";
public static final String API_KEY_TYPE_SANDBOX = "SANDBOX";
public static final String DEFAULT_ENVIRONMENT_NAME = "Default";
public static final String DEFAULT_ENVIRONMENT_ID = "Default-ID";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can remove this. Not used in the new design.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this.

@@ -40,4 +40,12 @@ public String getApiContext() {
public void setApiContext(String apiContext) {
this.apiContext = apiContext;
}

public String getEnvironment() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should change to EnvID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@Krishanx92 Krishanx92 merged commit 1c472b0 into wso2:main Oct 23, 2023
15 of 16 checks passed
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.

None yet

3 participants