-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathconfig_files_containerd.go
43 lines (35 loc) · 1.19 KB
/
config_files_containerd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
/// Licensed under the GNU Affero General Public License (AGPL).
// See License.AGPL.txt in the project root for license information.
package cmd
import (
"github.com/gitpod-io/gitpod/common-go/log"
"github.com/gitpod-io/gitpod/installer/pkg/containerd"
"github.com/spf13/cobra"
)
// configNodeContainerdCmd represents the validate command
var configNodeContainerdCmd = &cobra.Command{
Use: "containerd",
Short: "Detects the containerd settings for a cluster",
RunE: func(cmd *cobra.Command, args []string) error {
if _, err := configFileExistsAndInit(); err != nil {
return err
}
_, _, cfg, err := loadConfig(configOpts.ConfigFile)
if err != nil {
return err
}
containerd, socket, err := containerd.Detect(configFilesOpts.MountPath)
if err != nil {
return err
}
log.Infof("containerd location detected as %s", *containerd)
log.Infof("containerd socket location detected as %s", *socket)
cfg.Workspace.Runtime.ContainerDRuntimeDir = containerd.String()
cfg.Workspace.Runtime.ContainerDSocketDir = socket.String()
return saveConfigFile(cfg)
},
}
func init() {
configFilesCmd.AddCommand(configNodeContainerdCmd)
}