Skip to content

Core Types API Reference

Overview

Core types are shared structures used across all Valkey Operator Custom Resources.

Architecture Types

Arch

Defines the architecture type for Valkey instances:

  • cluster - Valkey Cluster mode
  • failover - Valkey Sentinel-based failover
  • replica - Primary-replica using etcd for leader election
  • sentinel - Standalone Sentinel

Storage Configuration

Storage

Field Type Description
annotations map[string]string Annotations for the storage service
storageClassName *string Storage class name for persistent volumes
capacity *resource.Quantity Storage capacity (defaults to 2x memory limit if not set)
accessMode corev1.PersistentVolumeAccessMode Access mode (default: ReadWriteOnce)
retainAfterDeleted bool Whether to retain storage after deletion

Access Configuration

InstanceAccess

Field Type Description
serviceType corev1.ServiceType Kubernetes service type (ClusterIP, NodePort, LoadBalancer)
annotations map[string]string Service annotations
ipFamilyPrefer corev1.IPFamily IP family preference (IPv4, IPv6)
ports string NodePort sequence assignment: ports and port ranges, comma-separated (e.g., "30000,30001" or "30000-30001")
enableTLS bool Enable TLS for external access
certIssuer string Certificate issuer for TLS
certIssuerType string Certificate issuer type (ClusterIssuer or Issuer)

Monitoring Configuration

Exporter

Field Type Description
image string Exporter image
imagePullPolicy corev1.PullPolicy Image pull policy
resources *corev1.ResourceRequirements Resource requirements
securityContext *corev1.SecurityContext Security context

Node Information

ValkeyNode

Field Type Description
id string Valkey cluster node ID
shardId string Cluster shard ID of the node
role NodeRole Node role (master, replica, sentinel)
ip string Node IP address
port string Node port
slots string Cluster slots (for cluster mode)
masterRef string Master node ID (for replicas)
statefulSet string StatefulSet name of the pod
podName string Pod name
nodeName string Kubernetes node name where the pod is running

Affinity Policies

AffinityPolicy

Predefined affinity policies for pod scheduling:

  • SoftAntiAffinity - Prefer different nodes, allow same-node scheduling
  • AntiAffinityInShard - Enforce different nodes within shards
  • AntiAffinity - Enforce all pods on different nodes
  • CustomAffinity - Use custom affinity rules

Module Configuration

ValkeyModule

Field Type Description
path string Module file path
args []string Module arguments (Valkey 8.0+)

Overwrites

Overwrite

Patches the objects of one kind that the operator generates; for Services, those of one target. See Customizing Generated Resources for what a patch may change.

Field Type Description
kind OverwriteKind Kind of the generated objects to patch: StatefulSet, PodDisruptionBudget or Service; each kind, or kind and target, at most once
target OverwriteTarget Required for kind Service, and not allowed for the others: the Services to patch, headless, instance, readwrite, readonly, exporter or pod (see Service Targets)
patch object or string Strategic merge patch applied to every generated object of that kind and target, kept exactly as written: an object, or a string that holds one in YAML or JSON

Examples

Basic Storage Configuration

storage:
  storageClassName: fast-ssd
  capacity: 10Gi
  accessMode: ReadWriteOnce
  retainAfterDeleted: true

Access Configuration with NodePort

access:
  serviceType: NodePort
  ports: "30000,30001,30002"
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: nlb

Exporter Configuration

exporter:
  resources:
    requests:
      memory: 64Mi
      cpu: 50m
    limits:
      memory: 128Mi
      cpu: 100m

Module Configuration

modules:
  - path: /opt/redis-stack/lib/rejson.so
  - path: /opt/redis-stack/lib/redisearch.so
    args: ["MAXSEARCHRESULTS", "10000"]

Overwrites

overwrites:
  - kind: StatefulSet
    patch:
      spec:
        template:
          spec:
            priorityClassName: critical
            containers:
              - name: exporter
                args: ["--include-system-metrics=true"]
  - kind: PodDisruptionBudget
    patch:
      spec:
        unhealthyPodEvictionPolicy: AlwaysAllow
  - kind: Service
    target: readwrite
    patch:
      metadata:
        annotations:
          external-dns.alpha.kubernetes.io/hostname: cache.example.com