Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions modules/osdk-project-staffolding-layout.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,32 @@
The `operator-sdk` CLI generates a number of packages for each Operator project. The following sections describes a basic rundown of each generated file and directory.

[id="osdk-project-scaffolding-layout-go_{context}"]
== Go-based projects
== Ansible-based projects

Go-based Operator projects (the default type) generated using the `operator-sdk new` command contain the following directories and files:
Ansible-based Operator projects generated using the `operator-sdk new --type ansible` command contain the following directories and files:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ansible-based Operator projects generated using the `operator-sdk new --type ansible` command contain the following directories and files:
Ansible-based Operator projects generated using the `operator-sdk init --plugins ansible` command contain the following directories and files:

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new subcommand was removed.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list of directories in this PR is old. There are a set of new ones now.
Here are the default list of directories (only need to worry about the top part). I used the following command to create it operator-sdk init --domain example.com --plugins ansible

.
├── config
│   ├── default
│   ├── manager
│   ├── manifests
│   ├── prometheus
│   ├── rbac
│   ├── scorecard
│   │   ├── bases
│   │   └── patches
│   └── testing
│       └── pull_policy
├── molecule
│   ├── default
│   └── kind
├── playbooks
└── roles

16 directories

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With an API, operator-sdk create api --group cache --version v1alpha1 --kind Memcached --generate-role present the structure looks like this:

$ tree -d
.
├── config
│   ├── crd
│   │   └── bases
│   ├── default
│   ├── manager
│   ├── manifests
│   ├── prometheus
│   ├── rbac
│   ├── samples
│   ├── scorecard
│   │   ├── bases
│   │   └── patches
│   └── testing
│       └── pull_policy
├── molecule
│   ├── default
│   │   └── tasks
│   └── kind
├── playbooks
└── roles
    └── memcached
        ├── defaults
        ├── files
        ├── handlers
        ├── meta
        ├── tasks
        ├── templates
        └── vars

28 directories

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need to experiment feel free to check out the quickstart upstream doc: https://sdk.operatorframework.io/docs/building-operators/ansible/quickstart/


[options="header",cols="1,2"]
|===

|File/folders |Purpose

|`cmd/`
|Contains `manager/main.go` file, which is the main program of the Operator. This instantiates a new manager which registers all custom resource defintitions (CRDs) under `pkg/apis/` and starts all controllers under `pkg/controllers/`.
|`molecule/`
|Contains the files that are used for testing the Ansible roles.

|`pkg/apis/`
|Contains the directory tree that defines the APIs of the CRDs. 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.

|`pkg/controller`
|This `pkg` contains the controller implementations. Users are expected to edit the `pkg/controller/<kind>/<kind>_controller.go` files to define the reconcile logic of the controller for handling a resource type of the specified kind.
|`roles/`
|Contains the Helm chart used while creating the project.

|`build/`
|Contains the Dockerfile and build scripts used to build the Operator.

|`deploy/`
|Contains various YAML manifests for registering CRDs, setting up RBAC, and deploying the Operator as a deployment.

a|`Gopkg.toml` +
`Gopkg.lock`
|The link:https://github.com/golang/dep[Go Dep] manifests that describe the external dependencies of this Operator.
|`requirements.yml`
|Contains the Ansible content that needs to be installed.

|`vendor/`
|The Golang link:https://golang.org/cmd/go/#hdr-Vendor_Directories[vendor] folder that contains the local copies of the external dependencies that satisfy the imports of this project. link:https://github.com/golang/dep[Go Dep] manages the vendor directly.
|`watches.yaml`
|Contains group, version, kind and role.

|===

Expand All @@ -61,6 +57,6 @@ Helm-based Operator projects generated using the `operator-sdk new --type helm`
|Contains the Dockerfile and build scripts used to build the Operator.

|`watches.yaml`
|Contains group/version/kind (GVK) and Helm chart location.
|Contains group, version, kind and Helm chart location.

|===