VPN gateway charm library for Kubernetes
Project description
charmarr-lib-vpn
VPN gateway charm library for Kubernetes.
Features
- VPN gateway Juju relation interface
- StatefulSet patching utilities for pod-gateway integration
- NetworkPolicy kill switch implementation
- Reusable beyond Charmarr ecosystem
Installation
pip install charmarr-lib-vpn
Usage
Interfaces
from charmarr_lib.vpn.interfaces import (
VPNGatewayProvider,
VPNGatewayRequirer,
VPNGatewayProviderData,
VPNGatewayRequirerData,
VPNGatewayChangedEvent,
)
Gateway Patching (VPN gateway side - gluetun)
from charmarr_lib.vpn import (
reconcile_gateway,
build_gateway_patch,
is_gateway_patched,
)
from charmarr_lib.krm import K8sResourceManager
manager = K8sResourceManager()
provider_data = VPNGatewayProviderData(
vxlan_id=42,
vxlan_ip_network="172.16.0.0/24",
cluster_cidrs="10.1.0.0/16,10.152.183.0/24",
)
# Idempotent reconciliation
result = reconcile_gateway(
manager=manager,
statefulset_name="gluetun",
namespace="vpn-gateway",
data=provider_data,
pod_cidr="10.1.0.0/16",
)
Client Patching (Download client side - qBittorrent)
from charmarr_lib.vpn import (
reconcile_gateway_client,
build_gateway_client_patch,
build_gateway_client_configmap_data,
is_gateway_client_patched,
)
# Create client-side VPN routing
result = reconcile_gateway_client(
manager=manager,
statefulset_name="qbittorrent",
namespace="download-clients",
data=requirer_data,
configmap_name="qbittorrent-vpn-config",
)
Kill Switch (NetworkPolicy)
from charmarr_lib.vpn import (
KillSwitchConfig,
reconcile_kill_switch,
)
# Create NetworkPolicy that blocks non-VPN egress
config = KillSwitchConfig(
app_name="qbittorrent",
namespace="download-clients",
cluster_cidrs=["10.1.0.0/16", "10.152.183.0/24"],
dns_namespace="kube-system",
)
reconcile_kill_switch(manager, "qbittorrent", "download-clients", config)
# Remove kill switch on relation-broken
reconcile_kill_switch(manager, "qbittorrent", "download-clients", None)
Constants
from charmarr_lib.vpn import (
POD_GATEWAY_IMAGE,
DEFAULT_VXLAN_ID,
DEFAULT_VXLAN_IP_NETWORK,
GATEWAY_INIT_CONTAINER_NAME,
GATEWAY_SIDECAR_CONTAINER_NAME,
CLIENT_INIT_CONTAINER_NAME,
CLIENT_SIDECAR_CONTAINER_NAME,
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file charmarr_lib_vpn-0.4.0.tar.gz.
File metadata
- Download URL: charmarr_lib_vpn-0.4.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b7ce242823a0339eea486ff3344dc8b749cfcb8cc4e827c44f7592307b4a235
|
|
| MD5 |
01969386ef7c1976ecbdb6017d29d53c
|
|
| BLAKE2b-256 |
decbd3dd2092b87e187ec91609b51dfd272339f022462f9ca1ba0b40730e2743
|
Provenance
The following attestation bundles were made for charmarr_lib_vpn-0.4.0.tar.gz:
Publisher:
release.yml on charmarr/charmarr-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
charmarr_lib_vpn-0.4.0.tar.gz -
Subject digest:
0b7ce242823a0339eea486ff3344dc8b749cfcb8cc4e827c44f7592307b4a235 - Sigstore transparency entry: 778877060
- Sigstore integration time:
-
Permalink:
charmarr/charmarr-lib@248c7b075230b22dca800ac22781385adba0f879 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/charmarr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@248c7b075230b22dca800ac22781385adba0f879 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file charmarr_lib_vpn-0.4.0-py3-none-any.whl.
File metadata
- Download URL: charmarr_lib_vpn-0.4.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2f9c98cb7d6944434a1d11c85581ec7a13546ed4acbe2de007299ba2649d40b
|
|
| MD5 |
8e23538aab85ff35795b5db156786e27
|
|
| BLAKE2b-256 |
938650d40909402485253e0079b8775379676c009e73a6934a735d8739eba2ca
|
Provenance
The following attestation bundles were made for charmarr_lib_vpn-0.4.0-py3-none-any.whl:
Publisher:
release.yml on charmarr/charmarr-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
charmarr_lib_vpn-0.4.0-py3-none-any.whl -
Subject digest:
d2f9c98cb7d6944434a1d11c85581ec7a13546ed4acbe2de007299ba2649d40b - Sigstore transparency entry: 778877104
- Sigstore integration time:
-
Permalink:
charmarr/charmarr-lib@248c7b075230b22dca800ac22781385adba0f879 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/charmarr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@248c7b075230b22dca800ac22781385adba0f879 -
Trigger Event:
workflow_run
-
Statement type: