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