You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Long: `generates a custom resource definition (CRD) file for the .
42
+
Short: "Generates a custom resource definition (CRD) and the custom resource (CR) files",
43
+
Long: `The operator-sdk generate command will create a custom resource definition (CRD) and the custom resource (CR) files for the specified api-version and kind.
cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--kind must start with an uppercase letter"))
86
+
}
87
+
ifstrings.Count(apiVersion, "/") !=1 {
88
+
cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("api-version has wrong format (%v); format must be $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)", apiVersion))
89
+
}
90
+
}
91
+
92
+
// verifyCrdDeployPath checks if the path <project-name>/deploy sub-directory is exists, and that is rooted under $GOPATH
93
+
funcverifyCrdDeployPath() {
94
+
// check if $GOPATH env exists
95
+
gp:=os.Getenv(goDir)
96
+
iflen(gp) ==0 {
97
+
cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("$GOPATH env not set"))
98
+
}
99
+
wd, err:=os.Getwd()
100
+
iferr!=nil {
101
+
cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to determine the full path of the current directory: %v", err))
102
+
}
103
+
// check if this project's repository path is rooted under $GOPATH
104
+
if!strings.HasPrefix(wd, gp) {
105
+
cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("project's repository path (%v) is not rooted under GOPATH (%v)", wd, gp))
106
+
}
107
+
// check if the deploy sub-directory exist
108
+
_, err=os.Stat(filepath.Join(wd, deployCrdDir))
109
+
iferr!=nil {
110
+
cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("the path (./%v) does not exist. run this command in your project directory", deployCrdDir))
0 commit comments