Skip to content

Conversation

@gatici
Copy link
Contributor

@gatici gatici commented Dec 8, 2025

Description of issue or feature:

This PR allows Opensearch to use with Google Cloud storage to store snapshots or restore them.
With this change, operators can use a gcs-integrator relation to:

  • create backups (snapshots) into a GCS bucket
  • list existing backups
  • restore backups from GCS
    in the same way they already do with S3 and Azure.

Solution:

GCS Integration

  • Introduced a gcs relation endpoint (GCS_RELATION) and integrated it into the snapshots flow alongside the existing S3 and Azure backends.
  • Extended OpenSearchSnapshotsManager to support ObjectStorageType.GCS:
    • build the repository settings for GCS based on the relation data.
    • call ensure_repository + verify_repository(ObjectStorageType.GCS) to validate connectivity and permissions.
    • reused the existing pre-check logic (leader checks, health, running operations) so GCS behaves consistently with S3/Azure.

How was this change tested?

  • Manually
  • Unit tests
  • Integration tests

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

@gatici gatici changed the title feat: add gcs integration for snapshots feat: support GCS repository for snapshot operations Dec 8, 2025
Copy link
Contributor

@skourta skourta left a comment

Choose a reason for hiding this comment

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

Thank you @gatici! I left some comments


logger.info("Setting up configuration for gcs-integrator charm...")
await ops_test.model.applications[GCS_INTEGRATOR].set_config(full_cfg)
await ops_test.model.wait_for_idle(apps=[GCS_INTEGRATOR], timeout=TIMEOUT)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use wait_until

Copy link
Contributor Author

@gatici gatici Jan 13, 2026

Choose a reason for hiding this comment

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

The wait_until expects an app status and if we do not provide, it is counted as active. Here we do not want to check the app status as this is a generic helper. We only want to check if juju finishes all work and model reaches a stable state. The status checks are done in the test cases.

Copy link
Contributor

@akram09 akram09 left a comment

Choose a reason for hiding this comment

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

Thanks @gatici !

gatici added 18 commits January 13, 2026 16:12
Signed-off-by: gatici <[email protected]>

# Conflicts:
#	lib/charms/opensearch/v0/opensearch_snapshots.py
Copy link
Contributor

@Mehdi-Bendriss Mehdi-Bendriss left a comment

Choose a reason for hiding this comment

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

Thanks Gulsum, great work! We're already seeing the result of the refactor :)


def write_gcs_service_account_json(
secret_key: str,
dst: str = "/var/snap/opensearch/common/home/snap_daemon/service_account.json",
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this and next function as a broad helpers, as we're ultimately just writing/deleting a text file (which is also not k8s compatible), feel free to use opensearch.write_file as those will ultimately be moved to the Workload class

@gatici gatici requested a review from Mehdi-Bendriss January 13, 2026 19:41
Signed-off-by: gatici <[email protected]>
Mehdi-Bendriss
Mehdi-Bendriss previously approved these changes Jan 14, 2026
Copy link
Contributor

@Mehdi-Bendriss Mehdi-Bendriss left a comment

Choose a reason for hiding this comment

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

Thanks Gulsum! I do have one question

skourta
skourta previously approved these changes Jan 14, 2026
Copy link
Contributor

@skourta skourta left a comment

Choose a reason for hiding this comment

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

Thank you for the hard work @gatici!

@gatici gatici dismissed stale reviews from skourta and Mehdi-Bendriss via bf83b52 January 14, 2026 14:01
@gatici gatici merged commit 64adb1e into 2/edge Jan 14, 2026
156 of 158 checks passed
@gatici gatici deleted the gcs-integration branch January 14, 2026 19:51
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.

4 participants