Skip to content

Commit 26a99fc

Browse files
committed
test: add example with spring boot application failover
1 parent 129981b commit 26a99fc

49 files changed

Lines changed: 5955 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Postgres-Operator provides PostgreSQL as a service on Kubernetes and OpenShift.
99
* * `./charts/patroni-services` - directory with HELM chart for Postgres Services.
1010
* `./pkg` - directory with operator source code, which is used for running Postgres Operator.
1111
* `./tests` - directory with robot test source code, `Dockerfile`.
12+
* * `./tests/examples` - example projects demonstrating various use cases.
1213

1314
## How to start
1415

@@ -25,7 +26,12 @@ There are no well-defined rules for troubleshooting, as each task is unique, but
2526
* Deploy parameters.
2627
* Logs from all Postgres Service pods: operator, postgres db and others.
2728

29+
## Examples
30+
31+
* **[Spring Boot Failover Testing](tests/examples/spring-boot-failover-test/)** - Test PostgreSQL failover behavior with Spring Boot applications
32+
* [More Examples](tests/examples/) - Additional example projects
33+
2834
## Useful links
2935

3036
* [Installation Guide](/docs/public/installation.md)
31-
* [Features](/docs/public/features)
37+
* [Features](/docs/public/features)

tests/examples/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# pgskipper-operator Examples
2+
3+
This directory contains example projects demonstrating various use cases for pgskipper-operator.
4+
5+
## Available Examples
6+
7+
### [Spring Boot Failover Testing](spring-boot-failover-test/)
8+
9+
A comprehensive testing environment to reproduce and analyze PostgreSQL failover behavior with Spring Boot applications using HikariCP connection pooling.
10+
11+
**Features:**
12+
- PostgreSQL HA cluster with automatic failover
13+
- Spring Boot application with connection monitoring
14+
- Failover testing scripts
15+
- Detailed metrics and monitoring
16+
- HikariCP connection pool optimization
17+
18+
**Use Cases:**
19+
- Testing application behavior during database failover
20+
- Validating connection pool configurations
21+
- Analyzing reconnection patterns and timing
22+
- Developing failover-resilient applications
23+
24+
**Quick Start:**
25+
```bash
26+
cd spring-boot-failover-test
27+
helmfile sync
28+
```
29+
30+
See the [full documentation](spring-boot-failover-test/README.md) for detailed instructions.
31+
32+
---
33+
34+
## Contributing Examples
35+
36+
If you have an example demonstrating a specific use case for pgskipper-operator, please feel free to contribute it! Each example should include:
37+
38+
1. **README.md** - Clear documentation with prerequisites, setup instructions, and usage
39+
2. **helmfile.yaml** or deployment manifests - Reproducible deployment configuration
40+
3. **Application code** - If applicable, well-documented source code
41+
4. **.gitignore** - To exclude build artifacts and sensitive data
42+
43+
## Support
44+
45+
For issues or questions about these examples:
46+
- Check the individual example's documentation
47+
- Review the main [pgskipper-operator documentation](../../README.md)
48+
- Open an issue in the [GitHub repository](https://github.com/Netcracker/pgskipper-operator/issues)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Example environment configuration for helmfile
2+
# Copy this file to .envrc and adjust as needed
3+
# If using direnv, it will automatically load these variables when you cd into the directory
4+
5+
# Image Configuration
6+
# -------------------
7+
8+
# Use local build instead of official images (default: false)
9+
# export USE_LOCAL_IMAGES=true
10+
11+
# Override operator image repository (default: ghcr.io/netcracker/pgskipper-operator)
12+
# export PGSKIPPER_IMAGE=ghcr.io/netcracker/pgskipper-operator
13+
14+
# Override operator image tag (default: main)
15+
# export PGSKIPPER_TAG=v1.2.3
16+
17+
# Deployment Configuration
18+
# -------------------------
19+
20+
# Override PostgreSQL namespace (default: postgres)
21+
# export NAMESPACE=postgres
22+
23+
# Override application namespace (default: default)
24+
# export APP_NAMESPACE=default
25+
26+
# Usage Examples
27+
# --------------
28+
#
29+
# Deploy to OrbStack with official images:
30+
# helmfile -e local sync
31+
#
32+
# Deploy to OrbStack with local build:
33+
# USE_LOCAL_IMAGES=true helmfile -e local sync
34+
#
35+
# Deploy to Rancher with specific version:
36+
# PGSKIPPER_TAG=v1.2.3 helmfile -e rancher sync
37+
#
38+
# Deploy to cloud with custom image:
39+
# PGSKIPPER_IMAGE=myregistry.io/pgskipper PGSKIPPER_TAG=custom helmfile sync
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Maven
2+
spring-app/target/
3+
spring-app/.mvn/
4+
spring-app/mvnw
5+
spring-app/mvnw.cmd
6+
7+
# Buildpacks cache
8+
spring-app/.pack/
9+
.pack-build/
10+
11+
# IDE
12+
.idea/
13+
*.iml
14+
.vscode/
15+
*.swp
16+
*.swo
17+
.claude/
18+
19+
# OS
20+
.DS_Store
21+
Thumbs.db
22+
23+
# Logs
24+
*.log
25+
26+
# Kubernetes
27+
*.kubeconfig
28+
29+
# Docker
30+
.dockerignore
31+
32+
# Environment variables (direnv)
33+
.envrc
34+
35+
# Temporary files
36+
tmp/
37+
temp/
38+
39+
# Test outputs
40+
test-results/

0 commit comments

Comments
 (0)