Class: Pangea::Kubernetes::Types::PersistentStateConfig
- Inherits:
-
Resources::BaseAttributes
- Object
- Resources::BaseAttributes
- Pangea::Kubernetes::Types::PersistentStateConfig
- Defined in:
- lib/pangea/kubernetes/types/persistent_state_config.rb
Overview
PersistentStateConfig — opt-in persistent state volume for a NixOS cluster node, decoupled from the EC2 instance lifecycle.
The aws_nixos backend (and any future backend that opts in) emits a separately-managed cloud volume (e.g., aws_ebs_volume) tagged with ‘<discovery_tag>=<cluster_name>`, with `lifecycle.prevent_destroy` ON. The volume survives ASG sleep/wake, instance replacement, and cluster recreation; only an explicit operator action can destroy it.
At first boot the cluster bootstrap (kindling) discovers the volume by tag, attaches it to the running instance, formats it if blank, and mounts it at ‘mount_path`. Subsequent boots (after sleep/wake or instance replacement) skip the format step and remount the existing filesystem.
AZ binding: an EBS volume is permanently bound to one AZ. When ‘persistent_state` is set, the system node pool’s ASG is constrained to that AZ. Multi-AZ persistent state is a different primitive (regional replication) and outside this type’s scope.
Mount path default ‘/var/lib/rancher/k3s` puts the k3s data dir on the persistent volume, so cluster state (etcd, registrations, workload state) survives instance churn.
Constant Summary collapse
- SUPPORTED_VOLUME_TYPES =
%w[gp3 gp2 io1 io2 st1 sc1].freeze
- SUPPORTED_FILESYSTEMS =
%w[ext4 xfs].freeze
Instance Method Summary collapse
Instance Method Details
#to_h ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/pangea/kubernetes/types/persistent_state_config.rb', line 82 def to_h hash = { size_gb: size_gb, volume_type: volume_type, mount_path: mount_path, filesystem: filesystem, discovery_tag: discovery_tag, encrypted: encrypted } hash[:kms_key_id] = kms_key_id if kms_key_id hash[:iops] = iops if iops hash[:throughput] = throughput if throughput hash[:availability_zone] = availability_zone if availability_zone hash end |