Add list of error codes to documentation
parent
5b512a7296
commit
e89aca810a
2
Makefile
2
Makefile
|
@ -369,7 +369,7 @@ test: $(SOURCE_GENERATED) ## Trigger minikube test
|
|||
|
||||
.PHONY: generate-docs
|
||||
generate-docs: extract out/minikube ## Automatically generate commands documentation.
|
||||
out/minikube generate-docs --path ./site/content/en/docs/commands/ --test-path ./site/content/en/docs/contrib/tests.en.md
|
||||
out/minikube generate-docs --path ./site/content/en/docs/commands/ --test-path ./site/content/en/docs/contrib/tests.en.md --code-path ./site/content/en/docs/contrib/errorcodes.en.md
|
||||
|
||||
.PHONY: gotest
|
||||
gotest: $(SOURCE_GENERATED) ## Trigger minikube test
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
|
||||
var docsPath string
|
||||
var testPath string
|
||||
var codePath string
|
||||
|
||||
// generateDocs represents the generate-docs command
|
||||
var generateDocs = &cobra.Command{
|
||||
|
@ -45,16 +46,18 @@ var generateDocs = &cobra.Command{
|
|||
}
|
||||
|
||||
// generate docs
|
||||
if err := generate.Docs(RootCmd, docsPath, testPath); err != nil {
|
||||
if err := generate.Docs(RootCmd, docsPath, testPath, codePath); err != nil {
|
||||
exit.Error(reason.InternalGenerateDocs, "Unable to generate docs", err)
|
||||
}
|
||||
out.Step(style.Documentation, "Docs have been saved at - {{.path}}", out.V{"path": docsPath})
|
||||
out.Step(style.Documentation, "Test docs have been saved at - {{.path}}", out.V{"path": testPath})
|
||||
out.Step(style.Documentation, "Error code docs have been saved at - {{.path}}", out.V{"path": codePath})
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
generateDocs.Flags().StringVar(&docsPath, "path", "", "The path on the file system where the docs in markdown need to be saved")
|
||||
generateDocs.Flags().StringVar(&testPath, "test-path", "", "The path on the file system where the testing docs in markdown need to be saved")
|
||||
generateDocs.Flags().StringVar(&codePath, "code-path", "", "The path on the file system where the error code docs in markdown need to be saved")
|
||||
RootCmd.AddCommand(generateDocs)
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ import (
|
|||
)
|
||||
|
||||
// Docs generates docs for minikube command
|
||||
func Docs(root *cobra.Command, path string, testPath string) error {
|
||||
/*cmds := root.Commands()
|
||||
func Docs(root *cobra.Command, path string, testPath string, codePath string) error {
|
||||
cmds := root.Commands()
|
||||
for _, c := range cmds {
|
||||
if c.Hidden {
|
||||
klog.Infof("Skipping generating doc for %s as it's a hidden command", c.Name())
|
||||
|
@ -50,9 +50,9 @@ func Docs(root *cobra.Command, path string, testPath string) error {
|
|||
err := TestDocs(testPath, "test/integration")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to generate test docs")
|
||||
}*/
|
||||
}
|
||||
|
||||
return ErrorCodes("./site/content/en/docs/contrib/errorcodes.en.md", "pkg/minikube/reason/known_issues.go")
|
||||
return ErrorCodes(codePath, "pkg/minikube/reason/exitcodes.go")
|
||||
}
|
||||
|
||||
// DocForCommand returns the specific doc for that command
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
"go/parser"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
@ -49,12 +49,40 @@ func ErrorCodes(docPath string, pathToCheck string) error {
|
|||
return errors.Wrap(err, fmt.Sprintf("error parsing file %s", pathToCheck))
|
||||
}
|
||||
|
||||
currentGroup := ""
|
||||
currentError := ""
|
||||
ast.Inspect(file, func(x ast.Node) bool {
|
||||
val := reflect.ValueOf(x)
|
||||
if !val.IsZero() {
|
||||
fmt.Print(val.Elem().Type().Name())
|
||||
switch x.(type) {
|
||||
case *ast.Comment:
|
||||
// Start a new group of errors
|
||||
comment := x.(*ast.Comment).Text
|
||||
if !strings.HasPrefix(comment, "// Error codes specific") {
|
||||
return true
|
||||
}
|
||||
currentGroup = strings.Replace(comment, "//", "##", 1)
|
||||
buf.WriteString("\n" + currentGroup + "\n")
|
||||
case *ast.Ident:
|
||||
// This is the name of the error, e.g. ExGuestError
|
||||
currentError = x.(*ast.Ident).Name
|
||||
case *ast.BasicLit:
|
||||
// Filter out random strings that aren't error codes
|
||||
if currentError == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
// No specific group means generic errors
|
||||
if currentGroup == "" {
|
||||
currentGroup = "## Generic Errors"
|
||||
buf.WriteString("\n" + currentGroup + "\n")
|
||||
}
|
||||
|
||||
// This is the numeric code of the error, e.g. 80 for ExGuest Error
|
||||
code := x.(*ast.BasicLit).Value
|
||||
buf.WriteString(fmt.Sprintf("%s: %s\n", code, currentError))
|
||||
default:
|
||||
}
|
||||
return true
|
||||
})
|
||||
return nil
|
||||
|
||||
return ioutil.WriteFile(docPath, buf.Bytes(), 0o644)
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ var exclude = []string{
|
|||
"- {{.profile}}",
|
||||
" - {{.profile}}",
|
||||
"test/integration",
|
||||
"pkg/minikube/reason/exitcodes.go",
|
||||
}
|
||||
|
||||
// ErrMapFile is a constant to refer to the err_map file, which contains the Advice strings.
|
||||
|
|
|
@ -56,7 +56,6 @@ const (
|
|||
// navailableOff = 9 // (~EX_UNAVAILABLE)
|
||||
|
||||
// Error codes specific to the minikube program
|
||||
|
||||
ExProgramError = 10 // generic error
|
||||
ExProgramUsage = 14 // bad command-line options
|
||||
ExProgramConflict = 11 // can't do what you want because of existing data
|
||||
|
@ -65,7 +64,6 @@ const (
|
|||
ExProgramConfig = 18 // bad configuration specified
|
||||
|
||||
// Error codes specific to resource limits (exit code layout follows no rules)
|
||||
|
||||
ExResourceError = 20
|
||||
ExInsufficientMemory = 23
|
||||
ExInsufficientStorage = 26
|
||||
|
@ -73,7 +71,6 @@ const (
|
|||
ExInsufficientCores = 29
|
||||
|
||||
// Error codes specific to the host
|
||||
|
||||
ExHostError = 30
|
||||
ExHostConflict = 31
|
||||
ExHostTimeout = 32
|
||||
|
@ -84,7 +81,6 @@ const (
|
|||
ExHostConfig = 38
|
||||
|
||||
// Error codes specific to remote networking
|
||||
|
||||
ExInternetError = 40
|
||||
ExInternetConflict = 41
|
||||
ExInternetTimeout = 42
|
||||
|
@ -93,7 +89,6 @@ const (
|
|||
ExInternetUnavailable = 49
|
||||
|
||||
// Error codes specific to the libmachine driver
|
||||
|
||||
ExDriverError = 50
|
||||
ExDriverConflict = 51
|
||||
ExDriverTimeout = 52
|
||||
|
@ -105,7 +100,6 @@ const (
|
|||
ExDriverUnavailable = 59
|
||||
|
||||
// Error codes specific to the driver provider
|
||||
|
||||
ExProviderError = 60
|
||||
ExProviderConflict = 61
|
||||
ExProviderTimeout = 62
|
||||
|
@ -120,7 +114,6 @@ const (
|
|||
ExProviderUnavailable = 69 // In common use
|
||||
|
||||
// Error codes specific to local networking
|
||||
|
||||
ExLocalNetworkError = 70
|
||||
ExLocalNetworkConflict = 71
|
||||
ExLocalNetworkTimeout = 72
|
||||
|
@ -130,7 +123,6 @@ const (
|
|||
ExLocalNetworkUnavailable = 79
|
||||
|
||||
// Error codes specific to the guest host
|
||||
|
||||
ExGuestError = 80
|
||||
ExGuestConflict = 81
|
||||
ExGuestTimeout = 82
|
||||
|
@ -142,14 +134,12 @@ const (
|
|||
ExGuestUnavailable = 89
|
||||
|
||||
// Error codes specific to the container runtime
|
||||
|
||||
ExRuntimeError = 90
|
||||
ExRuntimeNotRunning = 93
|
||||
ExRuntimeNotFound = 95
|
||||
ExRuntimeUnavailable = 99
|
||||
|
||||
// Error codes specific to the Kubernetes control plane
|
||||
|
||||
ExControlPlaneError = 100
|
||||
ExControlPlaneConflict = 101
|
||||
ExControlPlaneTimeout = 102
|
||||
|
@ -160,7 +150,6 @@ const (
|
|||
ExControlPlaneUnavailable = 109
|
||||
|
||||
// Error codes specific to a Kubernetes service
|
||||
|
||||
ExSvcError = 110
|
||||
ExSvcConflict = 111
|
||||
ExSvcTimeout = 112
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
---
|
||||
title: "Error Codes"
|
||||
description: >
|
||||
minikube error codes and advice
|
||||
---
|
||||
|
||||
|
||||
|
||||
## Generic Errors
|
||||
1: ExFailure
|
||||
2: ExInterrupted
|
||||
|
||||
## Error codes specific to the minikube program
|
||||
10: ExProgramError
|
||||
14: ExProgramUsage
|
||||
11: ExProgramConflict
|
||||
15: ExProgramNotFound
|
||||
16: ExProgramUnsupported
|
||||
18: ExProgramConfig
|
||||
|
||||
## Error codes specific to resource limits (exit code layout follows no rules)
|
||||
20: ExResourceError
|
||||
23: ExInsufficientMemory
|
||||
26: ExInsufficientStorage
|
||||
27: ExInsufficientPermission
|
||||
29: ExInsufficientCores
|
||||
|
||||
## Error codes specific to the host
|
||||
30: ExHostError
|
||||
31: ExHostConflict
|
||||
32: ExHostTimeout
|
||||
34: ExHostUsage
|
||||
35: ExHostNotFound
|
||||
38: ExHostUnsupported
|
||||
37: ExHostPermission
|
||||
38: ExHostConfig
|
||||
|
||||
## Error codes specific to remote networking
|
||||
40: ExInternetError
|
||||
41: ExInternetConflict
|
||||
42: ExInternetTimeout
|
||||
45: ExInternetNotFound
|
||||
48: ExInternetConfig
|
||||
49: ExInternetUnavailable
|
||||
|
||||
## Error codes specific to the libmachine driver
|
||||
50: ExDriverError
|
||||
51: ExDriverConflict
|
||||
52: ExDriverTimeout
|
||||
54: ExDriverUsage
|
||||
55: ExDriverNotFound
|
||||
56: ExDriverUnsupported
|
||||
57: ExDriverPermission
|
||||
58: ExDriverConfig
|
||||
59: ExDriverUnavailable
|
||||
|
||||
## Error codes specific to the driver provider
|
||||
60: ExProviderError
|
||||
61: ExProviderConflict
|
||||
62: ExProviderTimeout
|
||||
63: ExProviderNotRunning
|
||||
65: ExProviderNotFound
|
||||
66: ExProviderUnsupported
|
||||
67: ExProviderPermission
|
||||
68: ExProviderConfig
|
||||
69: ExProviderUnavailable
|
||||
|
||||
## Error codes specific to local networking
|
||||
70: ExLocalNetworkError
|
||||
71: ExLocalNetworkConflict
|
||||
72: ExLocalNetworkTimeout
|
||||
75: ExLocalNetworkNotFound
|
||||
77: ExLocalNetworkPermission
|
||||
78: ExLocalNetworkConfig
|
||||
79: ExLocalNetworkUnavailable
|
||||
|
||||
## Error codes specific to the guest host
|
||||
80: ExGuestError
|
||||
81: ExGuestConflict
|
||||
82: ExGuestTimeout
|
||||
83: ExGuestNotRunning
|
||||
85: ExGuestNotFound
|
||||
86: ExGuestUnsupported
|
||||
87: ExGuestPermission
|
||||
88: ExGuestConfig
|
||||
89: ExGuestUnavailable
|
||||
|
||||
## Error codes specific to the container runtime
|
||||
90: ExRuntimeError
|
||||
93: ExRuntimeNotRunning
|
||||
95: ExRuntimeNotFound
|
||||
99: ExRuntimeUnavailable
|
||||
|
||||
## Error codes specific to the Kubernetes control plane
|
||||
100: ExControlPlaneError
|
||||
101: ExControlPlaneConflict
|
||||
102: ExControlPlaneTimeout
|
||||
103: ExControlPlaneNotRunning
|
||||
105: ExControlPlaneNotFound
|
||||
106: ExControlPlaneUnsupported
|
||||
108: ExControlPlaneConfig
|
||||
109: ExControlPlaneUnavailable
|
||||
|
||||
## Error codes specific to a Kubernetes service
|
||||
110: ExSvcError
|
||||
111: ExSvcConflict
|
||||
112: ExSvcTimeout
|
||||
113: ExSvcNotRunning
|
||||
115: ExSvcNotFound
|
||||
116: ExSvcUnsupported
|
||||
117: ExSvcPermission
|
||||
118: ExSvcConfig
|
||||
119: ExSvcUnavailable
|
|
@ -178,6 +178,7 @@
|
|||
"Environment variables to pass to the Docker daemon. (format: key=value)": "Umgebungsvariablen, die an den Docker-Daemon übergeben werden. (Format: Schlüssel = Wert)",
|
||||
"Environment variables to pass to the build. (format: key=value)": "",
|
||||
"Error checking driver version: {{.error}}": "Fehler beim Prüfen der Treiberversion: {{.error}}",
|
||||
"Error code docs have been saved at - {{.path}}": "",
|
||||
"Error creating minikube directory": "",
|
||||
"Error creating view template": "",
|
||||
"Error detecting shell": "",
|
||||
|
@ -639,6 +640,7 @@
|
|||
"The number of nodes to spin up. Defaults to 1.": "",
|
||||
"The output format. One of 'json', 'table'": "",
|
||||
"The path on the file system where the docs in markdown need to be saved": "",
|
||||
"The path on the file system where the error code docs in markdown need to be saved": "",
|
||||
"The path on the file system where the testing docs in markdown need to be saved": "",
|
||||
"The podman service within '{{.cluster}}' is not active": "",
|
||||
"The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
"Environment variables to pass to the Docker daemon. (format: key=value)": "Variables de entorno que se transferirán al daemon de Docker. Formato: clave=valor",
|
||||
"Environment variables to pass to the build. (format: key=value)": "",
|
||||
"Error checking driver version: {{.error}}": "No se ha podido comprobar la versión del controlador: {{.error}}",
|
||||
"Error code docs have been saved at - {{.path}}": "",
|
||||
"Error creating minikube directory": "Error al crear el directorio minikube",
|
||||
"Error creating view template": "Error al crear la plantilla de vista",
|
||||
"Error detecting shell": "Error al detectar la shell",
|
||||
|
@ -644,6 +645,7 @@
|
|||
"The number of nodes to spin up. Defaults to 1.": "",
|
||||
"The output format. One of 'json', 'table'": "",
|
||||
"The path on the file system where the docs in markdown need to be saved": "",
|
||||
"The path on the file system where the error code docs in markdown need to be saved": "",
|
||||
"The path on the file system where the testing docs in markdown need to be saved": "",
|
||||
"The podman service within '{{.cluster}}' is not active": "",
|
||||
"The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
|
||||
|
|
|
@ -180,6 +180,7 @@
|
|||
"Environment variables to pass to the Docker daemon. (format: key=value)": "Variables d'environment à transmettre au daemon Docker (format : clé = valeur).",
|
||||
"Environment variables to pass to the build. (format: key=value)": "",
|
||||
"Error checking driver version: {{.error}}": "Erreur lors de la vérification de la version du driver : {{.error}}",
|
||||
"Error code docs have been saved at - {{.path}}": "",
|
||||
"Error creating minikube directory": "",
|
||||
"Error creating view template": "",
|
||||
"Error detecting shell": "",
|
||||
|
@ -642,6 +643,7 @@
|
|||
"The number of nodes to spin up. Defaults to 1.": "",
|
||||
"The output format. One of 'json', 'table'": "",
|
||||
"The path on the file system where the docs in markdown need to be saved": "",
|
||||
"The path on the file system where the error code docs in markdown need to be saved": "",
|
||||
"The path on the file system where the testing docs in markdown need to be saved": "",
|
||||
"The podman service within '{{.cluster}}' is not active": "",
|
||||
"The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
|
||||
|
|
|
@ -172,6 +172,7 @@
|
|||
"Ensure your {{.driver_name}} is running and is healthy.": "",
|
||||
"Environment variables to pass to the Docker daemon. (format: key=value)": "Docker デーモンに渡す環境変数(形式: Key=Value)",
|
||||
"Environment variables to pass to the build. (format: key=value)": "",
|
||||
"Error code docs have been saved at - {{.path}}": "",
|
||||
"Error creating minikube directory": "minikube のディレクトリ作成中にエラーが発生しました",
|
||||
"Error creating view template": "表示用のテンプレートを作成中にエラーが発生しました",
|
||||
"Error detecting shell": "シェルの確認中にエラーが発生しました",
|
||||
|
@ -638,6 +639,7 @@
|
|||
"The number of nodes to spin up. Defaults to 1.": "",
|
||||
"The output format. One of 'json', 'table'": "",
|
||||
"The path on the file system where the docs in markdown need to be saved": "",
|
||||
"The path on the file system where the error code docs in markdown need to be saved": "",
|
||||
"The path on the file system where the testing docs in markdown need to be saved": "",
|
||||
"The podman service within '{{.cluster}}' is not active": "",
|
||||
"The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
|
||||
|
|
|
@ -188,6 +188,7 @@
|
|||
"Environment variables to pass to the Docker daemon. (format: key=value)": "",
|
||||
"Environment variables to pass to the build. (format: key=value)": "",
|
||||
"Error adding node to cluster": "클러스터에 노드 추가 오류",
|
||||
"Error code docs have been saved at - {{.path}}": "",
|
||||
"Error creating minikube directory": "minikube 폴더 생성 오류",
|
||||
"Error creating view template": "",
|
||||
"Error detecting shell": "shell 탐지 오류",
|
||||
|
@ -651,6 +652,7 @@
|
|||
"The number of nodes to spin up. Defaults to 1.": "",
|
||||
"The output format. One of 'json', 'table'": "",
|
||||
"The path on the file system where the docs in markdown need to be saved": "",
|
||||
"The path on the file system where the error code docs in markdown need to be saved": "",
|
||||
"The path on the file system where the testing docs in markdown need to be saved": "",
|
||||
"The podman service within '{{.cluster}}' is not active": "",
|
||||
"The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
|
||||
|
|
|
@ -188,6 +188,7 @@
|
|||
"Environment variables to pass to the Docker daemon. (format: key=value)": "Zmienne środowiskowe do przekazania do demona docker (format: klucz-wartość)",
|
||||
"Environment variables to pass to the build. (format: key=value)": "",
|
||||
"Error checking driver version: {{.error}}": "Błąd podczas sprawdzania wersji sterownika : {{.error}}",
|
||||
"Error code docs have been saved at - {{.path}}": "",
|
||||
"Error creating minikube directory": "",
|
||||
"Error creating view template": "",
|
||||
"Error detecting shell": "",
|
||||
|
@ -659,6 +660,7 @@
|
|||
"The number of nodes to spin up. Defaults to 1.": "",
|
||||
"The output format. One of 'json', 'table'": "",
|
||||
"The path on the file system where the docs in markdown need to be saved": "",
|
||||
"The path on the file system where the error code docs in markdown need to be saved": "",
|
||||
"The path on the file system where the testing docs in markdown need to be saved": "",
|
||||
"The podman service within '{{.cluster}}' is not active": "",
|
||||
"The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
|
||||
|
|
|
@ -168,6 +168,7 @@
|
|||
"Ensure your {{.driver_name}} is running and is healthy.": "",
|
||||
"Environment variables to pass to the Docker daemon. (format: key=value)": "",
|
||||
"Environment variables to pass to the build. (format: key=value)": "",
|
||||
"Error code docs have been saved at - {{.path}}": "",
|
||||
"Error creating minikube directory": "",
|
||||
"Error creating view template": "",
|
||||
"Error detecting shell": "",
|
||||
|
@ -597,6 +598,7 @@
|
|||
"The number of nodes to spin up. Defaults to 1.": "",
|
||||
"The output format. One of 'json', 'table'": "",
|
||||
"The path on the file system where the docs in markdown need to be saved": "",
|
||||
"The path on the file system where the error code docs in markdown need to be saved": "",
|
||||
"The path on the file system where the testing docs in markdown need to be saved": "",
|
||||
"The podman service within '{{.cluster}}' is not active": "",
|
||||
"The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
|
||||
|
|
|
@ -216,6 +216,7 @@
|
|||
"Environment variables to pass to the Docker daemon. (format: key=value)": "传递给 Docker 守护进程的环境变量。(格式:键值对)",
|
||||
"Environment variables to pass to the build. (format: key=value)": "",
|
||||
"Error checking driver version: {{.error}}": "检查驱动程序版本时出错:{{.error}}",
|
||||
"Error code docs have been saved at - {{.path}}": "",
|
||||
"Error converting status to json": "转换状态为 json 时出错",
|
||||
"Error creating list template": "创建 list template 时出错",
|
||||
"Error creating minikube directory": "创建 minikube 目录时出错",
|
||||
|
@ -746,6 +747,7 @@
|
|||
"The number of nodes to spin up. Defaults to 1.": "",
|
||||
"The output format. One of 'json', 'table'": "输出的格式。'json' 或者 'table'",
|
||||
"The path on the file system where the docs in markdown need to be saved": "",
|
||||
"The path on the file system where the error code docs in markdown need to be saved": "",
|
||||
"The path on the file system where the testing docs in markdown need to be saved": "",
|
||||
"The podman service within '{{.cluster}}' is not active": "",
|
||||
"The podman-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
|
||||
|
|
Loading…
Reference in New Issue