Skip to content

Commit

Permalink
config: remove useless auth_through option
Browse files Browse the repository at this point in the history
We have removed the `auth_through` option in dragonflyoss/nydus#1375

Let's remove it in snapshotter, since its default value is
false, there is no compatibility impact.

Signed-off-by: Yan Song <[email protected]>
  • Loading branch information
imeoer authored and sctb512 committed Sep 11, 2023
1 parent 71d5c22 commit 284aedf
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 14 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,12 @@ Dragonfly supports both **mirror** mode and HTTP **proxy** mode to boost the con
"mirrors": [
{
"host": "http://127.0.0.1:65001",
"headers": "https://index.docker.io/v1/",
"auth_through": false
"headers": "https://index.docker.io/v1/"
}
]
}
```

`auth_through=false` means nydusd's authentication request will directly go to original registry rather than relayed by Dragonfly.

### Hot updating mirror configurations

In addition to setting the registry mirror in nydusd's json configuration file, `nydus-snapshotter` also supports hot updating mirror configurations. You can set the configuration directory in nudus-snapshotter's toml configuration file with `remote.mirrors_config.dir`. The empty `remote.mirrors_config.dir` means disabling it.
Expand All @@ -180,7 +177,6 @@ Configuration file is compatible with containerd's configuration file in toml fo
```toml
[host]
[host."http://127.0.0.1:65001"]
auth_through = false
[host."http://127.0.0.1:65001".header]
# NOTE: For Dragonfly, the HTTP scheme must be explicitly specified.
X-Dragonfly-Registry = ["https://p2p-nydus.com"]
Expand Down
1 change: 0 additions & 1 deletion config/daemonconfig/daemonconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func NewDaemonConfig(fsDriver, path string) (DaemonConfig, error) {
type MirrorConfig struct {
Host string `json:"host,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
AuthThrough bool `json:"auth_through,omitempty"`
HealthCheckInterval int `json:"health_check_interval,omitempty"`
FailureLimit uint8 `json:"failure_limit,omitempty"`
PingURL string `json:"ping_url,omitempty"`
Expand Down
4 changes: 0 additions & 4 deletions config/daemonconfig/mirrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type HostFileConfig struct {
OverridePath bool `toml:"override_path"`

// The following configuration items are specific to nydus.
AuthThrough bool `toml:"auth_through,omitempty"`
HealthCheckInterval int `toml:"health_check_interval,omitempty"`
FailureLimit uint8 `toml:"failure_limit,omitempty"`
PingURL string `toml:"ping_url,omitempty"`
Expand All @@ -41,7 +40,6 @@ type hostConfig struct {
Host string
Header http.Header

AuthThrough bool
HealthCheckInterval int
FailureLimit uint8
PingURL string
Expand Down Expand Up @@ -69,7 +67,6 @@ func parseMirrorsConfig(hosts []hostConfig) []MirrorConfig {

for i, host := range hosts {
parsedMirrors[i].Host = fmt.Sprintf("%s://%s", host.Scheme, host.Host)
parsedMirrors[i].AuthThrough = host.AuthThrough
parsedMirrors[i].HealthCheckInterval = host.HealthCheckInterval
parsedMirrors[i].FailureLimit = host.FailureLimit
parsedMirrors[i].PingURL = host.PingURL
Expand Down Expand Up @@ -176,7 +173,6 @@ func parseHostConfig(server string, config HostFileConfig) (hostConfig, error) {
result.Header = header
}

result.AuthThrough = config.AuthThrough
result.HealthCheckInterval = config.HealthCheckInterval
result.FailureLimit = config.FailureLimit
result.PingURL = config.PingURL
Expand Down
4 changes: 0 additions & 4 deletions config/daemonconfig/mirrors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func TestLoadMirrorConfig(t *testing.T) {
buf1 := []byte(`server = "https://default-docker.hub.com"
[host]
[host."http://default-p2p-mirror1:65001"]
auth_through = true
[host."http://default-p2p-mirror1:65001".header]
X-Dragonfly-Registry = ["https://default-docker.hub.com"]
`)
Expand All @@ -53,7 +52,6 @@ func TestLoadMirrorConfig(t *testing.T) {
require.NoError(t, err)
require.Equal(t, len(mirrors), 1)
require.Equal(t, mirrors[0].Host, "http://default-p2p-mirror1:65001")
require.Equal(t, mirrors[0].AuthThrough, true)
require.Equal(t, mirrors[0].Headers["X-Dragonfly-Registry"], "https://default-docker.hub.com")

err = os.MkdirAll(registryHostConfigDir, os.ModePerm)
Expand All @@ -71,7 +69,6 @@ func TestLoadMirrorConfig(t *testing.T) {
require.NoError(t, err)
require.Equal(t, len(mirrors), 1)
require.Equal(t, mirrors[0].Host, "http://p2p-mirror1:65001")
require.Equal(t, mirrors[0].AuthThrough, false)
require.Equal(t, mirrors[0].Headers["X-Dragonfly-Registry"], "https://docker.hub.com")

buf3 := []byte(`
Expand All @@ -85,6 +82,5 @@ func TestLoadMirrorConfig(t *testing.T) {
require.NoError(t, err)
require.Equal(t, len(mirrors), 1)
require.Equal(t, mirrors[0].Host, "http://p2p-mirror2:65001")
require.Equal(t, mirrors[0].AuthThrough, false)
require.Equal(t, mirrors[0].Headers["X-Dragonfly-Registry"], "https://docker.hub.com")
}

0 comments on commit 284aedf

Please sign in to comment.