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

config: fix url config #43

Merged
merged 2 commits into from
Aug 18, 2022
Merged

config: fix url config #43

merged 2 commits into from
Aug 18, 2022

Conversation

xhebox
Copy link
Collaborator

@xhebox xhebox commented Aug 18, 2022

Signed-off-by: xhe xw897002528@gmail.com

What problem does this PR solve?

Issue Number: ref #23

Problem Summary: Fix logic of handling urls.

What is changed and how it works:

  1. Enhance test and fix config/weirproxy.yaml.
  2. Warning about low security of frontend/backend connections. No more failures now.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
./bin/weirproxy --conf ... --namespaces ./conf/namespaces
# in case of the first run, --namespaces is needed to bootstrap default namespaces. Otherwise, there is no namespace at all
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change (Don't forget to add the declarative for API)
  • Has weirctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@xhebox xhebox requested a review from djshow832 August 18, 2022 12:43
Signed-off-by: xhe <xw897002528@gmail.com>
Comment on lines +75 to +80
var wg waitgroup.WaitGroup
wg.Run(func() {
if err := srv.Run(cmd.Context()); err != nil {
logger.Error("shutdown with error", zap.Error(err))
}
})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since Run(the listener) is blocking, we must run it in a separate go routine.

- "0.0.0.0:2379"
- "http://0.0.0.0:3080"
advertise-urls:
- "http://127.0.0.1:3080"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why some of them are 0.0.0.0 while others 127.0.0.1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

advertise-xxx is used by etcd server to tell other etcd servers what address they should use to connect. 0.0.0.0 is correct for Listen() but wrong for Dial(). We could change both to 127.0.0.1.

listen/advertise-urls are used for etcd client. xxx-peer-urls are for inter-etcd-servers communication.

pkg/config/proxy.go Show resolved Hide resolved
Signed-off-by: xhe <xw897002528@gmail.com>
@djshow832 djshow832 merged commit d6a5878 into pingcap:main Aug 18, 2022
@xhebox xhebox deleted the config branch August 18, 2022 13:58
@xhebox xhebox mentioned this pull request Aug 31, 2022
14 tasks
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.

2 participants