2022-03-02 23:47:27 +00:00
|
|
|
//go:build linux
|
2021-06-10 19:27:00 +00:00
|
|
|
// +build linux
|
|
|
|
|
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2023-10-26 09:51:25 +00:00
|
|
|
"errors"
|
|
|
|
"os"
|
2021-06-10 19:27:00 +00:00
|
|
|
"path/filepath"
|
|
|
|
|
2023-10-26 09:51:25 +00:00
|
|
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
2022-03-02 23:47:27 +00:00
|
|
|
"github.com/k3s-io/k3s/pkg/daemons/config"
|
2023-10-26 09:51:25 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2021-06-10 19:27:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func applyContainerdStateAndAddress(nodeConfig *config.Node) {
|
|
|
|
nodeConfig.Containerd.State = "/run/k3s/containerd"
|
|
|
|
nodeConfig.Containerd.Address = filepath.Join(nodeConfig.Containerd.State, "containerd.sock")
|
|
|
|
}
|
2021-12-16 20:00:40 +00:00
|
|
|
|
|
|
|
func applyCRIDockerdAddress(nodeConfig *config.Node) {
|
|
|
|
nodeConfig.CRIDockerd.Address = "unix:///run/k3s/cri-dockerd/cri-dockerd.sock"
|
|
|
|
}
|
2023-10-26 09:51:25 +00:00
|
|
|
|
|
|
|
func applyContainerdQoSClassConfigFileIfPresent(envInfo *cmds.Agent, nodeConfig *config.Node) {
|
|
|
|
blockioPath := filepath.Join(envInfo.DataDir, "agent", "etc", "containerd", "blockio_config.yaml")
|
|
|
|
|
|
|
|
// Set containerd config if file exists
|
|
|
|
if _, err := os.Stat(blockioPath); !errors.Is(err, os.ErrNotExist) {
|
|
|
|
logrus.Infof("BlockIO configuration file found")
|
|
|
|
nodeConfig.Containerd.BlockIOConfig = blockioPath
|
|
|
|
}
|
|
|
|
|
|
|
|
rdtPath := filepath.Join(envInfo.DataDir, "agent", "etc", "containerd", "rdt_config.yaml")
|
|
|
|
|
|
|
|
// Set containerd config if file exists
|
|
|
|
if _, err := os.Stat(rdtPath); !errors.Is(err, os.ErrNotExist) {
|
|
|
|
logrus.Infof("RDT configuration file found")
|
|
|
|
nodeConfig.Containerd.RDTConfig = rdtPath
|
|
|
|
}
|
|
|
|
}
|