manifest

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const DesiredManifestKeyName = "manifest.yaml"

DesiredManifestKeyName is the name of the key in desired manifest secret

View Source
const JobSpecFilename = "job.MF"

JobSpecFilename is the name of the job spec manifest in an unpacked BOSH release

View Source
const (
	// VarInterpolationContainerName is the name of the container that performs
	// variable interpolation for a manifest
	VarInterpolationContainerName = "interpolation"
)

Variables

View Source
var (
	// DockerImageOrganization is the organization which provides the operator image
	DockerImageOrganization = ""
	// DockerImageRepository is the repository which provides the operator image
	DockerImageRepository = ""
	// DockerImageTag is the tag of the operator image
	DockerImageTag = ""
)
View Source
var (
	// LabelInstanceGroupName is the name of a label for an instance group name
	LabelInstanceGroupName = fmt.Sprintf("%s/instance-group-name", apis.GroupName)
)

Functions

func GetOperatorDockerImage

func GetOperatorDockerImage() string

GetOperatorDockerImage returns the image name of the operator docker image

func InterpolateVariables added in v0.2.0

func InterpolateVariables(log *zap.SugaredLogger, boshManifestBytes []byte, variablesDir string) error

InterpolateVariables reads explicit secrets from a folder and writes an interpolated manifest to STDOUT

func RenderJobTemplates added in v0.2.0

func RenderJobTemplates(boshManifestPath string, jobsDir string, jobsOutputDir string, instanceGroupName string, specIndex int) error

RenderJobTemplates will render templates for all jobs of the instance group https://bosh.io/docs/create-release/#job-specs boshManifest is a resolved manifest for a single instance group

Types

type AddOn

type AddOn struct {
	Name    string               `yaml:"name"`
	Jobs    []AddOnJob           `yaml:"jobs"`
	Include *AddOnPlacementRules `yaml:"include,omitempty"`
	Exclude *AddOnPlacementRules `yaml:"exclude,omitempty"`
}

AddOn from BOSH deployment manifest

type AddOnJob

type AddOnJob struct {
	Name       string                 `yaml:"name"`
	Release    string                 `yaml:"release"`
	Properties map[string]interface{} `yaml:"properties,omitempty"`
}

AddOnJob from BOSH deployment manifest

type AddOnPlacementJob

type AddOnPlacementJob struct {
	Name    string `yaml:"name"`
	Release string `yaml:"release"`
}

AddOnPlacementJob from BOSH deployment manifest

type AddOnPlacementRules

type AddOnPlacementRules struct {
	Stemcell      []*AddOnStemcell     `yaml:"stemcell,omitempty"`
	Deployments   []string             `yaml:"deployments,omitempty"`
	Jobs          []*AddOnPlacementJob `yaml:"release,omitempty"`
	InstanceGroup []string             `yaml:"instance_groups,omitempty"`
	Networks      []string             `yaml:"networks,omitempty"`
	Teams         []string             `yaml:"teams,omitempty"`
}

AddOnPlacementRules from BOSH deployment manifest

type AddOnStemcell

type AddOnStemcell struct {
	OS string `yaml:"os"`
}

AddOnStemcell from BOSH deployment manifest

type Agent

type Agent struct {
	Settings string `yaml:"settings,omitempty"`
	Tmpfs    *bool  `yaml:"tmpfs,omitempty"`
}

Agent from BOSH deployment manifest

type AgentEnv

type AgentEnv struct {
	PersistentDiskFS           string              `yaml:"persistent_disk_fs,omitempty"`
	PersistentDiskMountOptions []string            `yaml:"persistent_disk_mount_options,omitempty"`
	AgentEnvBoshConfig         *AgentEnvBoshConfig `yaml:"bosh,omitempty"`
}

AgentEnv from BOSH deployment manifest

type AgentEnvBoshConfig

type AgentEnvBoshConfig struct {
	Password              string  `yaml:"password,omitempty"`
	KeepRootPassword      string  `yaml:"keep_root_password,omitempty"`
	RemoveDevTools        *bool   `yaml:"remove_dev_tools,omitempty"`
	RemoveStaticLibraries *bool   `yaml:"remove_static_libraries,omitempty"`
	SwapSize              *int    `yaml:"swap_size,omitempty"`
	IPv6                  IPv6    `yaml:"ipv6,omitempty"`
	JobDir                *JobDir `yaml:"job_dir,omitempty"`
	Agent                 *Agent  `yaml:"agent,omitempty"`
}

