Skip to content

Commit

Permalink
feat: support only handling volume only mode
Browse files Browse the repository at this point in the history
With `CLOUD_AGENT_VOLUME_ONLY` only volumes and _not_
machines are reconciled.

Signed-off-by: Chris Goller <[email protected]>
  • Loading branch information
goller committed Dec 17, 2024
1 parent a545429 commit 8f0414d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CLOUD_AGENT_CONNECTION_ID,
CLOUD_AGENT_PROVIDER,
CLOUD_AGENT_VERSION,
CLOUD_AGENT_VOLUME_ONLY,
} from './utils/env'
import {client} from './utils/grpc'
import {logger} from './utils/logger'
Expand Down Expand Up @@ -48,15 +49,18 @@ async function main() {
process.exit(1)
}

switch (CLOUD_AGENT_PROVIDER) {
case 'fly':
startStateStream(signal, FlyProvider)
break
case 'aws':
startStateStream(signal, AwsProvider)
break
default:
startStateStream(signal, AwsProvider)
// Volume only mode only handles ceph volume requests.
if (!CLOUD_AGENT_VOLUME_ONLY) {
switch (CLOUD_AGENT_PROVIDER) {
case 'fly':
startStateStream(signal, FlyProvider)
break
case 'aws':
startStateStream(signal, AwsProvider)
break
default:
startStateStream(signal, AwsProvider)
}
}

startUpdater(signal)
Expand Down
1 change: 1 addition & 0 deletions src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ config()

// CLOUD_AGENT_PROVIDER defines the cloud provider. It defaults to 'aws' but can be 'fly'.
export const CLOUD_AGENT_PROVIDER = process.env.CLOUD_AGENT_PROVIDER ?? 'aws'
export const CLOUD_AGENT_VOLUME_ONLY = process.env.CLOUD_AGENT_VOLUME_ONLY

export const CLOUD_AGENT_API_URL = process.env.CLOUD_AGENT_API_URL ?? 'https://api.depot.dev'

Expand Down

0 comments on commit 8f0414d

Please sign in to comment.