|
|
|
@ -1192,6 +1192,16 @@ func Test_UnitGetHostConfigs(t *testing.T) {
|
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "wildcard mirror endpoint - no endpoints", |
|
|
|
|
args: args{ |
|
|
|
|
registryContent: ` |
|
|
|
|
mirrors: |
|
|
|
|
"*": |
|
|
|
|
`, |
|
|
|
|
}, |
|
|
|
|
want: HostConfigs{}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "wildcard mirror endpoint - full URL", |
|
|
|
|
args: args{ |
|
|
|
@ -1205,6 +1215,9 @@ func Test_UnitGetHostConfigs(t *testing.T) {
|
|
|
|
|
want: HostConfigs{ |
|
|
|
|
"_default": templates.HostConfig{ |
|
|
|
|
Program: "k3s", |
|
|
|
|
Default: &templates.RegistryEndpoint{ |
|
|
|
|
URL: u(""), |
|
|
|
|
}, |
|
|
|
|
Endpoints: []templates.RegistryEndpoint{ |
|
|
|
|
{ |
|
|
|
|
URL: u("https://registry.example.com/v2"), |
|
|
|
@ -1227,6 +1240,9 @@ func Test_UnitGetHostConfigs(t *testing.T) {
|
|
|
|
|
want: HostConfigs{ |
|
|
|
|
"_default": templates.HostConfig{ |
|
|
|
|
Program: "k3s", |
|
|
|
|
Default: &templates.RegistryEndpoint{ |
|
|
|
|
URL: u(""), |
|
|
|
|
}, |
|
|
|
|
Endpoints: []templates.RegistryEndpoint{ |
|
|
|
|
{ |
|
|
|
|
URL: u("https://127.0.0.1:6443/v2"), |
|
|
|
@ -1258,6 +1274,53 @@ func Test_UnitGetHostConfigs(t *testing.T) {
|
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "wildcard mirror endpoint - full URL, embedded registry, no default", |
|
|
|
|
args: args{ |
|
|
|
|
noDefaultEndpoint: true, |
|
|
|
|
mirrorAddr: "127.0.0.1:6443", |
|
|
|
|
registryContent: ` |
|
|
|
|
mirrors: |
|
|
|
|
"*": |
|
|
|
|
endpoint: |
|
|
|
|
- https://registry.example.com/v2
|
|
|
|
|
`, |
|
|
|
|
}, |
|
|
|
|
want: HostConfigs{ |
|
|
|
|
"_default": templates.HostConfig{ |
|
|
|
|
Program: "k3s", |
|
|
|
|
Endpoints: []templates.RegistryEndpoint{ |
|
|
|
|
{ |
|
|
|
|
URL: u("https://127.0.0.1:6443/v2"), |
|
|
|
|
Config: registries.RegistryConfig{ |
|
|
|
|
TLS: ®istries.TLSConfig{ |
|
|
|
|
CAFile: "server-ca", |
|
|
|
|
KeyFile: "client-key", |
|
|
|
|
CertFile: "client-cert", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
URL: u("https://registry.example.com/v2"), |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
"127.0.0.1:6443": templates.HostConfig{ |
|
|
|
|
Program: "k3s", |
|
|
|
|
Default: &templates.RegistryEndpoint{ |
|
|
|
|
URL: u("https://127.0.0.1:6443/v2"), |
|
|
|
|
Config: registries.RegistryConfig{ |
|
|
|
|
TLS: ®istries.TLSConfig{ |
|
|
|
|
CAFile: "server-ca", |
|
|
|
|
KeyFile: "client-key", |
|
|
|
|
CertFile: "client-cert", |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
name: "wildcard config", |
|
|
|
|
args: args{ |
|
|
|
|