Skip to content

Commit bb227bc

Browse files
feat: add --network-volume-id flag to pod create and serverless create (#259)
allows attaching a network volume when creating pods (both GPU/GraphQL and CPU/REST paths) and serverless endpoints. closes #256
1 parent e244436 commit bb227bc

6 files changed

Lines changed: 22 additions & 2 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ This document exists for non-obvious, error-prone shortcomings in the codebase,
1919
- all text output must be lowercase and concise.
2020
- default output format is json (for agent consumption); never change this default.
2121
- e2e tests cost real money — always clean up resources with `t.Cleanup`.
22+
- always e2e test cli changes before considering work done: build the binary, run the new/changed commands against the live api (`RUNPOD_API_KEY` is in the env), and clean up any created resources immediately after verifying the response. this is non-negotiable.
2223
- keep the runpodctl skill in sync: https://github.com/runpod/skills/tree/main/runpodctl — update it whenever commands, flags, or behavior change.

cmd/pod/create.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ var (
5353
createCloudType string
5454
createDataCenterIDs string
5555
createSSH bool
56+
createNetworkVolumeID string
5657
)
5758

5859
func init() {
@@ -72,6 +73,7 @@ func init() {
7273
createCmd.Flags().StringVar(&createCloudType, "cloud-type", "SECURE", "cloud type (SECURE or COMMUNITY)")
7374
createCmd.Flags().StringVar(&createDataCenterIDs, "data-center-ids", "", "comma-separated list of data center ids")
7475
createCmd.Flags().BoolVar(&createSSH, "ssh", true, "enable ssh on the pod")
76+
createCmd.Flags().StringVar(&createNetworkVolumeID, "network-volume-id", "", "network volume id to attach")
7577
}
7678

7779
func runCreate(cmd *cobra.Command, args []string) error {
@@ -169,6 +171,10 @@ func createPodGraphQL(gpuTypeID, cloudType string, supportPublicIP bool) (map[st
169171
VolumeMountPath: createVolumeMountPath,
170172
}
171173

174+
if createNetworkVolumeID != "" {
175+
req.NetworkVolumeId = createNetworkVolumeID
176+
}
177+
172178
if createPorts != "" {
173179
req.Ports = createPorts
174180
}
@@ -219,6 +225,10 @@ func createPodREST(computeType, gpuTypeID, cloudType string, supportPublicIP boo
219225
req.GpuTypeIDs = []string{gpuTypeID}
220226
}
221227

228+
if createNetworkVolumeID != "" {
229+
req.NetworkVolumeID = createNetworkVolumeID
230+
}
231+
222232
if createPorts != "" {
223233
req.Ports = strings.Split(createPorts, ",")
224234
}

cmd/serverless/create.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ var (
2626
createGpuCount int
2727
createWorkersMin int
2828
createWorkersMax int
29-
createDataCenterIDs string
29+
createDataCenterIDs string
30+
createNetworkVolumeID string
3031
)
3132

3233
func init() {
@@ -38,6 +39,7 @@ func init() {
3839
createCmd.Flags().IntVar(&createWorkersMin, "workers-min", 0, "minimum number of workers")
3940
createCmd.Flags().IntVar(&createWorkersMax, "workers-max", 3, "maximum number of workers")
4041
createCmd.Flags().StringVar(&createDataCenterIDs, "data-center-ids", "", "comma-separated list of data center ids")
42+
createCmd.Flags().StringVar(&createNetworkVolumeID, "network-volume-id", "", "network volume id to attach")
4143

4244
createCmd.MarkFlagRequired("template-id") //nolint:errcheck
4345
}
@@ -66,6 +68,10 @@ func runCreate(cmd *cobra.Command, args []string) error {
6668
req.GpuTypeIDs = []string{gpuTypeID}
6769
}
6870

71+
if createNetworkVolumeID != "" {
72+
req.NetworkVolumeID = createNetworkVolumeID
73+
}
74+
6975
if createDataCenterIDs != "" {
7076
req.DataCenterIDs = strings.Split(createDataCenterIDs, ",")
7177
}

internal/api/endpoints.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ type EndpointCreateRequest struct {
3838
GpuCount int `json:"gpuCount,omitempty"`
3939
WorkersMin int `json:"workersMin,omitempty"`
4040
WorkersMax int `json:"workersMax,omitempty"`
41-
DataCenterIDs []string `json:"dataCenterIds,omitempty"`
41+
DataCenterIDs []string `json:"dataCenterIds,omitempty"`
42+
NetworkVolumeID string `json:"networkVolumeId,omitempty"`
4243
}
4344

4445
// EndpointUpdateRequest is the request to update an endpoint

internal/api/graphql.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ type CreatePodGQLInput struct {
234234
TemplateId string `json:"templateId,omitempty"`
235235
VolumeInGb int `json:"volumeInGb,omitempty"`
236236
VolumeMountPath string `json:"volumeMountPath,omitempty"`
237+
NetworkVolumeId string `json:"networkVolumeId,omitempty"`
237238
}
238239

239240
// CreatePod creates a pod via GraphQL (podFindAndDeployOnDemand)

internal/api/pods.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type PodCreateRequest struct {
5151
Env map[string]string `json:"env,omitempty"`
5252
CloudType string `json:"cloudType,omitempty"`
5353
DataCenterIDs []string `json:"dataCenterIds,omitempty"`
54+
NetworkVolumeID string `json:"networkVolumeId,omitempty"`
5455
}
5556

5657
// PodUpdateRequest is the request to update a pod

0 commit comments

Comments
 (0)