Skip to content

Commit

Permalink
fixed handling of empty registry
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Minář <[email protected]>
  • Loading branch information
Michal Minář committed Dec 15, 2017
1 parent e8a26ae commit e00604b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/image/admission/registry_whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ func (rw *registryWhitelister) AdmitDockerImageReference(ref *imageapi.DockerIma
host = ref.Registry
port = ""
}
if len(host) == 0 {
host, _ = ref.RegistryHostPort(false)
}
case WhitelistTransportInsecure:
host, port = ref.RegistryHostPort(true)
default:
Expand Down
2 changes: 2 additions & 0 deletions pkg/image/admission/registry_whitelist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ func TestRegistryWhitelister(t *testing.T) {
"registry.com:443/ab:tag": fmt.Errorf(`registry "registry.com:443" not allowed by whitelist { "localhost:5000", "docker.io:80", "example.com:*", "registry.com:80", and 2 more ... }`),
"registry.com/repo": nil,
"registry.foo.com/123": nil,
"repository:latest": nil,
"nm/repo:latest": nil,
},
},
} {
Expand Down

0 comments on commit e00604b

Please sign in to comment.