-
Notifications
You must be signed in to change notification settings - Fork 28
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
manager: new namespace manager based on etcd #13
Conversation
Signed-off-by: xhe <xw897002528@gmail.com>
A completely refactor, or rewritten of the old double buffer management of namespace. Also a preparetion for later proxy server refactor. 1. no need to prepare the namespace before commit. Now reloading namespaces be like: 1. use HTTP api modify persisted namespace configs on etcd. 2. commit will pull from etcd, and perform a swap of namespace state under the guard of mutex. Etcd serves as "dirty buffer" for the in-memory namespace manager. It is acceptable because client will connect etcd by local loopback network. 2. remove '/util/datastructure' 3. remove username to namespace mapping because username are removed in previous PR. Signed-off-by: xhe <xw897002528@gmail.com>
var minTLSVersion uint16 = tls.VersionTLS11 | ||
switch minTLSVer { | ||
case "TLSv1.0": | ||
minTLSVersion = tls.VersionTLS10 | ||
case "TLSv1.1": | ||
minTLSVersion = tls.VersionTLS11 | ||
case "TLSv1.2": | ||
minTLSVersion = tls.VersionTLS12 | ||
case "TLSv1.3": | ||
minTLSVersion = tls.VersionTLS13 | ||
case "": | ||
default: | ||
logutil.BgLogger().Warn( | ||
"Invalid TLS version, using default instead", | ||
zap.String("tls-version", minTLSVer), | ||
) | ||
} | ||
if minTLSVersion < tls.VersionTLS12 { | ||
logutil.BgLogger().Warn( | ||
"Minimum TLS version allows pre-TLSv1.2 protocols, this is not recommended", | ||
) | ||
} | ||
|
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.
Defaults to TLS12
@@ -90,28 +62,10 @@ func CreateServerTLSConfig(ca, key, cert, minTLSVer, path string, rsaKeySize int | |||
} | |||
} | |||
|
|||
// This excludes ciphers listed in tls.InsecureCipherSuites() and can be used to filter out more |
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.
Checked source code, it is useless. CipherSuites()
is secure and does not include suites from InsecureCipherSuites()
.
@@ -155,7 +155,7 @@ func NewServer(ctx context.Context, cfg *config.Config, logger *zap.Logger, name | |||
return | |||
} | |||
|
|||
err = srv.NamespaceManager.Init(nss, srv.ObserverClient) | |||
err = srv.NamespaceManager.Init(logger.Named("nsmgr"), nss, srv.ObserverClient) |
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.
Namespaced logger.
func (n *NamespaceWrapper) mustGetCurrentNamespace() Namespace { | ||
ns, ok := n.nsmgr.getCurrentNamespaces().Get(n.name) | ||
if !ok { | ||
panic(errors.New("namespace not found")) | ||
} | ||
return ns |
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 is removed. We don't need to get namespace under nsmgr mutex everytime for latest namespace config.
The old connection is hard to follow new config anyway. For connection states that possibly will be attached to namespace dynamically, we could execute in-place reload:
ns := NewNamespaceFromConfig()
oldNS.Reload(ns)
oldNS
could have an rwmutex, it will refresh config and take care of all old connection states. Thus reimplementing interface by a wrapper is not necessary.
security: | ||
cert: "./ttt" | ||
key: "./ttt" |
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.
What's its purpose? The cert to connect to the client?
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.
Yes, one for frontend, one for backend. And we can set the default cert or whatever in the global config.
Signed-off-by: xhe <xw897002528@gmail.com>
What problem does this PR solve?
Issue Number: ref #11
Problem Summary: A new, simplified namespace manager.
What is changed and how it works: Included in the commit message. Note that:
util/security/tls.go
.NewProxyConfig
=>NewConfig
manager/namespace/domain.go
. I don't think there is a need of abstraction, if interface will only be implemented by one struct.Check List
Tests
Notable changes
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.