StackGres provides cluster profiles that adjust default configuration settings based on the intended environment. Profiles offer a convenient way to set sensible defaults for pod anti-affinity and resource requirements without having to configure each option individually.
The SGCluster.spec.profile field accepts one of three values:
| Profile | Pod Anti-Affinity | Patroni Resource Requirements | Sidecar Resource Requirements |
|---|---|---|---|
production (default) |
Enabled - prevents two Pods from running on the same Node | Enabled - sets both limits and requests from the SGInstanceProfile | Enabled - sets requests from the SGInstanceProfile |
testing |
Disabled - allows two Pods on the same Node | Enabled - sets both limits and requests from the SGInstanceProfile | Enabled - sets requests from the SGInstanceProfile |
development |
Disabled - allows two Pods on the same Node | Disabled - unsets limits and requests for the patroni container | Disabled - unsets requests for sidecar containers |
Set the profile in your SGCluster definition:
apiVersion: stackgres.io/v1
kind: SGCluster
metadata:
name: my-cluster
spec:
profile: production
instances: 3
postgres:
version: '16'
sgInstanceProfile: size-small
The default profile. Enforces resource isolation and high availability best practices:
Relaxes scheduling constraints while maintaining resource requirements:
Removes most constraints for lightweight local development:
Each profile sets defaults for fields under SGCluster.spec.nonProductionOptions:
| Field | production | testing | development |
|---|---|---|---|
disableClusterPodAntiAffinity |
false |
true |
true |
disablePatroniResourceRequirements |
false |
false |
true |
disableClusterResourceRequirements |
false |
false |
true |
These fields can still be overridden individually if you need a custom combination. The profile simply provides convenient defaults.
Changing the profile field may require a restart of the cluster Pods.