Skip to main content

Operations

The operator supports on-demand operations that let you trigger pod restarts declaratively through the spec.operations field. This guide covers the available operation types, how to trigger and track them, and best practices for production use.


Overview

On-demand operations provide a controlled way to restart Aerospike pods without manually deleting them. Instead of using kubectl delete pod, you declare the desired operation in the cluster spec, and the operator executes it with proper sequencing, status tracking, and event emission.

Key constraints:

  • Only one operation can be active at a time
  • The operation id must be unique and between 1--20 characters
  • Operations cannot be modified while InProgress
  • Remove the operation from the spec after it completes

Operation Types

WarmRestart

A warm restart sends SIGUSR1 to the Aerospike process, causing it to reload configuration without pod deletion. The pod stays running throughout the process.

spec:
operations:
- kind: WarmRestart
id: "config-reload-v2"

When to use:

  • After dynamic configuration changes that require a process signal
  • When you want to minimize downtime (no pod deletion/recreation)
  • For configuration reloads that Aerospike supports via SIGUSR1
tip

WarmRestart is the least disruptive operation. The Aerospike process restarts in-place, preserving the pod's network identity and storage mounts.

PodRestart

A pod restart (cold restart) deletes and recreates the targeted pods. This is equivalent to a full restart cycle including volume reattachment.

spec:
operations:
- kind: PodRestart
id: "cold-restart-01"

When to use:

  • When a warm restart is insufficient (e.g., the pod is in a bad state)
  • To force volume re-initialization
  • When the Aerospike process is unresponsive to SIGUSR1
  • After node maintenance that requires fresh pod scheduling

Targeting Specific Pods

By default, an operation targets all pods in the cluster. Use podList to target specific pods:

All Pods (default)

spec:
operations:
- kind: WarmRestart
id: "reload-all"
# podList omitted = all pods

Specific Pods

spec:
operations:
- kind: PodRestart
id: "restart-pod-2"
podList:
- aerospike-3node-0
- aerospike-3node-2
warning

When targeting specific pods, ensure you use the correct pod names. Pod names follow the pattern <cluster-name>-<rack-id>-<ordinal> for multi-rack deployments, or <cluster-name>-<ordinal> for single-rack clusters.


Triggering an Operation

Step 1: Add the operation to the cluster spec

kubectl -n aerospike patch asc aerospike-3node --type merge -p '{
"spec": {
"operations": [
{
"kind": "WarmRestart",
"id": "config-reload-v2"
}
]
}
}'

Step 2: Monitor progress

# Check operation status
kubectl -n aerospike get asc aerospike-3node \
-o jsonpath='{.status.operationStatus}' | jq .

# Watch events
kubectl -n aerospike get events \
--field-selector involvedObject.name=aerospike-3node,reason=Operation -w

Step 3: Remove the operation after completion

Once the operation reaches Completed or Error phase, remove it from the spec:

kubectl -n aerospike patch asc aerospike-3node --type merge -p '{
"spec": {
"operations": null
}
}'

Operation Status Tracking

The operator tracks operation progress in status.operationStatus:

kubectl -n aerospike get asc aerospike-3node \
-o jsonpath='{.status.operationStatus}' | jq .

Status Fields

FieldTypeDescription
idstringOperation identifier (matches spec.operations[].id)
kindstringOperation type: WarmRestart or PodRestart
phasestringCurrent phase: InProgress, Completed, or Error
completedPods[]stringPods that have completed the operation
failedPods[]stringPods where the operation failed

Phase Transitions

                    ┌──────────────┐
│ InProgress │
└──────┬───────┘

┌────────────┴────────────┐
▼ ▼
┌────────────────┐ ┌─────────────┐
│ Completed │ │ Error │
└────────────────┘ └─────────────┘
PhaseMeaning
InProgressThe operator is executing the operation on targeted pods
CompletedAll targeted pods have been successfully restarted
ErrorOne or more pods failed. Check failedPods for details

Example Status Output

{
"id": "config-reload-v2",
"kind": "WarmRestart",
"phase": "InProgress",
"completedPods": [
"aerospike-3node-0",
"aerospike-3node-1"
],
"failedPods": []
}

Pod Status After Operations

After an operation completes, individual pod status reflects the restart:

kubectl -n aerospike get asc aerospike-3node \
-o jsonpath='{.status.pods}' | jq 'to_entries[] | {pod: .key, lastRestart: .value.lastRestartReason, time: .value.lastRestartTime}'

The lastRestartReason field records why the pod was last restarted:

ValueDescription
WarmRestartOn-demand warm restart (SIGUSR1)
ManualRestartOn-demand cold restart (PodRestart)
ConfigChangedCold restart due to config change
ImageChangedCold restart due to image update
PodSpecChangedCold restart due to pod spec change

WarmRestart vs PodRestart

AspectWarmRestartPodRestart
MechanismSIGUSR1 signal to Aerospike processPod delete and recreate
DowntimeMinimal (process restarts in-place)Full pod lifecycle (terminate, schedule, start)
StorageVolumes remain mountedVolumes are detached and reattached
NetworkPod IP preservedPod may get a new IP
Use caseConfig reload, graceful restartStuck pods, volume reset, node migration
RiskLow -- process restarts cleanlyMedium -- pod rescheduling, possible migration
info

The cluster's rollingUpdateBatchSize does not apply to on-demand operations. Operations execute on all targeted pods according to the operator's internal sequencing.


Validation Rules

The webhook enforces these constraints on operations:

RuleConstraintError Message
Max operationsOnly 1 operation at a timeonly one operation allowed
ID length1--20 charactersid must be between 1 and 20 characters
In-progress lockCannot modify while InProgresscannot modify operations while InProgress

Events

The operator emits events for operation lifecycle:

ReasonTypeDescription
OperationNormalOperation started, pod restarted, or operation completed
PodWarmRestartedNormalPod received SIGUSR1
PodColdRestartedNormalPod deleted and recreated
kubectl -n aerospike get events \
--field-selector involvedObject.name=aerospike-3node,reason=Operation

Examples

Reload Configuration Across All Pods

apiVersion: acko.io/v1alpha1
kind: AerospikeCluster
metadata:
name: aerospike-3node
namespace: aerospike
spec:
size: 3
image: aerospike:ce-8.1.1.1
operations:
- kind: WarmRestart
id: "reload-config-mar10"
aerospikeConfig:
namespaces:
- name: test
replication-factor: 2
storage-engine:
type: memory

Cold Restart a Single Pod

spec:
operations:
- kind: PodRestart
id: "fix-pod-2"
podList:
- aerospike-3node-2

Warm Restart a Subset of Pods

spec:
operations:
- kind: WarmRestart
id: "reload-rack-1"
podList:
- aerospike-3node-0
- aerospike-3node-1

Best Practices

  1. Use descriptive operation IDs -- include a date or version reference (e.g., config-reload-mar10, fix-pod-2-v3) to make status tracking and event correlation easier.
  2. Prefer WarmRestart when possible -- it minimizes disruption and avoids pod rescheduling.
  3. Remove completed operations -- leaving stale operations in the spec does not cause problems, but keeping the spec clean avoids confusion.
  4. Check operation status before adding a new one -- the webhook rejects a second operation while one is InProgress.
  5. Use podList for targeted restarts -- avoid restarting the entire cluster when only one pod needs attention.