github.com/operator-framework/operator-lifecycle-manager@v0.30.0/DEVELOPMENT.md (about)

     1  ## Tooling
     2  
     3  ### Requirements
     4  
     5  | Requirement | Purpose               | macOS                |
     6  |-------------|-----------------------|----------------------|
     7  | Go          | Compiler              | brew install go      |
     8  | Docker      | Packaging             | [Docker for Mac]     |
     9  | kubebuilder | Testing               | [kubebuilder docs]   |
    10  
    11  [Docker for Mac]: https://store.docker.com/editions/community/docker-ce-desktop-mac
    12  [kubebuilder docs]: https://book.kubebuilder.io/quick-start.html#installation
    13  
    14  #### E2E test environments
    15  
    16  | Requirement | install docs         |
    17  |-------------|----------------------|
    18  | Kind        | [Kind docs]          |
    19  
    20  [Kind docs]: https://kind.sigs.k8s.io/docs/user/quick-start
    21  
    22  ### Usage
    23  
    24  #### Testing
    25  
    26  This project uses the built-in testing support for golang.
    27  
    28  Envtest is also used and needs to be set up. Follow [controller-runtime instructions] and set `KUBEBUILDER_ASSETS` environment variable to point to the installation directory, for instance: `/usr/local/kubebuilder/bin`.
    29  
    30  To run the tests for all go packages outside of the vendor directory, run:
    31  ```sh
    32  $ make test
    33  ```
    34  
    35  To run the e2e tests locally:
    36  
    37  ```sh
    38  $ make e2e-local
    39  ```
    40  
    41  **NOTE:** If you want to run the e2e tests, you need to make sure Kind is deployed in the local environment and switch the kubeconfig to an existing Kind cluster.
    42  
    43  To run a specific e2e test locally:
    44  
    45  ```sh
    46  $ make e2e-local TEST=TestCreateInstallPlanManualApproval
    47  ```
    48  
    49  [controller-runtime instructions]: https://pkg.go.dev/sigs.k8s.io/controller-runtime/tools/setup-envtest#section-readme
    50  
    51  #### Building
    52  
    53  Ensure your version of go is up to date; check that you're running the same version as in go.mod with the
    54  commands:
    55  ```sh
    56  $ head go.mod
    57  $ go version
    58  ```
    59  
    60  To build the go binary, run:
    61  ```sh
    62  $ make build
    63  ```
    64  
    65  #### Packaging
    66  
    67  ALM is packaged as a set of manifests for a tectonic-x-operator specialization (tectonic-alm-operator).
    68  
    69  A new version can be generated from the helm chart by:
    70  
    71   1. Modifying the `deploy/tectonic-alm-operator/values.yaml` file for the release to include new SHAs of the container images. 
    72   1. Running the `package` make command, which takes a single variable (`ver`)
    73   
    74  For example:
    75  
    76  ```
    77  make ver=0.3.0 package
    78  ``` 
    79  
    80  Will generate a new set of manifests from the helm chart in `deploy/chart` combined with the `values.yaml` file in `deploy/tectonic-alm-operator`, and output the rendered templates to `deploy/tectonic-alm-operator/manifests/0.3.0`.
    81  
    82  See the documentation in `deploy/tectonic-alm-operator` for how to take the new manifests and package them as a new version of `tectonic-alm-operator`.
    83   
    84  ### Dependency Management
    85  
    86  #### Using make
    87  These commands are handled for you via the Makefile. To install the project
    88  dependencies, run:
    89  
    90  ```sh
    91  $ make vendor
    92  ```
    93  
    94  To update dependencies, run:
    95  
    96  ```sh
    97  $ make vendor-update
    98  # verify changes
    99  $ make test
   100  $ make e2e-local-docker
   101  ```
   102  
   103  The Makefile recipes for testing and builds ensure the project's dependencies
   104  are properly installed and vendored before running.