Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

builtin/k8s/task: Explicitly set container env var for Kaniko #3322

Merged
merged 2 commits into from
May 9, 2022
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
5 changes: 5 additions & 0 deletions .changelog/3322.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```release-note:bug
plugin/k8s: Ensure `container=docker` environment variable is set for Kaniko
to properly detect running inside a container, which prevented on-demand
runners from working on Kubernetes 1.23.
```
9 changes: 9 additions & 0 deletions builtin/k8s/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ func (p *TaskLauncher) StartTask(
})
}

// NOTE(briancain): This is here to help kaniko detect that this is a docker container.
// See https://github.com/GoogleContainerTools/kaniko/blob/7e3954ac734534ce5ce68ad6300a2d3143d82f40/vendor/github.com/genuinetools/bpfd/proc/proc.go#L138
// for more info.
log.Warn("temporarily setting 'container=docker' environment variable to patch Kaniko working on Kubernetes 1.23")
env = append(env, corev1.EnvVar{
Name: "container",
Value: "docker",
})

// If the user is using the latest tag, then don't specify an overriding pull policy.
// This by default means kubernetes will always pull so that latest is used.
pullPolicy := corev1.PullIfNotPresent
Expand Down