AgentEnvBoshConfig from BOSH deployment manifest

type AuthType

type AuthType string

AuthType from BOSH deployment manifest

const (
	ClientAuth AuthType = "client_auth"
	ServerAuth AuthType = "server_auth"
)

AuthType values from BOSH deployment manifest

type BOSHContainerization

type BOSHContainerization struct {
	Consumes  map[string]JobLink `yaml:"consumes"`
	Instances []JobInstance      `yaml:"instances"`
	Release   string             `yaml:"release"`
	BPM       bpm.Config         `yaml:"bpm"`
	Ports     []Port             `yaml:"ports"`
	Run       RunConfig          `yaml:"run"`
}

BOSHContainerization represents the special 'bosh_containerization' property key

type BPMResources added in v0.2.2

type BPMResources struct {
	InstanceGroups []essv1.ExtendedStatefulSet
	Errands        []ejv1.ExtendedJob
	Services       []corev1.Service
}

BPMResources contains BPM related k8s resources, which were converted from BOSH objects

type ContainerFactory added in v0.2.2

type ContainerFactory struct {
	// contains filtered or unexported fields
}

ContainerFactory builds Kubernetes containers from BOSH jobs

func NewContainerFactory added in v0.2.2

func NewContainerFactory(manifestName string, igName string, releaseImageProvider releaseImageProvider, bpmConfigs bpm.Configs) *ContainerFactory

NewContainerFactory returns a new ContainerFactory for a BOSH instant group

func (*ContainerFactory) JobsToContainers added in v0.2.2

func (c *ContainerFactory) JobsToContainers(jobs []Job) ([]corev1.Container, error)

JobsToContainers creates a list of Containers for corev1.PodSpec Containers field

func (*ContainerFactory) JobsToInitContainers added in v0.2.2

func (c *ContainerFactory) JobsToInitContainers(jobs []Job) ([]corev1.Container, error)

JobsToInitContainers creates a list of Containers for corev1.PodSpec InitContainers field

type DataGatherer added in v0.2.0

type DataGatherer struct {
	// contains filtered or unexported fields
}

DataGatherer gathers data for jobs in the manifest, it handles links and returns a deployment manifest that only has information pertinent to an instance group.

func NewDataGatherer added in v0.2.0

func NewDataGatherer(log *zap.SugaredLogger, basedir, namespace string, manifest Manifest, instanceGroupName string) (*DataGatherer, error)

NewDataGatherer returns a data gatherer with logging for a given input manifest and instance group

func (*DataGatherer) BPMConfigs added in v0.2.2

func (dg *DataGatherer) BPMConfigs() (bpm.Configs, error)

BPMConfigs returns a map of all BOSH jobs in the instance group

func (*DataGatherer) ResolvedProperties added in v0.2.2

func (dg *DataGatherer) ResolvedProperties() (Manifest, error)

ResolvedProperties returns the manifest including the gathered data

type Feature

type Feature struct {
	ConvergeVariables    bool  `yaml:"converge_variables"`
	RandomizeAzPlacement *bool `yaml:"randomize_az_placement,omitempty"`
	UseDNSAddresses      *bool `yaml:"use_dns_addresses,omitempty"`
	UseTmpfsJobConfig    *bool `yaml:"use_tmpfs_job_config,omitempty"`
}

Feature from BOSH deployment manifest

type HealthCheck added in v0.2.2

type HealthCheck struct {
	ReadinessProbe *corev1.Probe `yaml:"readiness"`
	LivenessProbe  *corev1.Probe `yaml:"liveness"`
}

HealthCheck defines liveness and readiness probes for a container

type IPv6

type IPv6 struct {
	Enable bool `yaml:"enable"`
}

IPv6 from BOSH deployment manifest

type InstanceGroup

