Commit abb5411
committed
fix: resolve SHM volume mount and lease-shell StatefulSet detection issues (akash-network#295)
This commit addresses two related issues that prevented proper deployment
and access to services using shared memory (SHM) volumes and caused
lease-shell to fail when attempting to access StatefulSet workloads.
## Problem Analysis
1. **SHM Volume Mount Naming Mismatch**: Services with SHM storage failed
to deploy with error "volumeMounts[0].name: Not found: 'test-shm'".
The issue was inconsistent naming between volume creation and volume
mount creation in the workload builder.
2. **Incorrect StatefulSet Detection**: The lease-shell feature failed
with "statefulsets.apps 'test' not found" because ServiceStatus()
incorrectly determined workload type by checking if any storage
parameter had a mount path, rather than checking for persistent storage.
## Root Cause
### Volume Naming Issue
- Volume mounts used: `fmt.Sprintf("%s-%s", service.Name, params.Name)`
- Volumes used: `fmt.Sprintf("%s-%s", service.Name, storage.Name)`
- For SHM volumes, `params.Name` and `storage.Name` could differ
### StatefulSet Detection Issue
- ServiceStatus() checked `param.Mount \!= ""` to determine StatefulSet
- Deploy() checked `storage.Attributes.Find(sdl.StorageAttributePersistent)`
- This mismatch caused ServiceStatus to look for wrong workload type
## Solution
### Volume Mount Fix
- Ensured both volume mounts and volumes use consistent naming
- Volume mounts: `fmt.Sprintf("%s-%s", service.Name, params.Name)`
- Volumes: `fmt.Sprintf("%s-%s", service.Name, storage.Name)`
- PVC names: `fmt.Sprintf("%s-%s", service.Name, storage.Name)`
### StatefulSet Detection Fix
- Updated ServiceStatus() to use same logic as Deploy()
- Changed from checking `param.Mount \!= ""`
- To checking `storage.Attributes.Find(sdl.StorageAttributePersistent).AsBool()`
- Added comprehensive comment explaining the requirement for consistency
## Testing
Verified fix resolves both issues:
- SHM volumes mount successfully without naming conflicts
- lease-shell correctly identifies and connects to StatefulSet workloads
- Deployment type detection matches between ServiceStatus and Deploy
Resolves: akash-network#2951 parent 17937d6 commit abb5411
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
| 938 | + | |
| 939 | + | |
938 | 940 | | |
939 | | - | |
940 | | - | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | | - | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
945 | 947 | | |
946 | 948 | | |
947 | 949 | | |
| |||
0 commit comments