Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve(k8s): change buildkit cache import/export config (WIP) #2632

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 7 additions & 4 deletions core/src/plugins/kubernetes/container/build/buildkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { PodRunner } from "../../run"
export const buildkitImageName = "gardendev/buildkit:v0.8.1-4"
export const buildkitDeploymentName = "garden-buildkit"
const buildkitContainerName = "buildkitd"
const insecureRegistryClause = ",registry.insecure=true"

const deployLock = new AsyncLock()

Expand Down Expand Up @@ -115,11 +116,13 @@ export const buildkitBuildHandler: BuildHandler = async (params) => {
const cacheTag = "_buildcache"
// Prepare the build command (this thing, while an otherwise excellent piece of software, is clearly is not meant for
// everyday human usage)
let outputSpec = `type=image,"name=${deploymentImageId},${deploymentImageName}:${cacheTag}",push=true`
let outputSpec = `type=image,"name=${deploymentImageId}",push=true`
let cacheSpec = `type=registry,ref=${deploymentImageName}:${cacheTag},mode=max`

if (usingInClusterRegistry(provider)) {
// The in-cluster registry is not exposed, so we don't configure TLS on it.
outputSpec += ",registry.insecure=true"
outputSpec += insecureRegistryClause
cacheSpec += insecureRegistryClause
}

const command = [
Expand All @@ -135,9 +138,9 @@ export const buildkitBuildHandler: BuildHandler = async (params) => {
"--output",
outputSpec,
"--export-cache",
"type=inline",
cacheSpec,
"--import-cache",
`type=registry,ref=${deploymentImageName}:${cacheTag}`,
cacheSpec,
...getBuildkitFlags(module),
]

Expand Down
2 changes: 1 addition & 1 deletion examples/demo-project/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ providers:
context: ${var.remoteContext}
namespace: ${environment.namespace}
defaultHostname: ${var.userId}-demo-project.dev-1.sys.garden
buildMode: kaniko
buildMode: cluster-buildkit
- name: kubernetes
environments: [testing]
# Replace these values as appropriate
Expand Down