type InstanceGroup struct {
	Name               string                 `yaml:"name"`
	Instances          int                    `yaml:"instances"`
	AZs                []string               `yaml:"azs"`
	Jobs               []Job                  `yaml:"jobs"`
	VMType             string                 `yaml:"vm_type,omitempty"`
	VMExtensions       []string               `yaml:"vm_extensions,omitempty"`
	VMResources        *VMResource            `yaml:"vm_resources"`
	Stemcell           string                 `yaml:"stemcell"`
	PersistentDisk     *int                   `yaml:"persistent_disk,omitempty"`
	PersistentDiskType string                 `yaml:"persistent_disk_type,omitempty"`
	Networks           []*Network             `yaml:"networks,omitempty"`
	Update             *Update                `yaml:"update,omitempty"`
	MigratedFrom       []*MigratedFrom        `yaml:"migrated_from,omitempty"`
	LifeCycle          string                 `yaml:"lifecycle,omitempty"`
	Properties         map[string]interface{} `yaml:"properties,omitempty"`
	Env                *AgentEnv              `yaml:"env,omitempty"`
}

InstanceGroup from BOSH deployment manifest

type Interpolator

type Interpolator interface {
	BuildOps(opsBytes []byte) error
	Interpolate(manifestBytes []byte) ([]byte, error)
}

Interpolator renders BOSH manifests by operations files go:generate counterfeiter -o fakes/fake_interpolator.go . Interpolator

type InterpolatorImpl

type InterpolatorImpl struct {
	// contains filtered or unexported fields
}

InterpolatorImpl applies desired changes from BOSH operations files to to BOSH manifest

func NewInterpolator

func NewInterpolator() *InterpolatorImpl

NewInterpolator constructs an interpolator

func (*InterpolatorImpl) BuildOps

func (i *InterpolatorImpl) BuildOps(opsBytes []byte) error

BuildOps unmarshals ops definitions, processes them and holds them in memory

func (*InterpolatorImpl) Interpolate

func (i *InterpolatorImpl) Interpolate(manifestBytes []byte) ([]byte, error)

Interpolate returns manifest which is rendered by operations files

type Job

type Job struct {
	Name       string                 `yaml:"name"`
	Release    string                 `yaml:"release"`
	Consumes   map[string]interface{} `yaml:"consumes,omitempty"`
	Provides   map[string]interface{} `yaml:"provides,omitempty"`
	Properties JobProperties          `yaml:"properties,omitempty"`
}

Job from BOSH deployment manifest

func (Job) Property added in v0.2.0

func (job Job) Property(propertyName string) (interface{}, bool)

Property search for property value in the job properties

type JobDir

type JobDir struct {
	Tmpfs     *bool  `yaml:"tmpfs,omitempty"`
	TmpfsSize string `yaml:"tmpfs_size,omitempty"`
}

JobDir from BOSH deployment manifest

type JobFactory added in v0.2.1

type JobFactory struct {
	Manifest  Manifest
	Namespace string
}

JobFactory creates Jobs for a given manifest

func NewJobFactory added in v0.2.1

func NewJobFactory(manifest Manifest, namespace string) *JobFactory

NewJobFactory returns a new JobFactory

func (*JobFactory) BPMConfigsJob added in v0.2.2

func (f *JobFactory) BPMConfigsJob() (*ejv1.ExtendedJob, error)

BPMConfigsJob returns an extended job to calculate BPM information

func (*JobFactory) DataGatheringJob added in v0.2.1

func (f *JobFactory) DataGatheringJob() (*ejv1.ExtendedJob, error)

DataGatheringJob generates the Data Gathering Job for a manifest

func (*JobFactory) VariableInterpolationJob added in v0.2.1

func (f *JobFactory) VariableInterpolationJob() (*ejv1.ExtendedJob, error)

VariableInterpolationJob returns an extended job to interpolate variables

type JobInstance

type JobInstance struct {
	Address  string                 `yaml:"address"`
	AZ       string                 `yaml:"az"`
	ID       string                 `yaml:"id"`
	Index    int                    `yaml:"index"`
	Instance int                    `yaml:"instance"`
	Name     string                 `yaml:"name"`
	Network  map[string]interface{} `yaml:"networks"`
	IP       string                 `yaml:"ip"`
}

JobInstance for data gathering

type JobLink struct {
	Instances  []JobInstance          `yaml:"instances"`
	Properties map[string]interface{} `yaml:"properties"`
}

JobLink describes links inside a job properties bosh_containerization.

type JobProperties

type JobProperties struct {
	BOSHContainerization `yaml:"bosh_containerization"`
	Properties           map[string]interface{} `yaml:",inline"`
}

JobProperties represents the properties map of a Job

func (*JobProperties) ToMap

func (p *JobProperties) ToMap() map[string]interface{}

