Skip to content

Introduce SGCP NFS driver and supporting infrastructure#1063

Open
cgalibern wants to merge 30 commits into
opensvc:mainfrom
cgalibern:sgcp
Open

Introduce SGCP NFS driver and supporting infrastructure#1063
cgalibern wants to merge 30 commits into
opensvc:mainfrom
cgalibern:sgcp

Conversation

@cgalibern

Copy link
Copy Markdown
Contributor

Description

This pull request introduces the SGCP NFS filesystem resource driver (resfssgcp_nfs) along with several related updates:

  • New SGCP NFS Driver (resfssgcp_nfs):

    • Added resfssgcp_nfs package to support NFS filesystem resources.
    • Introduced configuration parameters (e.g., UUID, host, permissions, protocol).
    • Implemented SGCP API integration with NFS client management methods (Start, Stop, Status).
    • Registered the driver and its keywords in driverdb and manifest.go.
  • SGCP API Enhancements:

    • Added FilesAPI to handle file-related SGCP operations.
    • Introduced configuration handling with a global config loader.
    • Enhanced API functionality with token caching via TokenFactory.
  • Refactoring and Utilities:

    • Refactored GetAuthInfo and added utilities for batch decoding of objects.
    • Split KeywordCheckRead in resfshost into enabled and disabled variants.
    • Introduced Outputter struct in ageing cache for output management.
  • Other Drivers:

    • Added implementations for resfssgcp_nfs_cg and resipsgcp_dnsalias drivers, including manifest registrations and keyword definitions.

cgalibern added 21 commits July 6, 2026 17:56
- Implemented the `resfssgcp_nfs` driver with manifest and capabilities registration.
- Added keyword definitions for UUID, host, permission, exclusive, protocol, secret, and endpoint.
- Embedded text descriptions for keywords to facilitate configuration and usage.
- Introduced `resfssgcp_nfs_cg` driver with capabilities and manifest registration.
- Defined keywords: `uuid`, `az`, `secret`, `endpoint`, `timeout`, and `failover`.
- Embedded text descriptions for keyword configurations.
…ord definitions

- Introduced `resipsgcp_dnsalias` driver with capabilities and manifest registration.
- Defined keywords: `uuid`, `name`, `target`, `zone_id`, `secret`, and `endpoint`.
- Added embedded text descriptions for keyword configurations to support DNS alias management.
- Defined `AuthInfo` struct to encapsulate authentication details (Account ID, Client ID, Client Secret, Signature).
- Implemented `GetAuthInfo` function to retrieve and decode auth details from a datastore path.
- Introduced `Outputter` struct to encapsulate output function logic.
- Added `NewOutputter` constructor and `Output` method for output generation.
- Updated `unix.Major` and `unix.Minor` to explicitly cast `stat1.Rdev` and `stat2.Rdev` to `uint64`.
- Modified `ApplyProc` function to include a boolean return value for success indication alongside the error.
…on management

- Introduced `Config` struct to centralize SGCP API configuration (files, DNS, auth, cache).
- Added utility methods for configuration loading, cloning, and access (e.g., `GetConfig`, `LoadConfig`).
- Implemented tests for configuration behavior and validation.
- Included embedded configuration example in YAML format for reference and testing.
- Introduced `Api` struct to centralize HTTP client logic for SGCP.
- Implemented `do` and `CheckStatusCode` methods for making authenticated requests and handling response codes.
- Added comprehensive tests to validate the new API functionality.
- Introduced `TokenFactory` to handle token generation and caching for SGCP API authentication.
- Implemented `Get` and `Clear` methods for token retrieval and cache invalidation.
- Added tests to validate token generation, caching behavior, and edge cases.
- Introduced `FilesAPI` for handling SGCP file-related operations, including NFS client management.
- Added methods and utilities for constructing URLs, executing HTTP requests, and managing scopes.
- Implemented corresponding tests to validate API logic and HTTP interactions.
…y function

- Added `DisabledFlag` field to the `Config` struct for managing SGCP service disablement via a file path.
- Introduced `IsDisabled` function to check the presence of the disable flag using the configured path.
- Updated configuration example to include the new `disabled_flag` field.
…lation

- Introduced `GetAuthInfoFromDatastorePather` struct to encapsulate the `GetAuthInfo` logic as a method.
… and tests

- Introduced `resfssgcp_nfs` package to provide SGCP NFS filesystem resource driver.
- Implemented NFS client management with support for exclusive mode, API integration, and caching.
- Added comprehensive test coverage, including configuration validation and resource lifecycle scenarios.
- Updated `manifest.go` to include keywords for underlying filesystem resource.
… in configuration

- Added validation for `secret` and `endpoint` fields, ensuring they are specified either in the task or configuration file.
- Adjusted configuration logic to set default values or return appropriate error messages if missing.
cgalibern added 8 commits July 6, 2026 20:05
- Moved test configuration logic to a new `testsgcphelper` package.
- Replaced `LoadConfig` with a thread-safe `GetConfig` function.
- Introduced `SetConfigForTest` for managing test configurations.
- Updated test cases to use the refactored configuration logic.
… setup

- Added validation for mandatory SGCP config file in `Configure` method.
- Introduced `Setup` helper for managing test configuration state.
- Enhanced test cases to validate error handling and configuration prerequisites.
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.

1 participant