Skip to content

feat: Support APISIX_PROFILE for env-specific configuration #2238

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

Closed
wants to merge 2 commits into from

Conversation

kevinw66
Copy link
Contributor

@kevinw66 kevinw66 commented Dec 9, 2021

Why submit this pull request?

  • [*] New feature provided

What changes will this PR take into?

Support env config just like apisix
https://apisix.apache.org/zh/docs/apisix/profile/

Related issues

fix/resolve #2194

@kevinw66 kevinw66 changed the title Support APISIX_PROFILE for env-specific configuration feat: Support APISIX_PROFILE for env-specific configuration Dec 9, 2021
@zaunist
Copy link
Contributor

zaunist commented Dec 10, 2021

Hi @kevinw66 ,it looks great.
cc @juzhiyuan, please unlock the CI to test this PR.

@juzhiyuan juzhiyuan requested review from bzp2010 and LiteSun and removed request for bzp2010 December 10, 2021 02:08
@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2021

Codecov Report

Merging #2238 (289d184) into master (ae1001d) will increase coverage by 4.76%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2238      +/-   ##
==========================================
+ Coverage   65.08%   69.85%   +4.76%     
==========================================
  Files         184      184              
  Lines        7274     7277       +3     
  Branches      829      829              
==========================================
+ Hits         4734     5083     +349     
+ Misses       2256     1899     -357     
- Partials      284      295      +11     
Flag Coverage Δ
backend-e2e-test 41.06% <50.00%> (+0.17%) ⬆️
backend-e2e-test-ginkgo 56.65% <50.00%> (?)
backend-unit-test 49.16% <ø> (ø)
frontend-e2e-test 68.06% <ø> (ø)

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

Impacted Files Coverage Δ
api/internal/conf/conf.go 57.54% <50.00%> (-0.71%) ⬇️
api/internal/core/storage/etcd.go 51.18% <0.00%> (+3.93%) ⬆️
api/internal/core/store/validate.go 70.70% <0.00%> (+4.04%) ⬆️
api/internal/handler/upstream/upstream.go 86.58% <0.00%> (+4.87%) ⬆️
api/internal/core/store/store.go 90.62% <0.00%> (+5.20%) ⬆️
api/internal/filter/authentication.go 78.94% <0.00%> (+5.26%) ⬆️
api/internal/handler/service/service.go 93.54% <0.00%> (+5.64%) ⬆️
api/internal/handler/ssl/ssl.go 74.40% <0.00%> (+5.68%) ⬆️
api/internal/route.go 87.50% <0.00%> (+7.50%) ⬆️
api/internal/handler/route/route.go 80.23% <0.00%> (+7.75%) ⬆️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae1001d...289d184. Read the comment docs.

@juzhiyuan
Copy link
Member

Hi @kevinw66, please take a look at the CI 😄

@zaunist
Copy link
Contributor

zaunist commented Dec 10, 2021

@juzhiyuan It looks like the CI failed due to unstable CI, I found stream route test untill very unstable, the part of the test is easy to fail.
@bzp2010 Can you take some time to look the stream route test ?

@juzhiyuan
Copy link
Member

I just rerun the CI, wait for a moment.

@kevinw66
Copy link
Contributor Author

I merged new commits from master.
BTW, the ut is hard to run in local machine because of too many dependencies server, is there any plan to solve this? like mock server or embbed server.

@zaunist
Copy link
Contributor

zaunist commented Dec 10, 2021

I merged new commits from master. BTW, the ut is hard to run in local machine because of too many dependencies server, is there any plan to solve this? like mock server or embbed server.

We can use make api-test to run unit test, I think you might be talking about integration testing?

@kevinw66
Copy link
Contributor Author

I merged new commits from master. BTW, the ut is hard to run in local machine because of too many dependencies server, is there any plan to solve this? like mock server or embbed server.

We can use make api-test to run unit test, I think you might be talking about integration testing?

I tried to run failed test stream_route_test in my local machine, but I found I have to start dashboard in local, and then run an upstream, or else it will failed in connection refused.

@juzhiyuan
Copy link
Member

image

Hi @zaunist, could you please give some hints on executing tests locally?

@zaunist
Copy link
Contributor

zaunist commented Dec 11, 2021

I also have this problem in my PR submission. @bzp2010 more familiar with this, any solutions?

@bzp2010
Copy link
Contributor

bzp2010 commented Dec 11, 2021

Hi, @zaunist.
Recently we have not modified the E2E test implemented using the old way, and its instability is perhaps caused by the test environment.
And in the new CI using ginkgo, I have solved one instability issue related to migrate, but it still may fail due to temporary environment exceptions. Also, the UDP case in the Stream Route test does still have some failure issues, which in general are not very common.

@bzp2010
Copy link
Contributor

bzp2010 commented Dec 11, 2021

Hi, @kevinw66. It's great to see you contributing to the project.

But do we really need this feature? As far as I know, we can now rewrite the config file path using the -c flag. Can you describe some of the differences between the current PR and -c flag scenarios?

Thanks.

@kevinw66
Copy link
Contributor Author

Hi, @kevinw66. It's great to see you contributing to the project.

But do we really need this feature? As far as I know, we can now rewrite the config file path using the -c flag. Can you describe some of the differences between the current PR and -c flag scenarios?

Thanks.

When we download bin file and use it directly, -c is enough. But if we have to redevelop from source code, mostly we will create env-specific config, and the -c may not so quite useful.
On the other hand, I think it's better to keep dashboard project and main project have same behavior, like config-default 、environment variable like etcd.host: ${{ETCD_HOST}} and so on.

@bzp2010
Copy link
Contributor

bzp2010 commented Dec 17, 2021

Hi, @kevinw66.

Sorry to reply to your delay, I miss it when dealing with PR, I have learned the purpose of this function, this feature is also used in Apache APISIX, I think it is no problem, but can you add some tests to it?

Copy link
Contributor

@bzp2010 bzp2010 left a comment

Choose a reason for hiding this comment

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

Still need some testing to ensure it works fine. 🤔

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.

Should apisix support environment config or profile config?
5 participants