Skip to content

lib: initial support for networks#4262

Merged
stavros-k merged 18 commits intomasterfrom
network-support
Feb 12, 2026
Merged

lib: initial support for networks#4262
stavros-k merged 18 commits intomasterfrom
network-support

Conversation

@stavros-k
Copy link
Copy Markdown
Contributor

@stavros-k stavros-k commented Feb 5, 2026

Add support to join containers into networks.

  • Allows creation of "internal" networks. Those are used to interconnect the containers of the stack when needed (ie a db). Those internal networks have a label ix.internal: true attached, so we can later filter them out on our UI.
  • Allows to "register" an external network (it is needed to be present in the yaml and marked as external: true, in order be able to be attached to a container. Lifecycle of these networks are managed by the user, either via CLI, other tools, or later by our UI/middleware
  • Allows to set most of the common settings in the service/container level network options, such as interface_name, ipv4_address, ipv6_address, mac_address, gw_priority, priority. (Settings like driver, ipam, etc are on the top level network, which is handled externally).
  • Validates that external network name exists on the docker daemon by using the python SDK for docker client. Later this validation can either be removed (as it will be a $ref in the questions, or replaced with a middleware call)

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 pull request introduces initial support for internal networks in the library version 2.2.0, along with a comprehensive refactoring and addition of volume management, storage, and various container configuration features. The PR marks this as a draft for testing purposes.

Changes:

  • Adds network management capabilities with support for both internal and external Docker networks
  • Implements comprehensive volume management including NFS, CIFS, host paths, and Docker volumes
  • Refactors the Labels class to remove dependency on Render instance
  • Renames Client class to TNClient and introduces DockerClient for Docker API interactions
  • Adds numerous container configuration features (sysctls, security_opts, tmpfs, etc.)

Reviewed changes

Copilot reviewed 13 out of 78 changed files in this pull request and generated no comments.

Show a summary per file
File Description
library/hashes.yaml Updates library version from 2.1.78 to 2.2.0
library/2.2.0/render.py Integrates Networks and DockerClient, renames Client to TNClient
library/2.2.0/container.py Adds ContainerNetworks integration and auto-network configuration
library/2.2.0/networks.py Implements network management with internal/external network support
library/2.2.0/docker_client.py New Docker client for validating network existence
library/2.2.0/labels.py Refactors to remove Render instance dependency
library/2.2.0/truenas_client.py Renames Client class to TNClient
library/2.2.0/validations.py Adds valid_label_key_or_raise validation function
library/2.2.0/volumes.py New volume management implementation
library/2.2.0/volume_types.py Implements NFS, CIFS, and Docker volume types
library/2.2.0/volume_sources.py Handles volume source resolution for different storage types
library/2.2.0/volume_mount_types.py Defines bind and volume mount type specifications
library/2.2.0/volume_mount.py Orchestrates volume mount creation and validation
library/2.2.0/tmpfs.py Implements tmpfs mount support
library/2.2.0/storage.py Defines storage TypedDict interfaces and Storage class
library/2.2.0/sysctls.py Container sysctl configuration support
library/2.2.0/security_opts.py Security options management
library/2.2.0/restart.py Restart policy configuration
library/2.2.0/resources.py Resource limits and GPU configuration
library/2.2.0/ports.py Port management with IPv4/IPv6 support
library/2.2.0/deps_postgres.py Adds digest pin handling for Postgres versions
library/2.2.0/tests/* Comprehensive test coverage for all new features
devbox.json, devbox.lock Adds python311Packages.docker dependency
.github/workflows/library-tests.yaml Adds python3-docker to test dependencies

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

Copilot reviewed 13 out of 78 changed files in this pull request and generated no new comments.

@stavros-k stavros-k requested a review from Copilot February 10, 2026 15:15
@stavros-k stavros-k marked this pull request as ready for review February 10, 2026 15:25
@stavros-k stavros-k changed the title lib: initial support for (internal) networks lib: initial support for networks Feb 10, 2026
@stavros-k stavros-k linked an issue Feb 10, 2026 that may be closed by this pull request
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

Copilot reviewed 14 out of 78 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

library/2.2.0/container.py:321

  • add_network(self, network: str, config: dict = {}) uses a mutable default argument. Even if it's not mutated today, this is a common source of cross-call state leakage. Prefer config: dict | None = None and default to {} inside the method.

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

Copilot reviewed 14 out of 78 changed files in this pull request and generated no new comments.

@amateescu
Copy link
Copy Markdown
Contributor

This will make https://github.com/tjhorner/dragonify obsolete, right?

@stavros-k stavros-k requested a review from Qubad786 February 11, 2026 16:25
@stavros-k stavros-k merged commit fb895ea into master Feb 12, 2026
13 of 14 checks passed
@stavros-k stavros-k deleted the network-support branch February 12, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow for selecting networks

4 participants