Skip to content

chore: refactor provider config reconciliation#240

Open
yanksyoon wants to merge 13 commits into
mainfrom
chore/refactor-garm-configuration-reconcile
Open

chore: refactor provider config reconciliation#240
yanksyoon wants to merge 13 commits into
mainfrom
chore/refactor-garm-configuration-reconcile

Conversation

@yanksyoon

Copy link
Copy Markdown
Member

What this PR does

  • Refactor reconciliation of provider configuration for easier read of controller function

Why we need it

  • Reduce cognitive load on restart(reconcile) function.

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

florentianayuwono and others added 13 commits June 17, 2026 14:43
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ation databag

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…armState

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rator relation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…efer

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… error

The function was imported via 'from charms.tests.integration.conftest import ...'
which fails collection (ModuleNotFoundError: No module named 'charms').
Move the function directly into test_garm.py where it is used.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… client

Refactor garm_api.py, scaleset_reconciler.py, and related charm/test
code to use the generated garm_client OpenAPI client from main instead
of the hand-written urllib wrapper.

Key changes:
- Extend GarmApiClient (main) with login() using generated LoginApi
- Add GarmAuthenticatedClient for scaleset/provider/org/repo operations
- Remove credentials_name from ScalesetSpec (not in GARM scaleset API)
- Rename image_id -> image in ScalesetSpec (matches GARM API field name)
- Add entity_type/entity_name to ScalesetSpec for org/repo scoped creation
- Reconciler now calls create_org_scaleset/create_repo_scaleset
- Reconciler defers on missing provider OR entity (org/repo not in GARM)
- GARM charm uses GARM_ADMIN_CREDENTIALS_LABEL (separate secret) for creds
- Configurator writes org/repo fields to relation databag
- All unit tests updated for new API design (99 passing)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@cbartz cbartz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM . It is technically a behaviour change (we no longer skip restart when hashes match - so no short circuit) , so consider adding this info to the PR description.

@cbartz cbartz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you

Comment thread charms/garm/src/charm.py
if previous_hash == new_hash:
logger.debug("TOML config unchanged; skipping restart")
return
return new_hash

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the l439 is no longer true - we no longer skip restart (restart is in l401)

Comment thread charms/garm/src/charm.py
self.unit.status = ops.WaitingStatus("Waiting for postgresql relation")
return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nitpick: remove the whitespace.

Base automatically changed from feat/garm-scaleset-isd-5729 to main June 26, 2026 07:11
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