-
Notifications
You must be signed in to change notification settings - Fork 93
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
daemonconfig: only load mirrorsConfig for target host #401
daemonconfig: only load mirrorsConfig for target host #401
Conversation
config/daemonconfig/mirrors.go
Outdated
|
||
func loadHostDir(hostsDir string) ([]hostConfig, error) { | ||
b, err := os.ReadFile(filepath.Join(hostsDir, "hosts.toml")) | ||
if err != nil && !os.IsNotExist(err) { |
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.
"hosts.toml" does not exit, should we skip parsing hosts config and don't update nydusd's mirrors config
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, we should avoid returning an error if the file does not exist. Fixed.
config/daemonconfig/mirrors.go
Outdated
return nil, err | ||
} | ||
|
||
parsedMirrors, err := parseMirrorsConfig(hostConfig) |
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.
Forget to handle err==nil && hostDir="" ?
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.
Please handle that host.toml or registry host namespace dir can't be found accross
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.
Forget to handle err==nil && hostDir="" ?
If err==nil && hostDir="", just return nil to skip loading the mirror configuration for this host.
hostDir, err := hostDirFromRoot(mirrorsConfigDir, registryHost)
if err != nil {
return nil, err
}
if hostDir == "" {
return mirrors, nil
}
Now, we load all the mirrorsConfig from directory. And the mirrorsConfig is available to all hosts. This is not compatible with containerd's mirror configuration. This PR tries to solve this issue. Signed-off-by: Bin Tang <tangbin.bin@bytedance.com>
a49bf01
to
4bf294d
Compare
Signed-off-by: Bin Tang <tangbin.bin@bytedance.com>
4bf294d
to
8994651
Compare
Now, we load all the mirrorsConfig from directory. And the mirrorsConfig is available to all hosts. This is not compatible with containerd's mirror configuration. This PR tries to solve this issue.