Repository navigation
feat(docker): user-defined label presets via tsdproxy.template - #552
Open
almeidapaulopt wants to merge 3 commits into
Open
almeidapaulopt wants to merge 3 commits into
almeidapaulopt wants to merge 3 commits into
Conversation
golangci-lint v2.15.0 flags unchecked receives from chan error. Bind and handle (or explicitly discard with rationale) at all sites, unblocking the build workflow for every open PR (incl. #548).
…emplate Presets are defined by the operator under presets in tsdproxy.yaml and expanded into container labels when a container carries tsdproxy.template: <name> (issue #432, Option B+C). - config: Presets map with ports (same syntax as tsdproxy.port.* label values, plus noTLSValidate/funnel/noAutoDetect options) and dashboard fields; only set fields expand so defaults (e.g. icon guess) stay intact - docker: preset expansion happens in newContainer before label parsing, reusing the existing port parsing and operator gates — a preset cannot bypass allowContainerFunnel/allowTlsValidateDisable - precedence: explicit container labels override preset values; a port label on the same proxy port/protocol replaces the preset port, ports on other proxy ports compose with the preset - docs: presets section in the server config guides (current + v3), tsdproxy.template in the Docker label references, gitea example Closes #432
…bt so CI 'build' can pass
Owner
Author
|
CI note: the merge commit brings in |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
presets:intsdproxy.yaml) that containers reference withtsdproxy.template: <name>, expanding the preset's ports and dashboard fields into the container's effective labels (Option B+C from the issue — no built-in registry).Motivation
Exposing common services (gitea, nginx, authentik, …) means repeating the same
tsdproxy.port.*/tsdproxy.dash.*label patterns on every container. Presets let operators define the pattern once and apply it with a single label.Closes #432
Changes
internal/config/config.go: newpresetsmap (PresetConfig→PresetPortoptions +PresetDashboard). Port keys use the exact syntax oftsdproxy.port.*label values; per-port options mirror the port label options (noTLSValidate,funnel,noAutoDetect). Only non-zero dashboard fields expand, so an unset icon still falls back to the image-based guess.internal/targetproviders/docker/preset.go(new):applyPresetLabelsexpands a preset into synthetictsdproxy.port.*/tsdproxy.dash.*label entries. The input label map is never mutated; unknown preset names log an error and leave labels unchanged.internal/targetproviders/docker/container.go:expandPreset()runs innewContainerbefore any label parsing, so all existing parsing, validation and operator gates apply unchanged — a preset cannot bypassallowContainerFunnel/allowTlsValidateDisable(options flow throughmodel.ApplyPortOptions).tsdproxy.port.*label on the same proxy port/protocol replaces the preset port (protocol defaults normalized, so443:3001overrides a preset443/https:…); explicit ports on other proxy ports are added on top of the preset ports.docker.Newtakes the presets map;proxymanagerpassescfg.Presets.tsdproxy.templaterow in both Docker label references, sample configs updated.Test Plan
internal/targetproviders/docker/preset_test.go— 13 tests: expansion (ports/dashboard/options), scalar precedence, port precedence (same proxy port, default-protocol normalization), composition on other ports, unknown/nil presets no-op, input map not mutated, and end-to-end throughnewContainer → newProxyConfig(real target resolution)internal/config/config_test.go— YAML round-trip via the real config loader (key normalization included) + defaults do not invent preset valuesexpandPreset()makes the integration tests fail; re-enabling makes them passgo build ./...,go vet ./internal/...,golangci-lint runclean on the touched packages; full unit suite green (24 packages)presets-bearing config; a typo insidepresetsis rejected withunknown field "portz" — did you mean "ports"?Notes for review