Documentation
¶
Overview ¶
Package backstage provides types and parsers for generating Backstage catalog entities from Kubernetes resources. It extracts component metadata from appropriately labeled and annotated Kubernetes resources following the app.kubernetes.io label conventions.
Index ¶
Constants ¶
const ( // APIVersion used in all Backstage resources. APIVersion = "backstage.io/v1alpha1" // KindComponent is the kind for Backstage components. KindComponent = "Component" )
const ( // LifecycleAnnotation is used to populate spec.lifecycle for Components. LifecycleAnnotation = "backstage.io/kubernetes-lifecycle" // DescriptionAnnotation is used to populate the medata.description for // Components. DescriptionAnnotation = "backstage.io/kubernetes-description" )
Unofficial annotations.
const ( // AppLabel is the Kubernetes recommended label to indicate that a component // is part of an application. AppLabel = "app.kubernetes.io/part-of" )
const (
// KindLocation is the kind for Backstage locations.
KindLocation = "Location"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackstageMetadata ¶
type BackstageMetadata struct {
Name string `yaml:"name"`
Description string `yaml:"description,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty"`
Tags []string `yaml:"tags,omitempty"`
Links []Link `yaml:"links,omitempty"`
}
BackstageMetadata is a struct that contains Backstage-specific metadata. This includes the entity name, description, custom annotations, tags, and links.
type Component ¶
type Component struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Metadata BackstageMetadata `yaml:"metadata"`
Spec ComponentSpec `yaml:"spec,omitempty"`
}
Component is a representation of a Backstage Component. Components describe software components and their metadata.
type ComponentParser ¶
type ComponentParser struct {
Accessor meta.MetadataAccessor
// contains filtered or unexported fields
}
ComponentParser parses Kubernetes resource labels and annotations to extract Backstage components. It discovers components from appropriately labeled resources following Kubernetes recommended labels (app.kubernetes.io/*).
func NewComponentParser ¶
func NewComponentParser() *ComponentParser
NewComponentParser creates and returns a new ComponentParser ready for use. The parser can process multiple lists of Kubernetes resources via the Add method.
func (*ComponentParser) Add ¶
func (p *ComponentParser) Add(list runtime.Object) error
Add a list of objects to the parser.
The list should be a List type, e.g. PodList, DeploymentList etc. Resources are parsed for Backstage-relevant labels and annotations.
Labels are based on https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
func (*ComponentParser) Components ¶
func (p *ComponentParser) Components() []Component
Components returns the Components that were discovered during the parsing process. Each component represents a unique application component found in the parsed Kubernetes resources.
type ComponentSpec ¶
type ComponentSpec struct {
Type string `yaml:"type"`
Lifecycle string `yaml:"lifecycle"`
Owner string `yaml:"owner"`
System string `yaml:"system"`
}
ComponentSpec defines the specification for a Backstage Component. It contains metadata about the component's type, lifecycle, ownership, and system membership.
type Link ¶
type Link struct {
URL string `yaml:"url"`
Title string `yaml:"title,omitempty"`
Icon string `yaml:"icon,omitempty"`
}
Link is a link for users to access some facet of data for a component. Links provide quick access to related resources like dashboards, documentation, or tools.
type Location ¶
type Location struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Metadata BackstageMetadata `yaml:"metadata"`
Spec LocationSpec `yaml:"spec,omitempty"`
}
Location is a representation of a Backstage Location. Locations are used to organize catalog entities by pointing to where component definitions can be found.
func NewLocation ¶
NewLocation creates and returns a prepopulated Location. A Location points to other catalog entity definitions through its targets.
type LocationSpec ¶
type LocationSpec struct {
Targets []string `yaml:"targets,omitempty"`
}
LocationSpec is the spec for Location resources. It contains an array of target URLs pointing to catalog entity definitions.