Skip to content

Latest commit

 

History

History
161 lines (123 loc) · 2.57 KB

development.md

File metadata and controls

161 lines (123 loc) · 2.57 KB

Development

Prerequisites

Need to install operator-sdk first.

Basics

After modifying the undermoon_types.go file, run the following to generate codes:

> make update-types

linter:

> make lint

Use kind to run Kubernetes locally.

> make kind-env

This will also create a registry on localhost:5000.

When you need to remove

Images

See the uploaded images:

> make list-images

Undermoon Image

The undermoon image should be renamed and pushed to localhost:5000/undermoon_test.

Build from undermoon repository:

> git clone https://github.com/doyoubi/undermoon
> cd undermoon
> docker-build-test-image
> docker tag undermoon_test:latest localhost:5000/undermoon_test
> docker push localhost:5000/undermoon_test

Operator Image

> make debug-build

E2E Tests

Run e2e tests:

> make e2e-test

Clean up the environment when the test fails:

> make cleanup-e2e-test

Run Operator For Debugging

Run the operator in Kubernetes:

> make debug-run

Create the Undermoon CRD:

> make debug-start

See the pods we created:

> kubectl get pods

See the logs of the operator:

> make debug-logs

Change the Undermoon CRD we created:

> make debug-edit

Cleanup the environment after debugging:

> make debug-stop

Tools

Run an image with curl and jq to debug the broker:

> make run-redis-cli

Run redis-cli to access the redis cluster service:

> make run-redis-cli

Helm Charts and Chaos Test

The chao test uses Helm Charts package.

There's a checker service that will keep accessing the cluster and check the data. Note that due to limited resources in PC, failover could happen and cause INCONSISTENT DATA error.

Build the checker images:

> make docker-build-checker-image

Install the operator and create the Undermoon CRD:

> make install-helm-package

Run the checker that stops on error:

> make install-undermoon-checker

Or run the checker that doesn't stop on error and keeps printing success rate:

> make install-undermoon-chaos-checker

Get the logs of the checker:

> make checker-logs

Then we can keep scaling the cluster and create some failures:

> pip install -r chaostest/ctrl_requirements.txt

# Run without killing pods
> make test-ctrl

# Run with killing pods
> make test-chaos-ctrl

Stop the checker

> uninstall-undermoon-checker

Remove the Undermoon CRD and operator:

> make uninstall-helm-package