ToMap returns a complete map with all properties, including the bosh_containerization key

type JobProviderLinks map[string]map[string]JobLink

JobProviderLinks provides links to other jobs, indexed by provider type and name

func (JobProviderLinks) Add added in v0.2.0

func (jpl JobProviderLinks) Add(job Job, spec JobSpec, jobsInstances []JobInstance) error

Add another job to the lookup map

func (JobProviderLinks) Lookup added in v0.2.0

func (jpl JobProviderLinks) Lookup(consumesType string, consumesName string) (JobLink, bool)

Lookup returns a link for a type and name, used when links are consumed

type JobSpec

type JobSpec struct {
	Name        string
	Description string
	Packages    []string
	Templates   map[string]string
	Properties  map[string]struct {
		Description string
		Default     interface{}
		Example     interface{}
	}
	Consumes []struct {
		Name     string
		Type     string
		Optional bool
	}
	Provides []struct {
		Name       string
		Type       string
		Properties []string
	}
}

JobSpec describes the contents of "job.MF" files

func (JobSpec) RetrieveNestedProperty added in v0.2.0

func (js JobSpec) RetrieveNestedProperty(propertyName string) map[string]interface{}

RetrieveNestedProperty will generate an nested struct based on a string of the type foo.bar

func (JobSpec) RetrievePropertyDefault added in v0.2.0

func (js JobSpec) RetrievePropertyDefault(propertyName string) interface{}

RetrievePropertyDefault return the default value of the spec property

type KubeConverter added in v0.2.2

type KubeConverter struct {
	// contains filtered or unexported fields
}

KubeConverter represents a Manifest in kube resources

func NewKubeConverter added in v0.2.2

func NewKubeConverter(namespace string) *KubeConverter

NewKubeConverter converts a Manifest into kube resources

func (*KubeConverter) BPMResources added in v0.2.2

func (kc *KubeConverter) BPMResources(manifestName string, instanceGroups []*InstanceGroup, releaseImageProvider releaseImageProvider, allBPMConfigs map[string]bpm.Configs) (*BPMResources, error)

BPMResources uses BOSH Process Manager information to create k8s container specs from BOSH instance groups. It returns extended stateful sets, services and extended jobs.

func (*KubeConverter) Variables added in v0.2.2

func (kc *KubeConverter) Variables(manifestName string, variables []Variable) []esv1.ExtendedSecret

Variables returns extended secrets for a list of BOSH variables

type Link struct {
	Name       string        `yaml:"name"`
	Instances  []JobInstance `yaml:"instances"`
	Properties interface{}   `yaml:"properties"`
}

Link with name for rendering

type Manifest

type Manifest struct {
	Name           string                   `yaml:"name"`
	DirectorUUID   string                   `yaml:"director_uuid"`
	InstanceGroups []*InstanceGroup         `yaml:"instance_groups,omitempty"`
	Features       *Feature                 `yaml:"features,omitempty"`
	Tags           map[string]string        `yaml:"tags,omitempty"`
	Releases       []*Release               `yaml:"releases,omitempty"`
	Stemcells      []*Stemcell              `yaml:"stemcells,omitempty"`
	AddOns         []*AddOn                 `yaml:"addons,omitempty"`
	Properties     []map[string]interface{} `yaml:"properties,omitempty"`
	Variables      []Variable               `yaml:"variables,omitempty"`
	Update         *Update                  `yaml:"update,omitempty"`
}

Manifest is a BOSH deployment manifest

func LoadYAML added in v0.2.2

func LoadYAML(data []byte) (*Manifest, error)

LoadYAML returns a new BOSH deployment manifest from a yaml representation

func (*Manifest) GetReleaseImage

func (m *Manifest) GetReleaseImage(instanceGroupName, jobName string) (string, error)

GetReleaseImage returns the release image location for a given instance group/job

func (*Manifest) InstanceGroupByName added in v0.2.2

func (m *Manifest) InstanceGroupByName(name string) (*InstanceGroup, error)

InstanceGroupByName returns the instance group identified by the given name

func (*Manifest) SHA1

func (m *Manifest) SHA1() (string, error)

SHA1 calculates the SHA1 of the manifest

type MigratedFrom

type MigratedFrom struct {
	Name string `yaml:"name"`
	Az   string `yaml:"az,omitempty"`
}

MigratedFrom from BOSH deployment manifest

