Documentation
¶
Overview ¶
Package ownapplication defines Techstack-owned desired state consumed by the node's StackKits renderer. It grants no host, daemon or provider authority.
Index ¶
- Constants
- Variables
- func AdoptableBindSource(source string) bool
- func Decode(raw []byte, target any) error
- func SecretSlotKey(service, key string) string
- func SplitImage(image string) (string, string, error)
- func ValidName(name string) bool
- func ValidServiceName(name string) bool
- func ValidateRegistry(registry string) error
- type AdoptedFrom
- type Application
- func (a Application) AdmitImageConfiguration(raw []byte) error
- func (a Application) ExpectedSecretRef(slot string) string
- func (a Application) Firewalled() bool
- func (a Application) HasVolume() bool
- func (a Application) IsAdopted() bool
- func (a Application) IsProject() bool
- func (a Application) Limits() Resources
- func (a Application) OutboundEnabled() bool
- func (a Application) Protected() bool
- func (a Application) RoutedService() (Service, bool)
- func (a Application) SecretRefList() []string
- func (a Application) SecretSlots() map[string]string
- func (a Application) Service(name string) (Service, bool)
- func (a *Application) UnmarshalJSON(raw []byte) error
- func (a Application) Validate() error
- func (a Application) WorkloadRef() string
- type Bundle
- type Installation
- type PublishedPort
- type Resources
- type Service
- type Volume
Constants ¶
const APIVersion = "techstack.own-application/v1"
const APIVersionV2 = "techstack.own-application/v2"
const APIVersionV3 = "techstack.own-application/v3"
const APIVersionV4 = "techstack.own-application/v4"
APIVersionV4 is one container StackKits rebuilt from an observed container it did not install ("Stack it"). It is the v2 single-container form plus the adoption source and the host ports the original published.
const BundleVersion = "stackkit.own-application-bundle/v1"
const ModuleRef = "stackkits-own-application-runtime"
Variables ¶
var AdoptedDataRoots = []string{"/srv/", "/opt/", "/data/", "/home/", "/mnt/", "/media/"}
AdoptedDataRoots are the host directories an adopted bind-mounted data source may live below. System paths, the Docker socket and / never are.
Functions ¶
func AdoptableBindSource ¶
AdoptableBindSource reports whether a host path is a clean path strictly below one of the admitted data roots.
func SecretSlotKey ¶
SecretSlotKey is the flat input slot of one project secret. It keeps the private secrets file a flat object while the custody reference stays namespaced by the service that holds the variable.
func ValidServiceName ¶
ValidServiceName reports whether name is a Compose service identity this contract admits: a lowercase DNS label of at most 40 characters.
func ValidateRegistry ¶
ValidateRegistry is the single image-host admission rule. It performs no DNS lookup; transport additionally rejects non-public resolved addresses.
Types ¶
type AdoptedFrom ¶
type AdoptedFrom struct {
ContainerID string `json:"containerId"`
// ImageDigest is the registry manifest digest the original ran.
ImageDigest string `json:"imageDigest"`
// Volumes names the data source copied into the named volume:
// volume:<name> or bind:<absolute host path>. At most one.
Volumes []string `json:"volumes,omitempty"`
// OriginalConfigRef names the configuration the original came from, for
// example compose:<project>/<service> or docker:<container name>.
OriginalConfigRef string `json:"originalConfigRef"`
}
AdoptedFrom records the observed container an adopted application was rebuilt from. It is evidence of origin, never runtime authority.
type Application ¶
type Application struct {
OutboundInternet *bool `json:"outboundInternet,omitempty"`
APIVersion string `json:"apiVersion"`
Name string `json:"name"`
Image string `json:"image,omitempty"`
HTTPPort int `json:"httpPort,omitempty"`
Hostname string `json:"hostname"`
SignIn *bool `json:"signIn,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
SecretRefs map[string]string `json:"secretRefs,omitempty"`
Volume *Volume `json:"volume,omitempty"`
Resources Resources `json:"resources,omitempty"`
// Services declares the containers of a techstack.own-application/v3
// project. The one-container forms keep their image and httpPort here.
Services []Service `json:"services,omitempty"`
// AdoptedFrom and PublishedPorts belong to techstack.own-application/v4
// only: the observed source of an adopted container and the host ports it
// published, kept so LAN host:port clients keep working.
AdoptedFrom *AdoptedFrom `json:"adoptedFrom,omitempty"`
PublishedPorts []PublishedPort `json:"publishedPorts,omitempty"`
}
Application is deliberately closed: users supply an image, never Compose, commands, capabilities, host mounts, devices or network configuration.
A techstack.own-application/v3 document declares a Compose project instead of a single container: it lists its services and carries no image or httpPort of its own.
func Parse ¶
func Parse(raw []byte) (Application, error)
func (Application) AdmitImageConfiguration ¶
func (a Application) AdmitImageConfiguration(raw []byte) error
AdmitImageConfiguration closes authority inherited from an image rather than the desired document. In particular Dockerfile routing labels must not create a second ingress path outside the reviewed router and Access Gate.
func (Application) ExpectedSecretRef ¶
func (a Application) ExpectedSecretRef(slot string) string
ExpectedSecretRef returns the custody reference a declared secret slot must carry. It returns the empty string for a slot the application does not declare, so a caller can refuse foreign custody.
func (Application) Firewalled ¶
func (a Application) Firewalled() bool
Firewalled reports whether the application runs on its managed host firewall bridge instead of an internal-only network: it has outbound Internet, published host ports, or both. Docker publishes no port of a container attached only to an internal network, so published ports without outbound use the same bridge with an ingress-only ruleset.
func (Application) HasVolume ¶
func (a Application) HasVolume() bool
HasVolume reports whether any declared container keeps a named volume.
func (Application) IsAdopted ¶
func (a Application) IsAdopted() bool
IsAdopted reports whether StackKits rebuilt the application from an observed container it did not install.
func (Application) IsProject ¶
func (a Application) IsProject() bool
IsProject reports whether the application declares a Compose project rather than a single container.
func (Application) Limits ¶
func (a Application) Limits() Resources
func (Application) OutboundEnabled ¶
func (a Application) OutboundEnabled() bool
func (Application) Protected ¶
func (a Application) Protected() bool
func (Application) RoutedService ¶
func (a Application) RoutedService() (Service, bool)
RoutedService returns the single project service that serves the routed host. A project always declares exactly one.
func (Application) SecretRefList ¶
func (a Application) SecretRefList() []string
SecretRefList returns every custody reference of the application in a stable order.
func (Application) SecretSlots ¶
func (a Application) SecretSlots() map[string]string
SecretSlots maps every declared secret to the flat input slot that carries its private material and to the custody reference that holds it.
func (Application) Service ¶
func (a Application) Service(name string) (Service, bool)
Service returns the declared project service with the given name.
func (*Application) UnmarshalJSON ¶
func (a *Application) UnmarshalJSON(raw []byte) error
UnmarshalJSON keeps the v1 wire shape closed even when a caller decodes a bundle directly rather than calling Parse. An explicit null is not a bool.
func (Application) Validate ¶
func (a Application) Validate() error
func (Application) WorkloadRef ¶
func (a Application) WorkloadRef() string
type Bundle ¶
type Bundle struct {
APIVersion string `json:"apiVersion"`
Application Application `json:"application"`
Installation Installation `json:"installation"`
ResolvedImage string `json:"resolvedImage,omitempty"`
// ImageID is derived from the verified manifest/config by the node, never desired state.
ImageID string `json:"imageID,omitempty"`
// ResolvedImages and ImageIDs carry the image custody of every service of a
// techstack.own-application/v3 project, keyed by service name. A project
// never carries the single-container custody above.
ResolvedImages map[string]string `json:"resolvedImages,omitempty"`
ImageIDs map[string]string `json:"imageIDs,omitempty"`
}
Bundle adapts desired state into the common application delivery graph. ResolvedImage is registry-observed before approval; execution uses that digest.
func (Bundle) ImagesResolved ¶
ImagesResolved reports whether every declared container of the bundle carries its node-observed image custody.
func (Bundle) ProjectRelease ¶
ProjectRelease is the release identity of a project: the resolved image of every service in declared order. It names the whole project, not one container.
type Installation ¶
type Installation struct {
Domain string `json:"domain"`
SiteRef string `json:"siteRef"`
NodeRef string `json:"nodeRef"`
CoreModuleRef string `json:"coreModuleRef"`
TLSIssuerRef string `json:"tlsIssuerRef"`
TLSProfileRef string `json:"tlsProfileRef"`
Exposure string `json:"exposure"`
}
Installation is supplied by verified applied state, never by a live write's caller. Offline rendering accepts an explicit installation for inspection.
type PublishedPort ¶
type PublishedPort struct {
HostIP string `json:"hostIP,omitempty"`
HostPort int `json:"hostPort"`
ContainerPort int `json:"containerPort"`
Protocol string `json:"protocol"`
}
PublishedPort is one host port the adopted container keeps publishing.
type Service ¶
type Service struct {
Name string `json:"name"`
Image string `json:"image"`
HTTPPort int `json:"httpPort,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
SecretRefs map[string]string `json:"secretRefs,omitempty"`
Volume *Volume `json:"volume,omitempty"`
Resources Resources `json:"resources,omitempty"`
DependsOn []string `json:"dependsOn,omitempty"`
}
Service is one container of an own Compose project. Exactly one service declares httpPort and is routed on the project hostname; every other service stays on the project's private network.
func (Service) AdmitImageConfiguration ¶
AdmitImageConfiguration closes the authority inherited from the image of one project service rather than from the user contract.