Skip to content

Commit

Permalink
adding CRI_RUNTIME_ENDPOINT ENV-var to allow custom / different CRI r…
Browse files Browse the repository at this point in the history
…untime paths (part 1 of solution for #163)
  • Loading branch information
Sebastian Lagemann committed Jul 23, 2024
1 parent 99d02d3 commit e23d764
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cri/cri.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ type CRITool struct {
}

func NewCRITool(ctx context.Context) (*CRITool, error) {
var runtimeEndpointPaths = defaultRuntimeEndpoints
var res internalapi.RuntimeService
var err error

// prepend CRI_RUNTIME_ENDPOINT if set as ENV-var to make sure ENV-var has priority
if os.Getenv("CRI_RUNTIME_ENDPOINT") != "" {
runtimeEndpointPaths = append([]string{os.Getenv("CRI_RUNTIME_ENDPOINT")}, runtimeEndpointPaths...)
}

t := 10 * time.Second
for _, endPoint := range defaultRuntimeEndpoints {
for _, endPoint := range runtimeEndpointPaths {
res, err = remote.NewRemoteRuntimeService(endPoint, t, nil)
if err != nil {
continue
Expand Down

0 comments on commit e23d764

Please sign in to comment.