Skip to content

Commit

Permalink
fix(k8s_util): proxy registry host/port information to dockerbuilder
Browse files Browse the repository at this point in the history
Dockerbuilder fails pushing images to the registry when --insecure-registry
is turned off because it is not using the registry proxy to push images.

DEIS_REGISTRY_PROXY_PORT was used in the original implementation, but is dead
code with this second iteration.
  • Loading branch information
Matthew Fisher committed Jul 29, 2016
1 parent 874c008 commit e0e5712
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/gitreceive/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ func build(
slugName,
conf.StorageType,
conf.DockerBuilderImage,
conf.RegistryHost,
conf.RegistryPort,
registryEnv,
dockerBuilderImagePullPolicy,
)
Expand Down
2 changes: 2 additions & 0 deletions pkg/gitreceive/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type Config struct {
// k8s service discovery env vars
ControllerHost string `envconfig:"DEIS_CONTROLLER_SERVICE_HOST" required:"true"`
ControllerPort string `envconfig:"DEIS_CONTROLLER_SERVICE_PORT" required:"true"`
RegistryHost string `envconfig:"DEIS_REGISTRY_SERVICE_HOST" required:"true"`
RegistryPort string `envconfig:"DEIS_REGISTRY_SERVICE_PORT" required:"true"`
RegistryProxyPort string `envconfig:"DEIS_REGISTRY_PROXY_PORT" default:"5555"`
RegistryLocation string `envconfig:"DEIS_REGISTRY_LOCATION" default:"on-cluster"`
RegistrySecretPrefix string `envconfig:"DEIS_REGISTRY_SECRET_PREFIX" default:"private-registry"`
Expand Down
8 changes: 7 additions & 1 deletion pkg/gitreceive/k8s_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func dockerBuilderPod(
tarKey,
imageName,
storageType,
image string,
image,
registryHost,
registryPort string,
registryEnv map[string]string,
pullPolicy api.PullPolicy,
) *api.Pod {
Expand All @@ -56,6 +58,10 @@ func dockerBuilderPod(
addEnvToPod(pod, tarPath, tarKey)
addEnvToPod(pod, "IMG_NAME", imageName)
addEnvToPod(pod, builderStorage, storageType)
// inject existing DEIS_REGISTRY_SERVICE_HOST and PORT info to dockerbuilder
// see https://github.com/deis/dockerbuilder/issues/83
addEnvToPod(pod, "DEIS_REGISTRY_SERVICE_HOST", registryHost)
addEnvToPod(pod, "DEIS_REGISTRY_SERVICE_PORT", registryPort)

for key, value := range registryEnv {
addEnvToPod(pod, key, value)
Expand Down
2 changes: 2 additions & 0 deletions pkg/gitreceive/k8s_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ func TestBuildPod(t *testing.T) {
build.imgName,
build.storageType,
build.dockerBuilderImage,
"localhost",
"5555",
regEnv,
build.dockerBuilderImagePullPolicy,
)
Expand Down

0 comments on commit e0e5712

Please sign in to comment.