manifest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VarInterpolationContainerName is the name of the container that performs
	// variable interpolation for a manifest
	VarInterpolationContainerName = "interpolation"
	// DesiredManifestKeyName is the name of the key in desired manifest secret
	DesiredManifestKeyName = "manifest.yaml"
)

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 = ""
	// LabelDeploymentName is the name of a label for the deployment name
	LabelDeploymentName = fmt.Sprintf("%s/deployment-name", apis.GroupName)
	// 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

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"`
}

BOSHContainerization represents the special 'bosh_containerization' property key

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, namespace string, manifest *Manifest) *DataGatherer

NewDataGatherer returns a data gatherer with logging for a given input manifest

func (dg *DataGatherer) CollectReleaseSpecsAndProviderLinks(baseDir string) (map[string]map[string]JobSpec, JobProviderLinks, error)

CollectReleaseSpecsAndProviderLinks will collect all release specs and generate bosh links for provider jobs

func (*DataGatherer) GenerateManifest added in v0.2.0

func (dg *DataGatherer) GenerateManifest(baseDir string, instanceGroupName string) ([]byte, error)

GenerateManifest will collect different data and return a deployment manifest for an instance group. See docs/rendering_templates.md#calculation-of-required-properties-for-an-instance-group-and-render-bpm

Data gathered: * job spec information * job properties * bosh links * bpm yaml file data

func (*DataGatherer) ProcessConsumersAndRenderBPM added in v0.2.0

func (dg *DataGatherer) ProcessConsumersAndRenderBPM(baseDir string, jobReleaseSpecs map[string]map[string]JobSpec, jobProviderLinks map[string]map[string]JobLink, instanceGroupName string) ([]byte, error)

ProcessConsumersAndRenderBPM will generate a proper context for links and render the required ERB files

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 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 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

func (JobProviderLinks) Add added in v0.2.0

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

func (JobProviderLinks) Lookup added in v0.2.0

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

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 KubeConfig

type KubeConfig struct {
	Variables                []esv1.ExtendedSecret
	InstanceGroups           []essv1.ExtendedStatefulSet
	Errands                  []ejv1.ExtendedJob
	Services                 []corev1.Service
	Namespace                string
	VariableInterpolationJob *ejv1.ExtendedJob
	DataGatheringJob         *ejv1.ExtendedJob
}

KubeConfig represents a Manifest in kube resources

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 (*Manifest) ApplyBPMInfo

func (m *Manifest) ApplyBPMInfo(kubeConfig *KubeConfig, allResolvedProperties map[string]Manifest) error

ApplyBPMInfo uses BOSH Process Manager information to update container information like entrypoint, env vars, etc.

func (*Manifest) ConvertToKube

func (m *Manifest) ConvertToKube(namespace string) (KubeConfig, error)

ConvertToKube converts a Manifest into kube resources

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) JobSpecCopierContainer added in v0.2.0

func (m *Manifest) JobSpecCopierContainer(releaseName string, releaseImage string, volumeMountName string) corev1.Container

JobSpecCopierContainer will return a corev1.Container{} with the populated field

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)
}

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) ResolveManifest

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

ResolveManifest returns manifest referenced by our CRD

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