The module lifecycle stage: Preview
ValkeyClass
The Cluster Wide ValkeyClass resource allows restricting the creation of invalid configurations and predefining some values.
Each Valkey resource must be associated with an existing ValkeyClass resource.
Before deploying the service, all configuration will be checked against the corresponding ValkeyClass.
Sizing Policies
The structure allows creating a set of sizing policies for associated Valkey resources.
This helps avoid uneven distribution of CPU and Memory resources on cluster nodes.
The determining factor for choosing a particular policy is falling within the cores interval.
Then compliance with other fields of the specific policy will be checked.
spec:
sizingPolicies:
- cores:
min: 1
max: 4
memory:
min: 100Mi
max: 1Gi
step: 1Mi
coreFraction: [10, 30, 50]
- cores:
min: 5
max: 10
memory:
min: 500Mi
max: 2Gi
coreFraction: [50, 70, 100]
Validation Rules
CEL (Common Expression Language) syntax is used to create flexible validation mechanisms.
We provide a set of predefined variables that can be used in rule:
- configuration.maxMemory
int - configuration.maxMemoryPolicy
string - configuration.save
string - configuration.appendOnly
string - instance.memory.size
int - instance.cpu.cores
int
spec:
validations:
- message: "maxMemory should be less then instance.memory.size at least for 10%"
rule: "configuration.maxMemory <= instance.memory.size - instance.memory.size / 10"
Overridable Configuration
A whitelist of configuration parameters that can be overridden in the Valkey resource.
List of all possible parameters.
spec:
overridableConfiguration:
- maxMemory
- maxMemoryPolicy
Configuration
Configuration parameters that can be defined at the ValkeyClass level.
Values of these parameters will override defaults for all associated Valkey resources.
Note: Parameters that were allowed and overridden in overridableConfiguration will take priority.
spec:
configuration:
maxMemoryPolicy: Noeviction
save: "360 100"
appendOnly: "No"
Default values set by Valkey Operator follow this logic:
save: ""appendOnly: “no”maxMemory:spec.instance.memory.size* 0.9
Affinity
Standard Kubernetes mechanism for managing scheduling of deployed pods.
spec:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "node.deckhouse.io/group"
operator: "In"
values:
- "valkey"
Tolerations
Standard Kubernetes mechanism for managing scheduling of deployed pods.
spec:
tolerations:
- key: primary-role
operator: Equal
value: valkey
effect: NoSchedule
Node Selector
Standard Kubernetes mechanism for managing scheduling of deployed pods.
nodeSelector:
"node.deckhouse.io/group": "valkey"
Usage Examples
Basic Usage
apiVersion: managed-services.deckhouse.io/v1alpha1
kind: ValkeyClass
spec:
overridableConfiguration:
- maxMemoryPolicy
- save
- appendOnly
- maxMemory
configuration:
maxMemoryPolicy: Noeviction
save: "360 100"
appendOnly: "No"
sizingPolicies:
- cores:
min: 1
max: 4
memory:
min: 128Mi
max: 2Gi
step: 128Mi
coreFractions:
- "25%"
- "50%"
- "75%"
- "100%"
- cores:
min: 5
max: 8
memory:
min: 2Gi
max: 8Gi
step: 1Gi
coreFractions:
- "25%"
- "50%"
- "75%"
- "100%"
validations:
- message: "maxMemory should be less then instance.memory.size at least for 10%"
rule: "configuration.maxMemory <= instance.memory.size - instance.memory.size / 10"