Skip to content

Commit afa8a43

Browse files
committed
Merge branch 'main' into pyadagiri/ha
2 parents 7e662be + 6b34dfb commit afa8a43

70 files changed

Lines changed: 7587 additions & 347 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ upgrade_godo: _upgrade_godo vendor mocks
149149
vendor:
150150
@echo "==> vendor dependencies"
151151
@echo ""
152-
go mod vendor
153152
go mod tidy
153+
go mod vendor
154154

155155
.PHONY: clean
156156
clean:

args.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ const (
4848
ArgAppJobName = "job-name"
4949
// ArgAppJobInvocation is the job invocation ID.
5050
ArgAppJobInvocation = "job-invocation"
51+
// ArgAppEventID is the event ID.
52+
ArgAppEventID = "event-id"
53+
// ArgAppEventType is the event type filter.
54+
ArgAppEventType = "event-type"
5155
// ArgAppInstanceName is the instance name of currently running instances (optional).
5256
ArgAppInstanceName = "instance-name"
5357
// ArgAppDevConfig is the path to the app dev link config.
@@ -161,6 +165,14 @@ const (
161165
ArgEnableNvidiaGpuDevicePlugin = "enable-nvidia-gpu-device-plugin"
162166
// ArgEnableRDMASharedDevicePlugin enables automatic NVIDIA gpu device plugin installation.
163167
ArgEnableRDMASharedDevicePlugin = "enable-rdma-shared-device-plugin"
168+
// ArgKubernetesEnableSSO enables SSO as a method of authentication for the DOKS cluster.
169+
ArgKubernetesEnableSSO = "sso-enabled"
170+
// ArgKubernetesRequireSSO requires SSO as the only method of authentication for the DOKS cluster.
171+
ArgKubernetesRequireSSO = "sso-required"
172+
// ArgKubernetesSSOIssuerURL is the OIDC issuer URL for cluster SSO configuration.
173+
ArgKubernetesSSOIssuerURL = "sso-issuer-url"
174+
// ArgKubernetesSSOClientID is the OIDC client ID for cluster SSO configuration.
175+
ArgKubernetesSSOClientID = "sso-client-id"
164176
// ArgSurgeUpgrade is a cluster's surge-upgrade argument.
165177
ArgSurgeUpgrade = "surge-upgrade"
166178
// ArgCommandUpsert is an upsert for a resource to be created or updated argument.
@@ -185,6 +197,8 @@ const (
185197
ArgKubernetesAlias = "alias"
186198
// ArgKubeConfigExpirySeconds indicates the length of time the token in a kubeconfig will be valid in seconds.
187199
ArgKubeConfigExpirySeconds = "expiry-seconds"
200+
// ArgKubeConfigType selects the kubeconfig authentication mechanism: token, sso, or unset for the API default.
201+
ArgKubeConfigType = "type"
188202
// ArgImage is an image argument.
189203
ArgImage = "image"
190204
// ArgImageID is an image id argument.
@@ -221,6 +235,8 @@ const (
221235
ArgIPv6 = "enable-ipv6"
222236
// ArgPrivateNetworking is an enable private networking argument.
223237
ArgPrivateNetworking = "enable-private-networking"
238+
// ArgPublicNetworking is an enable public networking argument.
239+
ArgPublicNetworking = "enable-public-networking"
224240
// ArgMonitoring is an enable monitoring argument.
225241
ArgMonitoring = "enable-monitoring"
226242
// ArgDropletAgent is an argument for enabling/disabling the Droplet agent.
@@ -713,6 +729,9 @@ const (
713729
// ArgTags are the tags applied to the agent.
714730
ArgTags = "tags"
715731

732+
// ArgWorkspaceUuid is the UUID of the workspace the agent belongs to.
733+
ArgWorkspaceUuid = "workspace-uuid"
734+
716735
// ArgAgentForce forces agent deletion without confirmation.
717736
ArgAgentForce = "force"
718737

@@ -835,4 +854,24 @@ const (
835854

836855
// ArgOpenAIKeyAPIKey is the API key for the OpenAI API Key
837856
ArgOpenAIKeyAPIKey = "api-key"
857+
858+
// Dedicated Inference Args
859+
860+
// ArgDedicatedInferenceSpec is the path to a dedicated inference spec file.
861+
ArgDedicatedInferenceSpec = "spec"
862+
863+
// ArgDedicatedInferenceHuggingFaceToken is the Hugging Face token (optional).
864+
ArgDedicatedInferenceHuggingFaceToken = "hugging-face-token"
865+
866+
// ArgDedicatedInferenceAcceleratorSlug filters accelerators by slug (optional).
867+
ArgDedicatedInferenceAcceleratorSlug = "slug"
868+
869+
// ArgDedicatedInferenceRegion filters dedicated inferences by region (optional).
870+
ArgDedicatedInferenceRegion = "region"
871+
872+
// ArgDedicatedInferenceName filters dedicated inferences by name (optional).
873+
ArgDedicatedInferenceName = "name"
874+
875+
// ArgDedicatedInferenceTokenName is the name for a dedicated inference auth token.
876+
ArgDedicatedInferenceTokenName = "token-name"
838877
)

commands/apps.go

Lines changed: 128 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ Only basic information is included with the text output format. For complete app
201201
displayerType(&displayers.JobInvocations{}),
202202
)
203203

204-
AddStringSliceFlag(listJobInvocations, doctl.ArgAppDeployment, "", []string{}, "The deployment ID to filter job invocations for. If not provided, all job invocations for given app are returned.")
205-
AddStringSliceFlag(listJobInvocations, doctl.ArgAppJobName, "", []string{}, "The job name to filter job invocations for. If not provided, all job invocations for given app are returned.")
204+
AddStringFlag(listJobInvocations, doctl.ArgAppDeployment, "", "", "The deployment ID to filter job invocations for. If not provided, all job invocations for given app are returned.")
205+
AddStringFlag(listJobInvocations, doctl.ArgAppJobName, "", "", "The job name to filter job invocations for. If not provided, all job invocations for given app are returned.")
206206

207207
listJobInvocations.Example = `The following example retrieves the list of job invocations for the app with the ID ` + "`" + `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` + "`" + ` and the deployment ID ` + "`" + `418b7972-fc67-41ea-ab4b-6f9477c4f7d8` + "`" + ` and the job ` + "`" + `cron` + "`" + `: doctl apps list-job-invocations f81d4fae-7dec-11d0-a765-00a0c91e6bf6 --job-name cron --deployment 418b7972-fc67-41ea-ab4b-6f9477c4f7d8`
208208

@@ -232,20 +232,64 @@ Only basic information is included with the text output format. For the complete
232232
displayerType(&displayers.JobInvocations{}),
233233
)
234234

235+
listEvents := CmdBuilder(
236+
cmd,
237+
RunAppsListEvents,
238+
"list-events <app id>",
239+
"List app events",
240+
`Lists all events for the given app, including deployments and autoscaling events.
241+
242+
Only basic information is included with the text output format. For the complete event details, use the `+"`"+`--output`+"`"+` global flag and specify the JSON format.`,
243+
Writer,
244+
aliasOpt("lse"),
245+
displayerType(&displayers.Events{}),
246+
)
247+
AddStringSliceFlag(listEvents, doctl.ArgAppEventType, "", []string{}, "Filter events by type (e.g. DEPLOYMENT, AUTOSCALING).")
248+
249+
listEvents.Example = `The following example retrieves the list of events for the app with the ID ` + "`" + `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` + "`" + `: doctl apps list-events f81d4fae-7dec-11d0-a765-00a0c91e6bf6`
250+
251+
CmdBuilder(
252+
cmd,
253+
RunAppsCancelEvent,
254+
"cancel-event <app id> <event id>",
255+
"Cancel an event",
256+
`Cancels an in-progress autoscaling event for the given app.
257+
258+
Only basic information is included with the text output format. For the complete event details, use the `+"`"+`--output`+"`"+` global flag and specify the JSON format.`,
259+
Writer,
260+
aliasOpt("ce"),
261+
displayerType(&displayers.Events{}),
262+
)
263+
264+
CmdBuilder(
265+
cmd,
266+
RunAppsGetEvent,
267+
"get-event <app id> <event id>",
268+
"Get an event",
269+
`Gets a single event for the given app.
270+
271+
Only basic information is included with the text output format. For the complete event details, use the `+"`"+`--output`+"`"+` global flag and specify the JSON format.`,
272+
Writer,
273+
aliasOpt("ge"),
274+
displayerType(&displayers.Events{}),
275+
)
276+
235277
logs := CmdBuilder(
236278
cmd,
237279
RunAppsGetLogs,
238280
"logs <app name or id> <component name (defaults to all components)>",
239281
"Retrieves logs",
240-
`Retrieves component logs for a deployment or a job invocation of an app.
282+
`Retrieves component logs for a deployment, a job invocation, or an autoscaling event of an app.
241283
242-
Three types of logs are supported and can be specified with the --`+doctl.ArgAppLogType+` flag:
284+
These types of logs are supported and can be specified with the --`+doctl.ArgAppLogType+` flag:
243285
- build
244286
- deploy
245287
- run
246288
- run_restarted
289+
- autoscale_event
247290
248291
To retrieve job invocation logs, pass the job invocation ID with the --`+doctl.ArgAppJobInvocation+` flag.
292+
To retrieve autoscaling event logs, pass the event ID with the --`+doctl.ArgAppEventID+` flag.
249293
250294
For more information about logs, see [How to View Logs](https://www.digitalocean.com/docs/app-platform/how-to/view-logs/).
251295
`,
@@ -254,6 +298,7 @@ For more information about logs, see [How to View Logs](https://www.digitalocean
254298
)
255299
AddStringFlag(logs, doctl.ArgAppDeployment, "", "", "Retrieves logs for a specific deployment ID. Defaults to current deployment.")
256300
AddStringFlag(logs, doctl.ArgAppJobInvocation, "", "", "Retrieves logs for a specific job invocation ID.")
301+
AddStringFlag(logs, doctl.ArgAppEventID, "", "", "Retrieves logs for a specific autoscaling event ID.")
257302
AddStringFlag(logs, doctl.ArgAppLogType, "", strings.ToLower(string(godo.AppLogTypeRun)), "Retrieves logs for a specific log type. Defaults to run logs.")
258303
AddBoolFlag(logs, doctl.ArgAppLogFollow, "f", false, "Returns logs as they are emitted by the app.")
259304
AddIntFlag(logs, doctl.ArgAppLogTail, "", -1, "Specifies the number of lines to show from the end of the log.")
@@ -727,6 +772,11 @@ func RunAppsGetLogs(c *CmdConfig) error {
727772
return err
728773
}
729774

775+
eventID, err := c.Doit.GetString(c.NS, doctl.ArgAppEventID)
776+
if err != nil {
777+
return err
778+
}
779+
730780
_, err = uuid.Parse(appID)
731781
if err != nil || deploymentID == "" {
732782
app, err := c.Apps().Find(appID)
@@ -736,7 +786,7 @@ func RunAppsGetLogs(c *CmdConfig) error {
736786

737787
appID = app.ID
738788

739-
if deploymentID == "" {
789+
if deploymentID == "" && eventID == "" {
740790
if app.ActiveDeployment != nil {
741791
deploymentID = app.ActiveDeployment.ID
742792
} else if app.InProgressDeployment != nil {
@@ -761,9 +811,11 @@ func RunAppsGetLogs(c *CmdConfig) error {
761811
logType = godo.AppLogTypeRun
762812
case strings.ToLower(string(godo.AppLogTypeRunRestarted)):
763813
logType = godo.AppLogTypeRunRestarted
814+
case strings.ToLower(string(godo.AppLogTypeAutoscaleEvent)):
815+
logType = godo.AppLogTypeAutoscaleEvent
764816
default:
765-
// if jobInvocationID is provided, we can skip the logType validation as logType will be set to JOB_INVOCATION
766-
if jobInvocationID == "" {
817+
// if jobInvocationID or eventID is provided, we can skip the logType validation
818+
if jobInvocationID == "" && eventID == "" {
767819
return fmt.Errorf("Invalid log type %s", logTypeStr)
768820
}
769821
}
@@ -782,7 +834,14 @@ func RunAppsGetLogs(c *CmdConfig) error {
782834
}
783835

784836
var logs *godo.AppLogs
785-
if jobInvocationID != "" {
837+
if eventID != "" {
838+
opts := &godo.GetEventLogsOptions{
839+
Follow: logFollow,
840+
TailLines: logTail,
841+
}
842+
843+
logs, err = c.Apps().GetEventLogs(appID, eventID, opts)
844+
} else if jobInvocationID != "" {
786845
if component == "" {
787846
return fmt.Errorf("component name is required when job invocation id is provided")
788847
}
@@ -1419,7 +1478,10 @@ func RunAppsListJobInvocations(c *CmdConfig) error {
14191478

14201479
opts := &godo.ListJobInvocationsOptions{
14211480
DeploymentID: deploymentID,
1422-
JobNames: []string{jobName},
1481+
}
1482+
1483+
if jobName != "" {
1484+
opts.JobNames = []string{jobName}
14231485
}
14241486

14251487
invocations, err := c.Apps().ListJobInvocations(appID, opts)
@@ -1483,3 +1545,60 @@ func RunAppsCancelJobInvocation(c *CmdConfig) error {
14831545

14841546
return c.Display(displayers.JobInvocations{jobInvocation})
14851547
}
1548+
1549+
// RunAppsListEvents lists all events for an app.
1550+
func RunAppsListEvents(c *CmdConfig) error {
1551+
if len(c.Args) < 1 {
1552+
return doctl.NewMissingArgsErr(c.NS)
1553+
}
1554+
appID := c.Args[0]
1555+
1556+
eventTypes, err := c.Doit.GetStringSlice(c.NS, doctl.ArgAppEventType)
1557+
if err != nil {
1558+
return err
1559+
}
1560+
1561+
opts := &godo.ListEventsOptions{}
1562+
if len(eventTypes) > 0 {
1563+
opts.EventTypes = eventTypes
1564+
}
1565+
1566+
events, err := c.Apps().ListEvents(appID, opts)
1567+
if err != nil {
1568+
return err
1569+
}
1570+
1571+
return c.Display(displayers.Events(events))
1572+
}
1573+
1574+
// RunAppsCancelEvent cancels an in-progress autoscaling event.
1575+
func RunAppsCancelEvent(c *CmdConfig) error {
1576+
if len(c.Args) < 2 {
1577+
return doctl.NewMissingArgsErr(c.NS)
1578+
}
1579+
appID := c.Args[0]
1580+
eventID := c.Args[1]
1581+
1582+
event, err := c.Apps().CancelEvent(appID, eventID)
1583+
if err != nil {
1584+
return err
1585+
}
1586+
1587+
return c.Display(displayers.Events{event})
1588+
}
1589+
1590+
// RunAppsGetEvent retrieves a single event for an app.
1591+
func RunAppsGetEvent(c *CmdConfig) error {
1592+
if len(c.Args) < 2 {
1593+
return doctl.NewMissingArgsErr(c.NS)
1594+
}
1595+
appID := c.Args[0]
1596+
eventID := c.Args[1]
1597+
1598+
event, err := c.Apps().GetEvent(appID, eventID)
1599+
if err != nil {
1600+
return err
1601+
}
1602+
1603+
return c.Display(displayers.Events{event})
1604+
}

0 commit comments

Comments
 (0)