forked from virtual-kubelet/cri
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cri_darwin.go
37 lines (30 loc) · 917 Bytes
/
cri_darwin.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
package cri
import (
"fmt"
"os/exec"
"strings"
)
const (
CriSocketPath = "/var/run/containerd/containerd.sock"
PodVolRoot = "/var/run/vk-cri/volumes/"
PodSecretVolDir = "/var/lib/vk-cri/secrets"
PodConfigMapVolDir = "/var/lib/vk-cri/configmaps"
)
func getOSImage() (string, error) {
productNameCmd := exec.Command("sw_vers", "-productName")
productVersionCmd := exec.Command("sw_vers", "-productVersion")
buildVersionCmd := exec.Command("sw_vers", "-buildVersion")
productName, err := productNameCmd.Output()
if err != nil {
return "", err
}
productVersion, err := productVersionCmd.Output()
if err != nil {
return "", err
}
buildVersion, err := buildVersionCmd.Output()
if err != nil {
return "", err
}
return fmt.Sprintf("%s %s (%s)", strings.TrimSpace(string(productName)), strings.TrimSpace(string(productVersion)), strings.TrimSpace(string(buildVersion))), nil
}