Skip to content

Commit ef7bef9

Browse files
nastena1606gkechhors
authored
K8SPG-744 Updated Contributing guide with the steps to build and deploy the Operator (#1208)
* K8SPG-744 Updated Contributing guide with the steps to build and deploy the Operator * Updated after the review * Removed stuff that should not be part pf the PR * Update CONTRIBUTING.md Co-authored-by: George Kechagias <geo.kechagias@gmail.com> --------- Co-authored-by: George Kechagias <geo.kechagias@gmail.com> Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent 65f6d19 commit ef7bef9

File tree

1 file changed

+73
-9
lines changed

1 file changed

+73
-9
lines changed

CONTRIBUTING.md

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Contributing to Percona Operator for PostgreSQL
22

3+
We welcome contributions to the Percona Operator for PostgreSQL project and we're glad that you would like to become a Percona community member and participate in keeping open source open. For you to help us improve the Operator, please follow the guidelines below.
4+
35
## Prerequisites
46

5-
Before submitting code contributions, you should first complete the following prerequisites.
7+
Before submitting code contributions, complete the following prerequisites first.
68

79
### 1. Sign the CLA
810

@@ -16,40 +18,102 @@ Please make sure to read and observe the [Contribution Policy](code-of-conduct.m
1618

1719
### 1. Making a bug report
1820

19-
Improvement and bugfix tasks for Percona's projects are tracked in [Jira](https://jira.percona.com/projects/K8SPG/issues).
21+
We track improvement and bugfix tasks for Percona Operator project in [Jira](https://jira.percona.com/projects/K8SPG/issues).
2022

2123
Although not mandatory, it is a good practice to examine already open Jira issues first. For bigger contributions, we suggest creating a Jira issue and discussing it with the engineering team and community before proposing any code changes.
2224

2325
Another good place to discuss Percona's projects with developers and other community members is the [community forum](https://forums.percona.com).
2426

2527
### 2. Contributing to the source tree
2628

27-
Contributions to the source tree should follow the workflow described below:
29+
Follow the workflow described below:
30+
31+
1. [Fork the repository on GitHub](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo), clone your fork locally, and then [sync your local fork to upstream](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork). Make sure to always sync your fork with upstream before starting to work on any changes.
2832

29-
1. First, you need to [fork the repository on GitHub](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo), clone your fork locally, and then [sync your local fork to upstream](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork). After that, before starting to work on changes, make sure to always sync your fork with upstream.
30-
2. Create a branch for changes you are planning to make. If there is a Jira ticket related to your contribution, it is recommended to name your branch in the following way: `<Jira issue number>-<short description>`, where the issue number is something like `K8SPG-42`.
33+
2. Create a branch for changes you are planning to make. If there is a Jira ticket related to your contribution, name your branch in the following way: `<Jira issue number>-<short description>`, where the issue number is something like `K8SPG-42`.
3134

3235
Create the branch in your local repo as follows:
3336

3437
```
3538
$ git checkout -b K8SPG-42-fix-feature-X
3639
```
3740

38-
When your changes are ready, make a commit, mentioning the Jira issue in the commit message, if any:
41+
3. When your changes are ready, make a commit, mentioning the Jira issue in the commit message, if any:
3942

4043
```
4144
$ git add .
4245
$ git commit -m "K8SPG-42 fixed by ......"
4346
$ git push -u origin K8SPG-42-fix-feature-X
4447
```
4548

46-
3. Create a pull request to the main repository on GitHub.
47-
4. When the reviewer makes some comments, address any feedback that comes and update the pull request.
48-
5. When your contribution is accepted, your pull request will be approved and merged to the main branch.
49+
4. Create a pull request to the main repository on GitHub.
50+
5. [Build a custom Operator image based on your changes](#build-a-custom-operator-image) to verify that they work
51+
6. [Update deployment manifests](#update-deployment-manifests) to reflect your changes
52+
7. [Run e2e tests](#run-e2e-tests) to verify your changes are stable and robust.
53+
8. Someone from our team reviews your pull request. When the reviewer makes some comments, address any feedback that comes and update the pull request.
54+
9. When your contribution is accepted, your pull request will be approved and merged to the main branch.
55+
56+
#### Build a custom Operator image based on your changes
57+
58+
To build a new Operator image based on your local changes, do the following:
59+
60+
1. Set the `IMAGE` environment variable to the your image repository and tag. For example:
61+
62+
```
63+
$ export IMAGE=<your-repository>/percona-postgresql-operator:<feature-XYZ>
64+
```
65+
66+
Replace <your-repository> and <feature-XYZ> with your own values.
67+
68+
2. Build the Docker image and push it to the specified repository:
69+
70+
```
71+
$ make build-docker-image
72+
```
73+
74+
#### Update deployment manifests
75+
76+
Update the files under the `deploy/` directory to reflect any new fields in the resource API, a new image, etc. The `deploy/` directory contains the CRDs, bundles, and other manifests.
77+
78+
Run the following command to update deployment manifests:
79+
80+
```
81+
$ make generate VERSION=<feature-XYZ>
82+
```
83+
84+
`<feature-XYZ>` here is the tag of your built image.
85+
86+
Next, test your custom changes by deploying the Operator on your Kubernetes cluster.
87+
88+
First, deploy the Operator:
89+
90+
```
91+
$ kubectl apply --server-side -f deploy/bundle.yaml
92+
```
93+
94+
Then, deploy a Percona PostgreSQL cluster CRD:
95+
96+
```
97+
$ kubectl apply -f deploy/cr.yaml
98+
```
99+
100+
#### Run end-to-end tests
101+
102+
The Operator repository includes a collection of end-to-end (e2e) tests under the `e2e-tests/` directory. You can run these tests on your own Kubernetes cluster to ensure that your changes are robust and stable.
103+
104+
105+
To run a specific test by name, use the following command. In the example below, we run the `init-deploy` test:
106+
107+
```
108+
$ kubectl kuttl test --config e2e-tests/kuttl.yaml --test "^init-deploy\$" --skip-delete
109+
```
110+
111+
Replace `init-deploy` with the name of the test you want to run.
49112

50113
### 3. Contributing to documentation
51114

52115
The workflow for documentation is similar, but we store source code for the Percona Operator for PostgreSQL documentation in a [separate repository](https://github.com/percona/k8spg-docs).
116+
53117
See the [Documentation Contribution Guide](https://github.com/percona/k8spg-docs/blob/main/CONTRIBUTING.md) for more information.
54118

55119
### 4. Container images

0 commit comments

Comments
 (0)