Skip to content

Commit

Permalink
Use /tmp/termination-log for windows and linux
Browse files Browse the repository at this point in the history
- /dev/termination-log is not writable on windows nodes with containerd
  • Loading branch information
Tyler Phelan committed Oct 28, 2022
1 parent c48f85d commit 9343a26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions pkg/apis/build/v1alpha2/build_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ const (
secretVolumeNameTemplate = "secret-volume-%v"
pullSecretVolumeNameTemplate = "pull-secret-volume-%v"

completionTerminationMessagePathWindows = "/dev/termination-log"
completionTerminationMessagePathLinux = "/tmp/termination-log"
cosignDefaultSecretPath = "/var/build-secrets/cosign/%s"
defaultSecretPath = "/var/build-secrets/%s"
ReportTOMLPath = "/var/report/report.toml"
completionTerminationMessagePath = "/tmp/termination-log"
cosignDefaultSecretPath = "/var/build-secrets/cosign/%s"
defaultSecretPath = "/var/build-secrets/%s"
ReportTOMLPath = "/var/report/report.toml"

BuildLabel = "kpack.io/build"
k8sOSLabel = "kubernetes.io/os"
Expand Down Expand Up @@ -97,9 +96,9 @@ func (bpi *BuildPodImages) completion(os string) string {
func terminationMsgPath(os string) string {
switch os {
case "windows":
return completionTerminationMessagePathWindows
return ""
default:
return completionTerminationMessagePathLinux
return completionTerminationMessagePath
}
}

Expand Down Expand Up @@ -366,7 +365,7 @@ func (b *Build) BuildPod(images BuildPodImages, buildContext BuildContext) (*cor
Env: []corev1.EnvVar{
homeEnv,
{Name: CacheTagEnvVar, Value: b.Spec.RegistryCacheTag()},
{Name: TerminationMessagePathEnvVar, Value: terminationMsgPath(buildContext.os())},
{Name: TerminationMessagePathEnvVar, Value: completionTerminationMessagePath},
},
Args: args(
b.notaryArgs(),
Expand Down Expand Up @@ -839,7 +838,7 @@ func (b *Build) rebasePod(buildContext BuildContext, images BuildPodImages) (*co
Command: []string{"/cnb/process/completion"},
Env: []corev1.EnvVar{
{Name: CacheTagEnvVar, Value: b.Spec.RegistryCacheTag()},
{Name: TerminationMessagePathEnvVar, Value: terminationMsgPath(buildContext.os())},
{Name: TerminationMessagePathEnvVar, Value: completionTerminationMessagePath},
},
Args: args(
b.notaryArgs(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/build/v1alpha2/build_pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2636,7 +2636,7 @@ func testBuildPod(t *testing.T, when spec.G, it spec.S) {
assert.Equal(t, completionContainer.Env, []corev1.EnvVar{
{Name: "USERPROFILE", Value: "/builder/home"},
{Name: "CACHE_TAG", Value: ""},
{Name: "TERMINATION_MESSAGE_PATH", Value: "/dev/termination-log"},
{Name: "TERMINATION_MESSAGE_PATH", Value: "/tmp/termination-log"},
})
})

Expand Down

0 comments on commit 9343a26

Please sign in to comment.