Skip to content

Latest commit

 

History

History
134 lines (95 loc) · 4.04 KB

CONTRIBUTING.adoc

File metadata and controls

134 lines (95 loc) · 4.04 KB

Contributing

Gravitee.io

Reporting a bug or suggesting an enhancement

If you want to report a bug or suggest an enhancement, please follow the template guidelines corresponding to your request and submit an issue.

Submitting a pull request

First off, thanks for taking the time to contribute!

If you want are contributing an enhancement or a bug, please fill an issue and link it to your pull request description.

Details about how we interact with the repository and how you can set up your environment are given in the next sections.

Working with the repo

If you are submitting a change to the operator code please make sure that your code is covered by an integration test

If you are submitting a change to the helm charts, please make sure that it is covered by a helm unit test

Before committing your changes don’t forget to run the following make targets

# If you commit a change to the operator model
make generate manifests reference
# If you commit a change to the helm chart values
make helm-reference
# In any case
make lint-fix

When committing your contribution, please follow the conventional commits convention.

Developer guide

External documentations

The kubebuilder documentation is a good read to help you start with contributing to our code base.

Initializing your environment

Installing tooling for development

All the tool needed to run the make targets used during development can be installed by running the following command:

make install-tools

To get more information about the available make targets, run:

make help

Running the operator locally

To run the operator locally against an APIM-ready local cluster, run the following commands:

# Initialize a local kubernetes cluster running APIM
make start-cluster

# Install the operator CRDs into the cluster
make install

# Run the operator controller on your local machine
make run

Writing integration tests

Please refer to this document for guidance, conventions and best practices regarding integration testing.

Debugging

To be able to run the operator against a local instance of both an APIM Gateway and an APIM Management API, you will need to:

  • Attach to a local cluster context.

  • Create a local service account to authenticate the gateway against the local cluster.

  • Create a Management Context pointing to your local APIM Management API.

  • Run what you need to debug in debug mode.

# Create a service account token with 'cluster-admin' role in the current context and
# use this token to authenticate against the current cluster
make cluster-admin

make run # or run using a debugger if you need to debug the operator as well

If you are using visual studio code, here is a working config snippet for debugging the operator:

{
    "name": "Main",
    "type": "go",
    "request": "launch",
    "mode": "auto",
    "program": "main.go",
    "env": {
        "DEV_MODE": "true",
        "NAMESPACE": "",
    },
}

And here is another snippet for debugging integration test execution

{
  "name": "Test API Definition",
  "type": "go",
  "request": "launch",
  "mode": "auto",
  "program": "test/integration/apidefinition/suite_test.go"
}