Skip to content

Commit

Permalink
containerd: Add /etc/crictl config to enable crictl
Browse files Browse the repository at this point in the history
This configuration file means users don't have to pass the endpoint
to run crictl.
  • Loading branch information
justinsb committed Jan 15, 2021
1 parent 2ad3fd3 commit 955e80a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nodeup/pkg/model/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ func (b *ContainerdBuilder) Build(c *fi.ModelBuilderContext) error {
}
c.AddTask(fileTask)
}

// Add configuration file for easier use of crictl
b.addCrictlConfig(c)
}

var containerRuntimeVersion string
Expand Down Expand Up @@ -278,3 +281,16 @@ func (b *ContainerdBuilder) skipInstall() bool {

return d.SkipInstall
}

// addCritctlConfig creates /etc/crictl.yaml, which lets crictl work out-of-the-box.
func (b *ContainerdBuilder) addCrictlConfig(c *fi.ModelBuilderContext) {
conf := `
runtime-endpoint: unix:///run/containerd/containerd.sock
`

c.AddTask(&nodetasks.File{
Path: "/etc/crictl.yaml",
Contents: fi.NewStringResource(conf),
Type: nodetasks.FileType_File,
})
}

0 comments on commit 955e80a

Please sign in to comment.