Documentation
¶
Overview ¶
Package portainer is the Portainer API backend. TLS trust is exactly one of a CA file or a pinned certificate fingerprint (decided at config load); there is no insecure mode. Git-backed stacks are never updated directly — Proposals go through Git.
Index ¶
- type Adapter
- func (a *Adapter) CurrentUsername() (string, error)
- func (a *Adapter) ImageStatus(stackID int) (string, error)
- func (a *Adapter) ListStacks() ([]Stack, error)
- func (a *Adapter) ServiceImageDigests(stack Stack) (map[string]string, error)
- func (a *Adapter) StackFile(stackID int) (string, error)
- func (a *Adapter) UpdateStack(stack Stack, compose string, env []EnvVar, repull bool) error
- type Backend
- func (b *Backend) Deploy(state backend.StackState, compose string, repull bool) error
- func (b *Backend) Observe(stack config.StackPolicy) (backend.StackState, error)
- func (b *Backend) Preflight() error
- func (b *Backend) RunningDigests(state backend.StackState) (map[string]string, error)
- func (b *Backend) ServicesRunning(backend.StackState) (bool, string, error)
- func (b *Backend) WithContext(ctx context.Context) backend.Port
- type EnvVar
- type HTTPError
- type Options
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is the Portainer backend.
func (*Adapter) CurrentUsername ¶
CurrentUsername returns the username the API key authenticates as.
func (*Adapter) ImageStatus ¶
ImageStatus returns the stack's image status, lowercased.
func (*Adapter) ListStacks ¶
ListStacks lists all stacks, marking Git-backed ones.
func (*Adapter) ServiceImageDigests ¶
ServiceImageDigests maps each running service of the stack's compose project to its image digest. Only running containers of the stack's own project are ever queried — never the whole host.
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend adapts the Portainer API to the orchestrator port.
func NewBackend ¶
NewBackend wraps an Adapter as a backend port. The expected username is the identity every run is checked against before it touches anything.
func (*Backend) Deploy ¶
Deploy redeploys the stack with new Compose content, keeping its environment exactly as Portainer holds it.
func (*Backend) Observe ¶
func (b *Backend) Observe(stack config.StackPolicy) (backend.StackState, error)
Observe reads one stack: its Compose document, its services, and either the digests running or Portainer's own image-status verdict.
func (*Backend) Preflight ¶
Preflight refuses to run at all under the wrong Portainer identity. This is not a per-stack problem: a key that authenticates as someone else can see and change things the reviewed policy never described.
func (*Backend) RunningDigests ¶
RunningDigests re-reads the digests the stack's compose project runs.
func (*Backend) ServicesRunning ¶
ServicesRunning is always satisfied for Portainer: the API exposes no per-service liveness beyond the digest discovery an apply already does, so the functional health checks are the whole verification here.