type Network

type Network struct {
	Name      string   `yaml:"name"`
	StaticIps []string `yaml:"static_ips,omitempty"`
	Default   []string `yaml:"default,omitempty"`
}

Network from BOSH deployment manifest

type NewInterpolatorFunc added in v0.2.0

type NewInterpolatorFunc func() Interpolator

NewInterpolatorFunc returns a fresh Interpolator

type Port added in v0.2.0

type Port struct {
	Name     string `yaml:"name"`
	Protocol string `yaml:"protocol"`
	Internal int    `yaml:"internal"`
}

Port represents the port to be opened up for this job

type Release

type Release struct {
	Name     string           `yaml:"name"`
	Version  string           `yaml:"version"`
	URL      string           `yaml:"url,omitempty"`
	SHA1     string           `yaml:"sha1,omitempty"`
	Stemcell *ReleaseStemcell `yaml:"stemcell,omitempty"`
}

Release from BOSH deployment manifest

type ReleaseStemcell

type ReleaseStemcell struct {
	OS      string `yaml:"os"`
	Version string `yaml:"version"`
}

ReleaseStemcell from BOSH deployment manifest

type Resolver

type Resolver interface {
	ResolveManifest(instance *bdc.BOSHDeployment, namespace string) (*Manifest, error)
	ReadDesiredManifest(ctx context.Context, boshDeploymentName, namespace string) (*Manifest, error)
}

Resolver resolves references from CRD to a BOSH manifest

type ResolverImpl

type ResolverImpl struct {
	// contains filtered or unexported fields
}

ResolverImpl implements Resolver interface

func NewResolver

func NewResolver(client client.Client, f NewInterpolatorFunc) *ResolverImpl

NewResolver constructs a resolver

func (*ResolverImpl) ImplicitVariables added in v0.2.0

func (r *ResolverImpl) ImplicitVariables(m *Manifest, rawManifest string) ([]string, error)

ImplicitVariables returns a list of all implicit variables in a manifest

func (*ResolverImpl) ReadDesiredManifest added in v0.2.2

func (r *ResolverImpl) ReadDesiredManifest(ctx context.Context, boshDeploymentName, namespace string) (*Manifest, error)

ReadDesiredManifest reads the versioned secret created by the variable interpolation job and unmarshals it into a Manifest object

func (*ResolverImpl) ResolveManifest

func (r *ResolverImpl) ResolveManifest(instance *bdc.BOSHDeployment, namespace string) (*Manifest, error)

ResolveManifest returns manifest referenced by our CRD

type RunConfig added in v0.2.2

type RunConfig struct {
	HealthChecks map[string]HealthCheck `yaml:"healthcheck"`
}

RunConfig describes the runtime configuration for this job

type Stemcell

type Stemcell struct {
	Alias   string `yaml:"alias"`
	OS      string `yaml:"os,omitempty"`
	Version string `yaml:"version"`
	Name    string `yaml:"name,omitempty"`
}

Stemcell from BOSH deployment manifest

type Update

type Update struct {
	Canaries        int     `yaml:"canaries"`
	MaxInFlight     string  `yaml:"max_in_flight"`
	CanaryWatchTime string  `yaml:"canary_watch_time"`
	UpdateWatchTime string  `yaml:"update_watch_time"`
	Serial          bool    `yaml:"serial,omitempty"`
	VMStrategy      *string `yaml:"vm_strategy,omitempty"`
}

Update from BOSH deployment manifest

type VMResource

type VMResource struct {
	CPU               int `yaml:"cpu"`
	RAM               int `yaml:"ram"`
	EphemeralDiskSize int `yaml:"ephemeral_disk_size"`
}

VMResource from BOSH deployment manifest

type Variable

type Variable struct {
	Name    string           `yaml:"name"`
	Type    string           `yaml:"type"`
	Options *VariableOptions `yaml:"options,omitempty"`
}

Variable from BOSH deployment manifest

type VariableOptions

type VariableOptions struct {
	CommonName       string     `yaml:"common_name"`
	AlternativeNames []string   `yaml:"alternative_names,omitempty"`
	IsCA             bool       `yaml:"is_ca"`
	CA               string     `yaml:"ca,omitempty"`
	ExtendedKeyUsage []AuthType `yaml:"extended_key_usage,omitempty"`
}

VariableOptions from BOSH deployment manifest

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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