Skip to content

Commit d997254

Browse files
committed
refactor(swap_encryption/pr1): correct PKB structure - swap_config as NodepoolSpec field
BREAKING: replaces SwapNodePool (standalone nodepool lifecycle) with the correct PKB pattern: swap configuration declared in BENCHMARK_CONFIG and applied by the existing GKE cluster creation flow. New files: - resources/container_service/swap_config.py - GkeSwapConfig(BaseResource): WriteLinuxConfigYaml(), ValidHyperdiskThroughput() - EksSwapConfig(BaseResource): stub for nodeadm config (deferred to PR #6780) Core framework changes: - configs/container_spec.py: add SwapConfigSpec(BaseSpec) + _SwapConfigDecoder + swap_config field on NodepoolSpec - resources/container_service/container.py: add swap_config attr to BaseNodePoolConfig - resources/container_service/container_cluster.py: propagate swap_config in _InitializeNodePool() (mirrors sandbox_config pattern) - providers/gcp/google_kubernetes_engine.py: _AddNodeParamsToCmd() reads nodepool_config.swap_config - applies --system-config-from-file, UBUNTU_CONTAINERD, --no-enable-autorepair, boot-disk-provisioned-iops/throughput Thin benchmark: - BENCHMARK_CONFIG declares benchmark nodepool with swap_config (no separate nodepool create needed - GKE cluster creation handles it) - Prepare(): deploy SwapDaemonSet + delete default-pool - Run(): verify swap_active + swap_encrypted; report samples - Cleanup(): empty (PKB auto-deletes spec.resources) Addresses Ajay reviews: - r3457826290: swap as base resource plugged into GKE cluster creation flow - r3457877984: linuxConfig.swapConfig via --system-config-from-file (GkeSwapConfig) - r3457928855: removed memory.swap.max hack - r3457964593: UBUNTU_CONTAINERD set per-nodepool in _AddNodeParamsToCmd - r3472513706: swapConfig auto-enables memorySwapBehavior=LimitedSwap - r3472549985: UBUNTU_CONTAINERD required for dm-crypt
1 parent 1befef2 commit d997254

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

perfkitbenchmarker/linux_benchmarks/swap_encryption_benchmark.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,18 @@
8888
'Override disk type for the benchmark nodepool.',
8989
)
9090

91+
_DAEMONSET_IMAGE = flags.DEFINE_string(
92+
'swap_encryption_daemonset_image',
93+
'ubuntu:22.04',
94+
'Container image for the privileged benchmark DaemonSet.',
95+
)
96+
9197
_BenchmarkSpec = benchmark_spec.BenchmarkSpec
9298
_BENCHMARK_NODEPOOL = 'benchmark'
9399
_DEFAULT_POOL = 'default-pool'
100+
_DS_NAME = 'pkb-swap-benchmark'
101+
_DS_NAMESPACE = 'default'
102+
_DS_LABEL = 'pkb-swap-benchmark'
94103

95104

96105
def GetConfig(user_config: dict[str, Any]) -> dict[str, Any]:
@@ -124,7 +133,13 @@ def Prepare(spec: _BenchmarkSpec) -> None:
124133
spec: PKB BenchmarkSpec with spec.container_cluster already created.
125134
"""
126135
cluster = spec.container_cluster
127-
daemonset = swap_daemonset.SwapDaemonSet(cluster=cluster)
136+
daemonset = swap_daemonset.SwapDaemonSet(
137+
name=_DS_NAME,
138+
namespace=_DS_NAMESPACE,
139+
label=_DS_LABEL,
140+
nodepool=_BENCHMARK_NODEPOOL,
141+
image=_DAEMONSET_IMAGE.value,
142+
)
128143
daemonset.Create()
129144
spec.resources.append(daemonset)
130145
pod = daemonset.WaitForPod()

0 commit comments

Comments
 (0)