Skip to content

Commit 8fda1a8

Browse files
author
Zach Source
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#295
1 parent 17937d6 commit 8fda1a8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cluster/kube/client.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -935,13 +935,15 @@ func (c *client) ServiceStatus(ctx context.Context, lid mtypes.LeaseID, name str
935935
return nil, kubeclienterrors.ErrNoServiceForLease
936936
}
937937

938+
// Check if this service uses persistent storage (should be StatefulSet)
939+
// This logic must match the deployment creation logic in Deploy()
938940
isDeployment := true
939-
if params := svc.Params; params != nil {
940-
for _, param := range params.Storage {
941-
if param.Mount != "" {
942-
isDeployment = false
943-
break
944-
}
941+
persistent := false
942+
for i := range svc.Resources.Storage {
943+
attrVal := svc.Resources.Storage[i].Attributes.Find(sdl.StorageAttributePersistent)
944+
if persistent, _ = attrVal.AsBool(); persistent {
945+
isDeployment = false
946+
break
945947
}
946948
}
947949

0 commit comments

Comments
 (0)