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

Cleanup 'getUserTokenInheritAnnotation' #1294

Merged
merged 1 commit into from
Feb 12, 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
2 changes: 1 addition & 1 deletion internal/jobcontainers/jobcontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (c *JobContainer) CreateProcess(ctx context.Context, config interface{}) (_
}

var token windows.Token
if getUserTokenInheritAnnotation(c.spec.Annotations) {
if inheritUserTokenIsSet(c.spec.Annotations) {
token, err = openCurrentProcessToken()
if err != nil {
return nil, err
Expand Down
11 changes: 6 additions & 5 deletions internal/jobcontainers/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import (
specs "github.com/opencontainers/runtime-spec/specs-go"
)

const processorWeightMax = 10000

// This file contains helpers for converting parts of the oci spec to useful
// structures/limits to be applied to a job object.
func getUserTokenInheritAnnotation(annots map[string]string) bool {
val, ok := annots[annotations.HostProcessInheritUser]
return ok && val == "true"

const processorWeightMax = 10000

// inheritUserTokenIsSet checks if the annotation that specifies whether we should inherit the token of the current process is set.
func inheritUserTokenIsSet(annots map[string]string) bool {
return annots[annotations.HostProcessInheritUser] == "true"
}

// Oci spec to job object limit information. Will do any conversions to job object specific values from
Expand Down