github.skymusic.top/operator-framework/operator-sdk@v0.8.2/doc/project_layout.md (about)

     1  # Project Scaffolding Layout
     2  
     3  The `operator-sdk` CLI generates a number of packages for each project. The following table describes a basic rundown of each generated file/directory.
     4  
     5  
     6  | File/Folders   | Purpose                           |
     7  | :---           | :--- |
     8  | cmd       | Contains `manager/main.go` which is the main program of the operator. This instantiates a new manager which registers all custom resource definitions under `pkg/apis/...` and starts all controllers under `pkg/controllers/...`  . |
     9  | pkg/apis | Contains the directory tree that defines the APIs of the Custom Resource Definitions(CRD). Users are expected to edit the `pkg/apis/<group>/<version>/<kind>_types.go` files to define the API for each resource type and import these packages in their controllers to watch for these resource types.|
    10  | pkg/controller | This pkg contains the controller implementations. Users are expected to edit the `pkg/controller/<kind>/<kind>_controller.go` to define the controller's reconcile logic for handling a resource type of the specified `kind`. |
    11  | build | Contains the `Dockerfile` and build scripts used to build the operator. |
    12  | deploy | Contains various YAML manifests for registering CRDs, setting up [RBAC][RBAC], and deploying the operator as a Deployment.
    13  | (Gopkg.toml Gopkg.lock) or (go.mod go.sum) | The [Go mod][go_mod] or [Go Dep][dep] manifests that describe the external dependencies of this operator, depending on the dependency manager chosen when initializing or migrating a project. |
    14  | vendor | The golang [vendor][Vendor] folder that contains the local copies of the external dependencies that satisfy the imports of this project. [Go Dep][dep]/[Go modules][go_mod] manages the vendor directly. |
    15  
    16  [RBAC]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/
    17  [Vendor]: https://golang.org/cmd/go/#hdr-Vendor_Directories
    18  [go_mod]: https://github.com/golang/go/wiki/Modules
    19  [dep]: https://github.com/golang/dep