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

Reword comments and fix typo in buildcontext.go #3690

Merged
merged 1 commit into from
Aug 6, 2024
Merged
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
17 changes: 8 additions & 9 deletions pkg/build/nodeimage/buildcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ func (c *buildContext) prePullImagesAndWriteManifests(bits kube.Bits, parsedVers
return repository
}

// correct set of built tags using the same logic we will use to rewrite
// the tags as we load the archives
// Determine accurate built tags using the logic that will be applied
// when rewriting tags during archive loading
fixedImages := sets.NewString()
fixedImagesMap := make(map[string]string, builtImages.Len()) // key: original images, value: fixed images
for _, image := range builtImages.List() {
Expand Down Expand Up @@ -316,7 +316,7 @@ func (c *buildContext) prePullImagesAndWriteManifests(bits kube.Bits, parsedVers
}
}

// run all image re-tragging concurrently until one fails or all succeed
// run all image re-tagging concurrently until one fails or all succeed
if err := errors.UntilErrorConcurrent(tagFns); err != nil {
c.logger.Errorf("Image build Failed! Failed to re-tag images %v", err)
return nil, err
Expand All @@ -327,19 +327,18 @@ func (c *buildContext) prePullImagesAndWriteManifests(bits kube.Bits, parsedVers

func (c *buildContext) createBuildContainer() (id string, err error) {
// attempt to explicitly pull the image if it doesn't exist locally
// we don't care if this returns error, we'll still try to run which also pulls
// errors here are non-critical; we'll proceed with execution, which includes a pull operation
_ = docker.Pull(c.logger, c.baseImage, dockerBuildOsAndArch(c.arch), 4)
// this should be good enough: a specific prefix, the current unix time,
// and a little random bits in case we have multiple builds simultaneously
random := rand.New(rand.NewSource(time.Now().UnixNano())).Int31()
id = fmt.Sprintf("kind-build-%d-%d", time.Now().UTC().Unix(), random)
runArgs := []string{
"-d", // make the client exit while the container continues to run
// the container should hang forever, so we can exec in it
"--entrypoint=sleep",
"-d", // make the client exit while the container continues to run
"--entrypoint=sleep", // the container should hang forever, so we can exec in it
"--name=" + id,
"--platform=" + dockerBuildOsAndArch(c.arch),
"--security-opt", "seccomp=unconfined", // ignore seccomp
"--security-opt", "seccomp=unconfined",
}
// pass proxy settings from environment variables to the building container
// to make them work during the building process
Expand All @@ -356,7 +355,7 @@ func (c *buildContext) createBuildContainer() (id string, err error) {
c.baseImage,
runArgs,
[]string{
"infinity", // sleep infinitely to keep the container around
"infinity", // sleep infinitely to keep container running indefinitely
},
)
if err != nil {
Expand Down
Loading