Skip to content

feat: set up basic charm functionality#4

Merged
florentianayuwono merged 59 commits into
mainfrom
feat/create-aproxy-charm-ISD-4148
Oct 8, 2025
Merged

feat: set up basic charm functionality#4
florentianayuwono merged 59 commits into
mainfrom
feat/create-aproxy-charm-ISD-4148

Conversation

@florentianayuwono

@florentianayuwono florentianayuwono commented Sep 12, 2025

Copy link
Copy Markdown
Collaborator

Applicable spec: ISD249 - Aproxy Subordinate Charm

Overview

Introduces the implementation of the Aproxy Charm, a subordinate charm designed to manage the aproxy snap. The charm configures and applies nftables rules to intercept outbound HTTP/HTTPS traffic and forward it through the aproxy service. It includes event handlers for lifecycle events (install, start, config_changed, and stop) and ensures proper configuration and cleanup of the aproxy service.

Rationale

To provide transparent proxying capabilities for applications. It ensures that outbound traffic is intercepted and routed through a proxy, enabling centralized traffic management and monitoring.

Juju Events Changes

Added Observers:

  • on.install: Handles the installation of the aproxy snap.
  • on.start: Configures nftables rules and starts the interception service.
  • on.config_changed: Reconfigures the aproxy snap and updates nftables rules when charm configuration changes.
  • on.stop: Cleans up nftables rules and removes the aproxy snap during charm removal.

Module Changes

Service Module:

  • Introduced _on_install, _on_start, _on_config_changed, and _on_stop methods to handle Juju lifecycle events.
  • Added helper methods to encapsulate logic for configuring the aproxy snap and managing nftables rules.
  • Implemented logging for better traceability of charm operations.

Observer Module:
Observers for Juju events were added to manage the charm's lifecycle.

Library Changes

No external charm libraries were introduced or modified in this implementation. The charm relies on the ops framework and standard Python libraries subprocess, socket, logging to implement its functionality.

Checklist

Full documentation will be done in a separate PR.

@florentianayuwono florentianayuwono changed the title feat: set up basic charm feat: set up basic charm functionality Sep 12, 2025
@florentianayuwono florentianayuwono marked this pull request as ready for review September 16, 2025 17:09
@florentianayuwono florentianayuwono self-assigned this Sep 17, 2025
Comment thread tests/integration/test_charm.py Outdated
Comment thread charmcraft.yaml Outdated
Comment thread src/aproxy.py
Comment thread src/aproxy.py Outdated
Comment thread src/charm.py Outdated
Comment thread src/charm.py
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated
Comment thread src/charm.py Outdated
Comment thread src/charm.py Outdated
Comment thread src/charm.py Outdated

@gregory-schiano gregory-schiano left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good progress, still some small fixes to do

Comment thread charmcraft.yaml
Comment thread src/charm.py Outdated
Comment thread src/charm.py Outdated
Comment thread src/charm.py Outdated
Comment thread src/charm.py Outdated
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated

@gregory-schiano gregory-schiano left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Last round of comment I think 👍

Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated

@gregory-schiano gregory-schiano left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@florentianayuwono florentianayuwono enabled auto-merge (squash) October 6, 2025 08:33
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated
Comment thread src/aproxy.py Outdated
@florentianayuwono florentianayuwono merged commit 5657ffd into main Oct 8, 2025
7 checks passed
@florentianayuwono florentianayuwono deleted the feat/create-aproxy-charm-ISD-4148 branch October 8, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants