stacks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PodImageNameEnvVar is the env variable for setting the image name used for the stack manager unpack/install process.
	// When this env variable is not set the parent Pod will be detected and the associated image will be used.
	// Overriding this variable is only useful when debugging the main stack manager process, since there is no Pod to detect.
	PodImageNameEnvVar = "STACK_MANAGER_IMAGE"
)

Functions

func Unpack

func Unpack(rw walker.ResourceWalker, out io.StringWriter, baseDir string, permissionScope string) error

Unpack writes to `out` using custom Step functions against a ResourceWalker The custom Steps process Stack resource files and the output is multiple YAML documents. CRDs container within the stack will be annotated based on the other Stack resource files contained within the Stack.

baseDir is expected to be an absolute path, i.e. have a root to the path, at the very least "/".

Types

type ExecutorInfo

type ExecutorInfo struct {
	Image string
}

ExecutorInfo stores information about an executing container

type ExecutorInfoDiscoverer

type ExecutorInfoDiscoverer interface {
	Discover(context.Context) (*ExecutorInfo, error)
}

ExecutorInfoDiscoverer implementations can Discover an Image

type KubeExecutorInfoDiscoverer

type KubeExecutorInfoDiscoverer struct {
	ExecutorInfo
	Client client.Client
	// contains filtered or unexported fields
}

KubeExecutorInfoDiscoverer discovers container information about an executing Kubernetes pod

func (*KubeExecutorInfoDiscoverer) Discover

Discover the container image from the predefined Stack Manager pod

type StackGroup

type StackGroup struct {
	Title         string `json:"title"`
	OverviewShort string `json:"overviewShort,omitempty"`
	Overview      string `json:"overview,omitempty"`
	Readme        string `json:"readme,omitempty"`
	Category      string `json:"category"`
}

StackGroup provides the Stack metadata for a resource group. This is the format for group.yaml files.

type StackPackage

type StackPackage struct {
	// Stack is the Kubernetes API Stack representation
	Stack v1alpha1.Stack

	// CRDs map CRD files contained within a Stack by their GVK
	CRDs map[string]apiextensions.CustomResourceDefinition

	// CRDPaths map CRDs to the path they were found in
	// Stack resources will be paired based on their path and the CRD path.
	CRDPaths map[string]string

	Groups    map[string]StackGroup
	Icons     map[string]*v1alpha1.IconSpec
	Resources map[string]StackResource
	UISpecs   map[string]string
	// contains filtered or unexported fields
}

StackPackage defines the artifact structure of Stacks A fully processed Stack can be thought of as a Stack CR and a collection of managed CRDs. The Stack CR includes its controller install and RBAC definitions. The managed CRDS are annotated by their Stack resource, icon, group, and UI descriptors.

func NewStackPackage

func NewStackPackage(baseDir string) *StackPackage

NewStackPackage returns a StackPackage with maps created

func (*StackPackage) AddCRD

AddCRD appends a CRD to the CRDs of this StackPackage The CRD will be annotated before being added and the Stack will track ownership of this CRD.

func (*StackPackage) AddGroup

func (sp *StackPackage) AddGroup(path string, sg StackGroup)

AddGroup adds a group to the StackPackage

func (*StackPackage) AddIcon

func (sp *StackPackage) AddIcon(path string, icon v1alpha1.IconSpec)

AddIcon adds an icon to the StackPackage

func (*StackPackage) AddResource

func (sp *StackPackage) AddResource(filepath string, sr StackResource)

AddResource adds a resource to the StackPackage

func (*StackPackage) AddUI

func (sp *StackPackage) AddUI(filepath string, ui string)

AddUI adds a resource to the StackPackage

func (*StackPackage) GotApp

func (sp *StackPackage) GotApp() bool

GotApp reveals if the AppMetadataSpec has been set

func (*StackPackage) SetApp

func (sp *StackPackage) SetApp(app v1alpha1.AppMetadataSpec)

SetApp sets the Stack's App metadata

func (*StackPackage) SetInstall

func (sp *StackPackage) SetInstall(install unstructured.Unstructured) error

SetInstall sets the Stack controller's install method from a Deployment or Job

func (*StackPackage) SetRBAC

func (sp *StackPackage) SetRBAC(rbac v1alpha1.PermissionsSpec)

SetRBAC sets the StackPackage Stack's permissions with using the supplied PermissionsSpec

func (*StackPackage) Yaml

func (sp *StackPackage) Yaml() (string, error)

Yaml returns a multiple document YAML representation of the Stack Package This YAML includes the Stack itself and and all CRDs managed by that Stack.

type StackPackager

type StackPackager interface {
	SetApp(v1alpha1.AppMetadataSpec)
	SetInstall(unstructured.Unstructured) error
	SetRBAC(v1alpha1.PermissionsSpec)

	GotApp() bool

	AddGroup(string, StackGroup)
	AddResource(string, StackResource)
	AddIcon(string, v1alpha1.IconSpec)
	AddUI(string, string)
	AddCRD(string, *apiextensions.CustomResourceDefinition)

	Yaml() (string, error)
}

StackPackager implentations can build a stack from Stack resources and emit the Yaml artifact

type StackResource

type StackResource struct {
	// ID refers to the CRD Kind
	ID            string `json:"id"`
	Title         string `json:"title"`
	TitlePlural   string `json:"titlePlural"`
	OverviewShort string `json:"overviewShort,omitempty"`
	Overview      string `json:"overview,omitempty"`
	Readme        string `json:"readme,omitempty"`
	Category      string `json:"category"`
}

StackResource provides the Stack metadata for a CRD. This is the format for resource.yaml files.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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