CRIConfig gets current cri config from containerd.
()
| 802 | |
| 803 | // CRIConfig gets current cri config from containerd. |
| 804 | func CRIConfig() (*criconfig.Config, error) { |
| 805 | client, conn, err := RawRuntimeClient() |
| 806 | if err != nil { |
| 807 | return nil, fmt.Errorf("failed to get raw runtime client: %w", err) |
| 808 | } |
| 809 | defer conn.Close() |
| 810 | resp, err := client.Status(context.Background(), &runtime.StatusRequest{Verbose: true}) |
| 811 | if err != nil { |
| 812 | return nil, fmt.Errorf("failed to get status: %w", err) |
| 813 | } |
| 814 | config := &criconfig.Config{} |
| 815 | if err := json.Unmarshal([]byte(resp.Info["config"]), config); err != nil { |
| 816 | return nil, fmt.Errorf("failed to unmarshal config: %w", err) |
| 817 | } |
| 818 | return config, nil |
| 819 | } |
| 820 | |
| 821 | // SandboxInfo gets sandbox info. |
| 822 | func SandboxInfo(id string) (*runtime.PodSandboxStatus, *podsandboxtypes.SandboxInfo, error) { |
no test coverage detected
searching dependent graphs…