Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pkg/build/controller/strategy/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

// CustomBuildStrategy creates a build using a custom builder image.
type CustomBuildStrategy struct {
UseLocalImages bool
// Codec is the codec to use for encoding the output pod.
// IMPORTANT: This may break backwards compatibility when
// it changes.
Expand Down Expand Up @@ -69,10 +68,7 @@ func (bs *CustomBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod,
return nil, err
}

if bs.UseLocalImages {
pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent
}

pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent
if strategy.ExposeDockerSocket {
setupDockerSocket(pod)
setupDockerConfig(pod)
Expand Down
3 changes: 1 addition & 2 deletions pkg/build/controller/strategy/custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (

func TestCustomCreateBuildPod(t *testing.T) {
strategy := CustomBuildStrategy{
UseLocalImages: true,
Codec: v1beta1.Codec,
Codec: v1beta1.Codec,
}

expectedBad := mockCustomBuild()
Expand Down
7 changes: 2 additions & 5 deletions pkg/build/controller/strategy/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (

// DockerBuildStrategy creates a Docker build using a Docker builder image.
type DockerBuildStrategy struct {
Image string
UseLocalImages bool
Image string
// Codec is the codec to use for encoding the output pod.
// IMPORTANT: This may break backwards compatibility when
// it changes.
Expand Down Expand Up @@ -47,9 +46,7 @@ func (bs *DockerBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod,
},
}

if bs.UseLocalImages {
pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent
}
pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent

setupDockerSocket(pod)
setupDockerConfig(pod)
Expand Down
5 changes: 2 additions & 3 deletions pkg/build/controller/strategy/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import (

func TestDockerCreateBuildPod(t *testing.T) {
strategy := DockerBuildStrategy{
Image: "docker-test-image",
UseLocalImages: true,
Codec: v1beta1.Codec,
Image: "docker-test-image",
Codec: v1beta1.Codec,
}

expected := mockDockerBuild()
Expand Down
5 changes: 1 addition & 4 deletions pkg/build/controller/strategy/sti.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
type STIBuildStrategy struct {
Image string
TempDirectoryCreator TempDirectoryCreator
UseLocalImages bool
// Codec is the codec to use for encoding the output pod.
// IMPORTANT: This may break backwards compatibility when
// it changes.
Expand Down Expand Up @@ -69,9 +68,7 @@ func (bs *STIBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod, er
},
}

if bs.UseLocalImages {
pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent
}
pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent

setupDockerSocket(pod)
setupDockerConfig(pod)
Expand Down
1 change: 0 additions & 1 deletion pkg/build/controller/strategy/sti_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func TestSTICreateBuildPod(t *testing.T) {
strategy := &STIBuildStrategy{
Image: "sti-test-image",
TempDirectoryCreator: &FakeTempDirCreator{},
UseLocalImages: true,
Codec: v1beta1.Codec,
}

Expand Down
10 changes: 1 addition & 9 deletions pkg/cmd/server/origin/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ type MasterConfig struct {

AdmissionControl admission.Interface

// true if the system should use pullIfNotPresent for images (which means updates will not be fetched aggressively)
UseLocalImages bool

// a function that returns the appropriate image to use for a named component
ImageFor func(component string) string

Expand Down Expand Up @@ -605,28 +602,24 @@ func (c *MasterConfig) RunBuildController() {
// initialize build controller
dockerImage := c.ImageFor("docker-builder")
stiImage := c.ImageFor("sti-builder")
useLocalImages := c.UseLocalImages

osclient, kclient := c.BuildControllerClients()
factory := buildcontrollerfactory.BuildControllerFactory{
OSClient: osclient,
KubeClient: kclient,
BuildUpdater: buildclient.NewOSClientBuildClient(osclient),
DockerBuildStrategy: &buildstrategy.DockerBuildStrategy{
Image: dockerImage,
UseLocalImages: useLocalImages,
Image: dockerImage,
// TODO: this will be set to --storage-version (the internal schema we use)
Codec: v1beta1.Codec,
},
STIBuildStrategy: &buildstrategy.STIBuildStrategy{
Image: stiImage,
TempDirectoryCreator: buildstrategy.STITempDirectoryCreator,
UseLocalImages: useLocalImages,
// TODO: this will be set to --storage-version (the internal schema we use)
Codec: v1beta1.Codec,
},
CustomBuildStrategy: &buildstrategy.CustomBuildStrategy{
UseLocalImages: useLocalImages,
// TODO: this will be set to --storage-version (the internal schema we use)
Codec: v1beta1.Codec,
},
Expand Down Expand Up @@ -656,7 +649,6 @@ func (c *MasterConfig) RunDeploymentController() {
{Name: "KUBERNETES_MASTER", Value: c.MasterAddr},
{Name: "OPENSHIFT_MASTER", Value: c.MasterAddr},
},
UseLocalImages: c.UseLocalImages,
RecreateStrategyImage: c.ImageFor("deployer"),
}

Expand Down
4 changes: 1 addition & 3 deletions pkg/cmd/server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ func start(cfg *config, args []string) error {

// define a function for resolving components to names
imageResolverFn := cfg.ImageTemplate.ExpandOrDie
useLocalImages := env("USE_LOCAL_IMAGES", "false") == "true"

// the node can reuse an existing client
var existingKubeClient *kclient.Client
Expand Down Expand Up @@ -372,8 +371,7 @@ func start(cfg *config, args []string) error {
MasterAuthorizationNamespace: masterAuthorizationNamespace,
RequestContextMapper: requestContextMapper,

UseLocalImages: useLocalImages,
ImageFor: imageResolverFn,
ImageFor: imageResolverFn,
}

if startKube {
Expand Down
6 changes: 1 addition & 5 deletions pkg/deploy/controller/deployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ type DeploymentController struct {
// Environment is a set of environment which should be injected into all deployment pod
// containers, in addition to whatever environment is specified by the ContainerCreator.
Environment []kapi.EnvVar
// UseLocalImages configures the ImagePullPolicy for containers in the deployment pod.
UseLocalImages bool
// Codec is used to decode DeploymentConfigs.
Codec runtime.Codec
// Stop is an optional channel that controls when the controller exits.
Expand Down Expand Up @@ -197,9 +195,7 @@ func (dc *DeploymentController) makeDeployerPod(deployment *kapi.ReplicationCont
},
}

if dc.UseLocalImages {
pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent
}
pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent

return pod, nil
}
Expand Down
7 changes: 2 additions & 5 deletions pkg/deploy/controller/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ type DeploymentControllerFactory struct {
KubeClient *kclient.Client
// Environment is a set of environment which should be injected into all deployment pod containers.
Environment []kapi.EnvVar
// UseLocalImages configures the ImagePullPolicy for containers deployment pods.
UseLocalImages bool
// RecreateStrategyImage specifies which Docker image which should implement the Recreate strategy.
RecreateStrategyImage string
// Codec is used to decode DeploymentConfigs.
Expand Down Expand Up @@ -152,9 +150,8 @@ func (factory *DeploymentControllerFactory) Create() *controller.DeploymentContr
panicIfStopped(factory.Stop, "deployment controller stopped")
return pod
},
UseLocalImages: factory.UseLocalImages,
Codec: factory.Codec,
Stop: factory.Stop,
Codec: factory.Codec,
Stop: factory.Stop,
}
}

Expand Down
6 changes: 2 additions & 4 deletions test/integration/buildclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,12 @@ func NewTestBuildOpenshift(t *testing.T) *testBuildOpenshift {
KubeClient: kubeClient,
BuildUpdater: buildclient.NewOSClientBuildClient(osClient),
DockerBuildStrategy: &buildstrategy.DockerBuildStrategy{
Image: "test-docker-builder",
UseLocalImages: false,
Codec: latest.Codec,
Image: "test-docker-builder",
Codec: latest.Codec,
},
STIBuildStrategy: &buildstrategy.STIBuildStrategy{
Image: "test-sti-builder",
TempDirectoryCreator: buildstrategy.STITempDirectoryCreator,
UseLocalImages: false,
Codec: latest.Codec,
},
Stop: openshift.stop,
Expand Down