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
14 changes: 8 additions & 6 deletions pkg/build/controller/build/build_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1878,26 +1878,28 @@ func (bc *BuildController) createBuildGlobalCAConfigMapSpec(build *buildv1.Build
makeBuildPodOwnerRef(buildPod),
},
},
Data: map[string]string{},
Data: map[string]string{
buildutil.GlobalCAConfigMapKey: "",
},
}

globalCAMap, err := bc.controllerManagerConfigMapStore.ConfigMaps("openshift-controller-manager").Get("openshift-global-ca")
globalCAMap, err := bc.controllerManagerConfigMapStore.ConfigMaps("openshift-controller-manager").Get("openshift-user-ca")
// If a trusted CA is not configured on the cluster proxy config, this ConfigMap will not be present.
if errors.IsNotFound(err) {
klog.V(2).Infof("WARNING - global certificate authority could not be found. If a proxy with a custom CA is being employed, build %s/%s will fail.", build.Namespace, build.Name)
return cm
}
if err != nil {
klog.V(1).Infof("ERROR - failed to read global certificate authority. If a proxy with a custom CA is being employed, build %s/%s will fail. Error: %v", build.Namespace, build.Name, err)
klog.V(1).Infof("ERROR - failed to read proxy certificate authority. If a proxy with a custom CA is being employed, build %s/%s will fail. Error: %v", build.Namespace, build.Name, err)
return cm
}
if globalCAMap == nil || len(globalCAMap.Data) == 0 {
klog.V(2).Infof("WARNING - global certificate authority data is not available. If a proxy with a custom CA is being employed, build %s/%s will fail.", build.Namespace, build.Name)
klog.V(2).Infof("WARNING - proxy certificate authority data is not available. If a proxy with a custom CA is being employed, build %s/%s will fail.", build.Namespace, build.Name)
return cm

}
globalCAData, exists := globalCAMap.Data[buildutil.GlobalCAConfigMapKey]
if !exists {
klog.V(2).Infof("WARNING - global certificate authority data is missing. If a proxy with a custom CA is being employed, build %s/%s will fail.", build.Namespace, build.Name)
klog.V(2).Infof("WARNING - proxy certificate authority data is missing. If a proxy with a custom CA is being employed, build %s/%s will fail.", build.Namespace, build.Name)
return cm
}
cm.Data[buildutil.GlobalCAConfigMapKey] = globalCAData
Expand Down
20 changes: 10 additions & 10 deletions pkg/build/controller/strategy/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ func (bs *DockerBuildStrategy) CreateBuildPod(build *buildv1.Build, additionalCA
ServiceAccountName: serviceAccount,
Containers: []v1.Container{
{
Name: DockerBuild,
Image: bs.Image,
Command: []string{"openshift-docker-build"},
Env: copyEnvVarSlice(containerEnv),
Name: DockerBuild,
Image: bs.Image,
Args: []string{"openshift-docker-build"},
Env: copyEnvVarSlice(containerEnv),
// TODO: run unprivileged https://github.com/openshift/origin/issues/662
SecurityContext: &v1.SecurityContext{
Privileged: &privileged,
Expand Down Expand Up @@ -129,7 +129,7 @@ func (bs *DockerBuildStrategy) CreateBuildPod(build *buildv1.Build, additionalCA
gitCloneContainer := v1.Container{
Name: GitCloneContainer,
Image: bs.Image,
Command: []string{"openshift-git-clone"},
Args: []string{"openshift-git-clone"},
Env: copyEnvVarSlice(containerEnv),
TerminationMessagePolicy: v1.TerminationMessageFallbackToLogsOnError,
VolumeMounts: []v1.VolumeMount{
Expand All @@ -150,10 +150,10 @@ func (bs *DockerBuildStrategy) CreateBuildPod(build *buildv1.Build, additionalCA
}
if len(build.Spec.Source.Images) > 0 {
extractImageContentContainer := v1.Container{
Name: ExtractImageContentContainer,
Image: bs.Image,
Command: []string{"openshift-extract-image-content"},
Env: copyEnvVarSlice(containerEnv),
Name: ExtractImageContentContainer,
Image: bs.Image,
Args: []string{"openshift-extract-image-content"},
Env: copyEnvVarSlice(containerEnv),
// TODO: run unprivileged https://github.com/openshift/origin/issues/662
SecurityContext: &v1.SecurityContext{
Privileged: &privileged,
Expand Down Expand Up @@ -184,7 +184,7 @@ func (bs *DockerBuildStrategy) CreateBuildPod(build *buildv1.Build, additionalCA
v1.Container{
Name: "manage-dockerfile",
Image: bs.Image,
Command: []string{"openshift-manage-dockerfile"},
Args: []string{"openshift-manage-dockerfile"},
Env: copyEnvVarSlice(containerEnv),
TerminationMessagePolicy: v1.TerminationMessageFallbackToLogsOnError,
VolumeMounts: []v1.VolumeMount{
Expand Down
20 changes: 10 additions & 10 deletions pkg/build/controller/strategy/sti.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ func (bs *SourceBuildStrategy) CreateBuildPod(build *buildv1.Build, additionalCA
ServiceAccountName: serviceAccount,
Containers: []corev1.Container{
{
Name: StiBuild,
Image: bs.Image,
Command: []string{"openshift-sti-build"},
Env: copyEnvVarSlice(containerEnv),
Name: StiBuild,
Image: bs.Image,
Args: []string{"openshift-sti-build"},
Env: copyEnvVarSlice(containerEnv),
// TODO: run unprivileged https://github.com/openshift/origin/issues/662
SecurityContext: &corev1.SecurityContext{
Privileged: &privileged,
Expand Down Expand Up @@ -136,7 +136,7 @@ func (bs *SourceBuildStrategy) CreateBuildPod(build *buildv1.Build, additionalCA
gitCloneContainer := corev1.Container{
Name: GitCloneContainer,
Image: bs.Image,
Command: []string{"openshift-git-clone"},
Args: []string{"openshift-git-clone"},
Env: copyEnvVarSlice(containerEnv),
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
VolumeMounts: []corev1.VolumeMount{
Expand All @@ -157,10 +157,10 @@ func (bs *SourceBuildStrategy) CreateBuildPod(build *buildv1.Build, additionalCA
}
if len(build.Spec.Source.Images) > 0 {
extractImageContentContainer := corev1.Container{
Name: ExtractImageContentContainer,
Image: bs.Image,
Command: []string{"openshift-extract-image-content"},
Env: copyEnvVarSlice(containerEnv),
Name: ExtractImageContentContainer,
Image: bs.Image,
Args: []string{"openshift-extract-image-content"},
Env: copyEnvVarSlice(containerEnv),
// TODO: run unprivileged https://github.com/openshift/origin/issues/662
SecurityContext: &corev1.SecurityContext{
Privileged: &privileged,
Expand Down Expand Up @@ -191,7 +191,7 @@ func (bs *SourceBuildStrategy) CreateBuildPod(build *buildv1.Build, additionalCA
corev1.Container{
Name: "manage-dockerfile",
Image: bs.Image,
Command: []string{"openshift-manage-dockerfile"},
Args: []string{"openshift-manage-dockerfile"},
Env: copyEnvVarSlice(containerEnv),
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
VolumeMounts: []corev1.VolumeMount{
Expand Down
6 changes: 3 additions & 3 deletions pkg/build/controller/strategy/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const (
ConfigMapCertsMountPath = "/var/run/configs/openshift.io/certs"
SecretBuildSourceBaseMountPath = "/var/run/secrets/openshift.io/build"
SourceImagePullSecretMountPath = "/var/run/secrets/openshift.io/source-image"
// ConfigMapBuildGlobalCAMountPath is the directory where the tls-ca-bundle.pem file will be mounted
// by the cluster CA operator
ConfigMapBuildGlobalCAMountPath = "/etc/pki/ca-trust/extracted/pem"
// ConfigMapBuildGlobalCAMountPath is the directory where cluster-wide trust bundle will be
// mounted in the build pod
ConfigMapBuildGlobalCAMountPath = "/var/run/configs/openshift.io/pki"

// ExtractImageContentContainer is the name of the container that will
// pull down input images and extract their content for input to the build.
Expand Down