Skip to content

internal/controller: support offline ATLAS_TOKEN#333

Merged
masseelch merged 6 commits intomasterfrom
g/atlas-token-offline
Apr 1, 2026
Merged

internal/controller: support offline ATLAS_TOKEN#333
masseelch merged 6 commits intomasterfrom
g/atlas-token-offline

Conversation

@giautm
Copy link
Copy Markdown
Member

@giautm giautm commented Feb 6, 2026

No description provided.

@giautm giautm force-pushed the g/atlas-token-offline branch 3 times, most recently from 31284f1 to 991b4df Compare February 9, 2026 07:30
@masseelch masseelch force-pushed the g/atlas-token-offline branch 2 times, most recently from 7923f9d to 782a75c Compare March 16, 2026 18:25
@masseelch masseelch marked this pull request as ready for review March 16, 2026 19:17
@giautm giautm requested a review from Copilot March 16, 2026 21:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for “offline” Atlas Cloud tokens by persisting Atlas CLI state per resource (via a configurable data directory) and performing an explicit atlas login --grant-only when a token is provided.

Changes:

  • Extend the Atlas CLI client factory to accept cloud config + a per-resource “home” path and set HOME/ATLAS_TOKEN for Atlas CLI executions.
  • Perform cli.Login(...GrantOnly: true) during schema/migration reconciliation and lint flows when a Cloud token is present.
  • Add PVC-backed persistence wiring (PVC + DATA_DIR env + mount) to kustomize manager manifest and Helm chart; bump ariga.io/atlas dependency.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
internal/controller/common.go Expands AtlasExec/AtlasExecFn and configures CLI env (HOME, ATLAS_TOKEN) based on DATA_DIR and Cloud token.
internal/controller/lint.go Uses per-resource home and performs grant-only login before linting when token is present.
internal/controller/atlasschema_controller.go Uses new atlasClient signature and performs grant-only login before schema operations; passes namespace/name for home dir.
internal/controller/atlasmigration_controller.go Uses new atlasClient signature and performs grant-only login before migration operations; passes namespace/name for home dir.
internal/controller/testhelper.go Updates mock runner wiring for the new AtlasExecFn signature; adds Login to mock.
internal/controller/atlasschema_controller_test.go Updates atlasClient invocation signature in tests.
internal/controller/atlasmigration_controller_test.go Updates atlasClient invocation signature in tests.
config/manager/manager.yaml Adds a PVC and mounts it at /data, setting DATA_DIR to persist Atlas state.
charts/atlas-operator/values.yaml Adds persistence configuration values.
charts/atlas-operator/templates/pvc.yaml Adds an optional PVC template controlled by persistence.enabled.
charts/atlas-operator/templates/deployment.yaml Wires persistence volume/mount and DATA_DIR env into the Helm deployment template.
Dockerfile Removes HOME=/tmp workaround from the runtime image.
go.mod / go.sum Bumps ariga.io/atlas dependency version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@masseelch masseelch force-pushed the g/atlas-token-offline branch from f39c9c7 to b0d58af Compare March 18, 2026 08:26
@masseelch masseelch force-pushed the g/atlas-token-offline branch from af5a313 to be7ffe0 Compare March 20, 2026 11:24
Copy link
Copy Markdown
Member Author

@giautm giautm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,

@masseelch masseelch merged commit 1e4f7cd into master Apr 1, 2026
4 checks passed
@masseelch masseelch deleted the g/atlas-token-offline branch April 1, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants