Skip to content

Add charm config for garm configurator#220

Merged
yhaliaw merged 11 commits into
mainfrom
feat/garm-config
Jun 3, 2026
Merged

Add charm config for garm configurator#220
yhaliaw merged 11 commits into
mainfrom
feat/garm-config

Conversation

@yhaliaw
Copy link
Copy Markdown
Collaborator

@yhaliaw yhaliaw commented Jun 2, 2026

What this PR does

Add charm configs for the garm configurator.
This includes the GitHub creds, and OpenStack creds/configs.

AI Summary

This pull request introduces robust configuration validation and state management to the garm-configurator charm, ensuring that all required OpenStack and GitHub App settings are present and valid before the charm becomes active. It adds a new charm_state.py module to encapsulate configuration logic, updates the charm to use this logic, expands the configuration schema, and adds comprehensive unit tests for all validation scenarios.

Configuration and Validation Improvements:

  • Added detailed configuration schema for OpenStack and GitHub App credentials in charmcraft.yaml, including support for Juju secrets for sensitive values.
  • Introduced a new charm_state.py module that defines strict validation logic for all configuration options and secrets, raising clear errors when misconfigured.
  • Updated the charm's main class (charm.py) to validate configuration on every config change and set the unit's status to Blocked or Active accordingly. [1] [2]

Testing Enhancements:

  • Greatly expanded unit tests to cover all validation cases, including missing, empty, or invalid configuration values and secrets, ensuring the charm's status accurately reflects configuration health.

Dependency Updates:

  • Added pydantic as a dependency for configuration validation and downgraded ops to version 3.7.0 for compatibility.

Why we need it

Part of the GARM charm feature set.

Checklist

  • Changes comply with the project's coding standards and guidelines (see CONTRIBUTING.md and STYLE.md)
  • CONTRIBUTING.md has been updated upon changes to the contribution/development process (e.g. changes to the way tests are run)
  • Technical author has been assigned to review the PR in case of documentation changes (usually *.md files)
  • I updated docs/changelog.md with user-relevant changes
  • I used AI to assist with preparing this PR
  • I added or updated tests as needed (unit and integration)
  • If integration test modules are used: I updated the workflow configuration
    (e.g., in .github/workflows/integration_tests.yaml, ensure the modules list is correct)
  • If this PR involves a Grafana dashboard: I added a screenshot of the dashboard
  • If this PR involves Terraform: terraform fmt passes and tflint reports no errors
  • If this PR involves Rockcraft: I updated the version

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 explicit charm configuration schema and validation for the garm-configurator charm, covering required OpenStack settings and GitHub App credentials (including Juju secret-backed values), and wires that validation into unit status reporting.

Changes:

  • Adds new charm_state.py module to parse/validate charm config and resolve Juju secrets, raising a structured error on misconfiguration.
  • Updates the charm to validate on config-changed and report Active/Blocked via collect-unit-status.
  • Expands charm config options in charmcraft.yaml, adds pydantic dependency, and significantly expands unit test coverage for validation cases.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/changelog.md Adds a dated entry documenting the new charm configuration support.
charms/garm-configurator/tox.toml Adds a fmt tox environment for isort + ruff format.
charms/garm-configurator/tests/unit/test_charm.py Adds extensive validation/status tests for OpenStack + GitHub App config/secrets.
charms/garm-configurator/src/charm.py Hooks config validation into events and reports unit status.
charms/garm-configurator/src/charm_state.py Introduces config models + validation and secret resolution logic.
charms/garm-configurator/requirements.txt Pins ops and adds pydantic.
charms/garm-configurator/charmcraft.yaml Defines new config options (including secret-typed options).
.gitignore Ignores .coverage artifact.

Comment thread charms/garm-configurator/src/charm.py Outdated
Comment thread charms/garm-configurator/src/charm_state.py Outdated
Comment thread charms/garm-configurator/src/charm_state.py Outdated
Comment thread charms/garm-configurator/tests/unit/test_charm.py Outdated
yhaliaw and others added 4 commits June 2, 2026 11:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

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

Minor comments, thank you!

Comment thread charms/garm-configurator/charmcraft.yaml Outdated
Comment thread charms/garm-configurator/requirements.txt Outdated
Comment thread charms/garm-configurator/charmcraft.yaml Outdated
Comment thread charms/garm-configurator/tests/unit/test_charm.py Outdated
@yhaliaw yhaliaw enabled auto-merge (squash) June 2, 2026 07:48
Copy link
Copy Markdown
Collaborator

@florentianayuwono florentianayuwono left a comment

Choose a reason for hiding this comment

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

lgtm tysm andrew!

auto-merge was automatically disabled June 2, 2026 13:52

Head branch was pushed to by a user without write access

Copilot AI requested a review from florentianayuwono June 2, 2026 13:52
@yhaliaw yhaliaw merged commit 82a40b5 into main Jun 3, 2026
63 checks passed
@yhaliaw yhaliaw deleted the feat/garm-config branch June 3, 2026 01:42
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.

6 participants