Skip to content

Commit

Permalink
Merge pull request #164 from degola/master
Browse files Browse the repository at this point in the history
adding CRI_RUNTIME_ENDPOINT ENV-var to allow custom / different CRI runtime paths
  • Loading branch information
fatihbaltaci authored Jul 23, 2024
2 parents e296095 + e23d764 commit 009f6e9
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 009f6e9

Please sign in to comment.