config

package
v1.0.0-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package config reads the applications the controller reconciles.

Applications are declared in a file, not a database. A GitOps controller whose own desired state lives in mutable storage has a bootstrap problem: the file is the only source of truth and the API serves it read-only.

What reloads and what does not

This package parses the file; where it comes from, and whether it can change under a running controller, is the bootstrap's answer and not this one's (see package appset). The two tiers behave differently on purpose:

A file mounted as a Docker config cannot change under the process. Docker configs are immutable, so changing one means creating a new config object and updating the service to reference it, which replaces the container — a watcher would never fire, because the process that would notice the change does not outlive it. Restart is not a limitation there; it is the only thing that can happen.

A file the controller sources from git, or from a directory something else keeps current, is re-read on an interval and swapped in once it validates. That is the whole of issue #47: the set of applications became an ordinary git commit rather than a redeploy. The API stays read-only either way, since the way to change the set is to change the file.

Everything else is environment

This file holds applications and nothing else. The listen address, the admin token, where the set itself lives — those are flags and environment variables, matching how swarmcli-rbac-proxy is configured and keeping the one file an operator edits about the one thing they think about.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// APIVersion is "v1", or absent meaning the same. It mirrors the chart
	// engine's release file so the two read alike.
	APIVersion string `yaml:"apiVersion,omitempty"`

	Applications []application.Spec `yaml:"applications"`

	// Path is the file this was read from. It prefixes error messages and is
	// not part of the document.
	Path string `yaml:"-"`
}

File is a parsed applications file.

func Load

func Load(path string) (*File, error)

Load reads and validates the applications file at path.

func Parse

func Parse(data []byte, path string) (*File, error)

Parse validates an applications file that has already been read. Unknown keys are an error: a misspelled key that was quietly ignored would leave a setting an operator believes they configured silently doing nothing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL