Documentation
¶
Overview ¶
Package manifest represents a valid BOSH manifest and provides funcs to load it, marshal it and access its fields.
Index ¶
- Constants
- Variables
- func InterpolateVariables(log *zap.SugaredLogger, boshManifestBytes []byte, variablesDir string, ...) error
- func RenderJobTemplates(boshManifestPath string, jobsDir string, jobsOutputDir string, ...) error
- type AddOn
- type AddOnJob
- type AddOnPlacementJob
- type AddOnPlacementRules
- type AddOnStemcell
- type Agent
- type AgentEnv
- type AgentEnvBoshConfig
- type AgentSettings
- type AuthType
- type Feature
- type HealthCheck
- type IPv6
- type InstanceGroup
- type InstanceGroupResolver
- type InstanceGroupType
- type Job
- type JobDir
- type JobInstance
- type JobLink
- type JobProperties
- type JobProviderLinks
- type JobSpec
- type JobSpecLink
- type JobSpecProvider
- type Manifest
- func (m *Manifest) ApplyAddons(ctx context.Context) error
- func (m *Manifest) GetJobOS(instanceGroupName, jobName string) (string, error)
- func (m *Manifest) GetReleaseImage(instanceGroupName, jobName string) (string, error)
- func (m *Manifest) ImplicitVariables() ([]string, error)
- func (m *Manifest) InstanceGroupByName(name string) (*InstanceGroup, error)
- func (m *Manifest) Marshal() ([]byte, error)
- func (m *Manifest) SHA1() (string, error)
- type MigratedFrom
- type Network
- type Port
- type PostStart
- type PostStartCondition
- type PreRenderScripts
- type Quarks
- type Release
- type ReleaseStemcell
- type RunConfig
- type Stemcell
- type Update
- type VMResource
- type Variable
- type VariableOptions
Constants ¶
const ( // DataDir the mount path for the data directory. DataDir = "/var/vcap/data" // SysDir the mount path for the sys directory. SysDir = "/var/vcap/sys" // JobSpecFilename is the name of the job spec manifest in an unpacked BOSH release JobSpecFilename = "job.MF" )
const ( ClientAuth AuthType = "client_auth" ServerAuth AuthType = "server_auth" IGTypeService InstanceGroupType = "service" IGTypeErrand InstanceGroupType = "errand" IGTypeAutoErrand InstanceGroupType = "auto-errand" IGTypeDefault InstanceGroupType = "" )
AuthType values from BOSH deployment manifest
const (
// DesiredManifestKeyName is the name of the key in desired manifest secret
DesiredManifestKeyName = "manifest.yaml"
)
Variables ¶
var ( // 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) // LabelDeploymentVersion is the name of a label for the deployment's version. LabelDeploymentVersion = fmt.Sprintf("%s/deployment-version", apis.GroupName) )
Functions ¶
func InterpolateVariables ¶ added in v0.2.0
func InterpolateVariables(log *zap.SugaredLogger, boshManifestBytes []byte, variablesDir string, outputFilePath string) error
InterpolateVariables reads explicit secrets from a folder and writes an interpolated manifest to the output.json file in /mnt/quarks volume mount.
func RenderJobTemplates ¶ added in v0.2.0
func RenderJobTemplates( boshManifestPath string, jobsDir string, jobsOutputDir string, instanceGroupName string, specIndex int, podName string, podIP net.IP, ) 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 `json:"name"`
Jobs []AddOnJob `json:"jobs"`
Include *AddOnPlacementRules `json:"include,omitempty"`
Exclude *AddOnPlacementRules `json:"exclude,omitempty"`
}
AddOn from BOSH deployment manifest
type AddOnJob ¶
type AddOnJob struct {
Name string `json:"name"`
Release string `json:"release"`
Properties JobProperties `json:"properties,omitempty"`
}
AddOnJob from BOSH deployment manifest
type AddOnPlacementJob ¶
AddOnPlacementJob from BOSH deployment manifest
type AddOnPlacementRules ¶
type AddOnPlacementRules struct {
Stemcell []*AddOnStemcell `json:"stemcell,omitempty"`
Deployments []string `json:"deployments,omitempty"`
Jobs []*AddOnPlacementJob `json:"release,omitempty"`
InstanceGroup []string `json:"instance_groups,omitempty"`
Networks []string `json:"networks,omitempty"`
Teams []string `json:"teams,omitempty"`
Lifecycle InstanceGroupType `json:"lifecycle,omitempty"`
}
AddOnPlacementRules from BOSH deployment manifest
type AddOnStemcell ¶
type AddOnStemcell struct {
OS string `json:"os"`
}
AddOnStemcell from BOSH deployment manifest
type Agent ¶
type Agent struct {
Settings AgentSettings `json:"settings,omitempty"`
Tmpfs *bool `json:"tmpfs,omitempty"`
}
Agent from BOSH deployment manifest.
type AgentEnv ¶
type AgentEnv struct {
PersistentDiskFS string `json:"persistent_disk_fs,omitempty"`
PersistentDiskMountOptions []string `json:"persistent_disk_mount_options,omitempty"`
AgentEnvBoshConfig AgentEnvBoshConfig `json:"bosh,omitempty"`
}
AgentEnv from BOSH deployment manifest.
type AgentEnvBoshConfig ¶
type AgentEnvBoshConfig struct {
Password string `json:"password,omitempty"`
KeepRootPassword string `json:"keep_root_password,omitempty"`
RemoveDevTools *bool `json:"remove_dev_tools,omitempty"`
RemoveStaticLibraries *bool `json:"remove_static_libraries,omitempty"`
SwapSize *int `json:"swap_size,omitempty"`
IPv6 IPv6 `json:"ipv6,omitempty"`
JobDir *JobDir `json:"job_dir,omitempty"`
Agent Agent `json:"agent,omitempty"`
}
AgentEnvBoshConfig from BOSH deployment manifest.
type AgentSettings ¶ added in v0.3.0
type AgentSettings struct {
Annotations map[string]string `json:"annotations,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
DisableLogSidecar bool `json:"disable_log_sidecar,omitempty" yaml:"disable_log_sidecar,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"`
AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty" yaml:"automountServiceAccountToken,omitempty"`
}
AgentSettings from BOSH deployment manifest. These annotations and labels are added to kube resources. Affinity is added into the pod's definition.
func (*AgentSettings) Set ¶ added in v0.3.0
func (as *AgentSettings) Set(manifestName, igName, version string)
Set overrides labels and annotations with operator-owned metadata.
type Feature ¶
type Feature struct {
ConvergeVariables bool `json:"converge_variables"`
RandomizeAzPlacement *bool `json:"randomize_az_placement,omitempty"`
UseDNSAddresses *bool `json:"use_dns_addresses,omitempty"`
UseTmpfsJobConfig *bool `json:"use_tmpfs_job_config,omitempty"`
}
Feature from BOSH deployment manifest
type HealthCheck ¶ added in v0.2.2
type HealthCheck struct {
ReadinessProbe *corev1.Probe `json:"readiness" yaml:"readiness"`
LivenessProbe *corev1.Probe `json:"liveness" yaml:"liveness"`
}
HealthCheck defines liveness and readiness probes for a container.
type InstanceGroup ¶
type InstanceGroup struct {
Name string `json:"name"`
Instances int `json:"instances"`
AZs []string `json:"azs"`
Jobs []Job `json:"jobs"`
VMType string `json:"vm_type,omitempty"`
VMExtensions []string `json:"vm_extensions,omitempty"`
VMResources *VMResource `json:"vm_resources"`
Stemcell string `json:"stemcell"`
PersistentDisk *int `json:"persistent_disk,omitempty"`
PersistentDiskType string `json:"persistent_disk_type,omitempty"`
Networks []*Network `json:"networks,omitempty"`
Update *Update `json:"update,omitempty"`
MigratedFrom []*MigratedFrom `json:"migrated_from,omitempty"`
LifeCycle InstanceGroupType `json:"lifecycle,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
Env AgentEnv `json:"env,omitempty"`
}
InstanceGroup from BOSH deployment manifest.
func (*InstanceGroup) ExtendedStatefulsetName ¶ added in v0.4.0
func (ig *InstanceGroup) ExtendedStatefulsetName(deploymentName string) string
ExtendedStatefulsetName constructs the ests name.
func (*InstanceGroup) HeadlessServiceName ¶ added in v0.4.0
func (ig *InstanceGroup) HeadlessServiceName(deploymentName string) string
HeadlessServiceName constructs the headless service name for the instance group.
func (*InstanceGroup) IndexedServiceName ¶ added in v0.4.0
func (ig *InstanceGroup) IndexedServiceName(deploymentName string, index int) string
IndexedServiceName constructs an indexed service name. It's used to construct the other service names other than the headless service.
func (*InstanceGroup) NameSanitized ¶ added in v0.4.0
func (ig *InstanceGroup) NameSanitized() string
NameSanitized returns the sanitized instance group name.
type InstanceGroupResolver ¶ added in v0.4.0
type InstanceGroupResolver struct {
// contains filtered or unexported fields
}
InstanceGroupResolver 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 NewInstanceGroupResolver ¶ added in v0.4.0
func NewInstanceGroupResolver(basedir, namespace string, manifest Manifest, instanceGroupName string) (*InstanceGroupResolver, error)
NewInstanceGroupResolver returns a data gatherer with logging for a given input manifest and instance group
func (*InstanceGroupResolver) BPMConfigs ¶ added in v0.4.0
func (dg *InstanceGroupResolver) BPMConfigs() (bpm.Configs, error)
BPMConfigs returns a map of all BOSH jobs in the instance group The output will be persisted by ExtendedJob as 'bpm.yaml' in the `<deployment-name>.bpm.<instance-group>-v<version>` secret.
func (*InstanceGroupResolver) Manifest ¶ added in v0.4.0
func (dg *InstanceGroupResolver) Manifest() (Manifest, error)
Manifest returns a manifest for a specific instance group only. That manifest includes the gathered data from BPM and links. The output will be persisted by ExtendedJob as 'properties.yaml' in the `<deployment-name>.ig-resolved.<instance-group>-v<version>` secret.
type InstanceGroupType ¶ added in v0.4.0
type InstanceGroupType string
InstanceGroupType represents instance groups types
type Job ¶
type Job struct {
Name string `json:"name"`
Release string `json:"release"`
Consumes map[string]interface{} `json:"consumes,omitempty"`
Provides map[string]interface{} `json:"provides,omitempty"`
Properties JobProperties `json:"properties,omitempty"`
}
Job from BOSH deployment manifest
func (*Job) DataDirs ¶ added in v0.4.0
DataDirs returns all data dirs a BOSH job expects
func (Job) Property ¶ added in v0.2.0
Property search for property value in the job properties
type JobDir ¶
type JobDir struct {
Tmpfs *bool `json:"tmpfs,omitempty"`
TmpfsSize string `json:"tmpfs_size,omitempty"`
}
JobDir from BOSH deployment manifest.
type JobInstance ¶
type JobInstance struct {
Address string `json:"address"`
AZ string `json:"az"`
Index int `json:"index"`
Instance int `json:"instance"`
Name string `json:"name"`
Bootstrap bool `json:"bootstrap"`
Network map[string]interface{} `json:"networks"`
}
JobInstance for data gathering.
type JobLink ¶
type JobLink struct {
Address string `json:"address"`
Instances []JobInstance `json:"instances"`
Properties map[string]interface{} `json:"properties"`
}
JobLink describes links inside a job properties quarks.
type JobProperties ¶
type JobProperties struct {
Quarks Quarks `json:"quarks"`
Properties map[string]interface{} `json:"-"`
}
JobProperties represents the properties map of a Job
func (*JobProperties) FromMap ¶ added in v0.4.0
func (p *JobProperties) FromMap(properties map[string]interface{}) error
FromMap populates a JobProperties based on a map
func (*JobProperties) MarshalJSON ¶ added in v0.4.0
func (p *JobProperties) MarshalJSON() ([]byte, error)
MarshalJSON is implemented to support inlining Properties
func (*JobProperties) ToMap ¶
func (p *JobProperties) ToMap() map[string]interface{}
ToMap returns a complete map with all properties, including the quarks key
func (*JobProperties) UnmarshalJSON ¶ added in v0.4.0
func (p *JobProperties) UnmarshalJSON(b []byte) error
UnmarshalJSON is implemented to support inlining properties
type JobProviderLinks ¶ added in v0.2.0
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, linkAddress string) error
Add another job to the lookup map
func (JobProviderLinks) Lookup ¶ added in v0.2.0
func (jpl JobProviderLinks) Lookup(provider *JobSpecProvider) (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 []JobSpecProvider
Provides []JobSpecLink
}
JobSpec describes the contents of "job.MF" files
func (JobSpec) RetrieveNestedProperty ¶ added in v0.2.0
RetrieveNestedProperty will generate a nested struct based on a string of the type foo.bar in the provided map It overrides existing property paths that are not of the correct type.
type JobSpecLink ¶ added in v0.3.0
JobSpecLink represents a link in the job spec Provides field.
type JobSpecProvider ¶ added in v0.3.0
JobSpecProvider represents a provider in the job spec Consumes field.
type Manifest ¶
type Manifest struct {
Name string `json:"name"`
DirectorUUID string `json:"director_uuid"`
InstanceGroups []*InstanceGroup `json:"instance_groups,omitempty"`
Features *Feature `json:"features,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Releases []*Release `json:"releases,omitempty"`
Stemcells []*Stemcell `json:"stemcells,omitempty"`
AddOns []*AddOn `json:"addons,omitempty"`
Properties []map[string]interface{} `json:"properties,omitempty"`
Variables []Variable `json:"variables,omitempty"`
Update *Update `json:"update,omitempty"`
}
Manifest is a BOSH deployment manifest
func LoadYAML ¶ added in v0.2.2
LoadYAML returns a new BOSH deployment manifest from a yaml representation
func (*Manifest) ApplyAddons ¶ added in v0.4.0
ApplyAddons goes through all defined addons and adds jobs to matched instance groups
func (*Manifest) GetJobOS ¶ added in v0.4.0
GetJobOS returns the stemcell layer OS used for a Job This is used for matching addon placement rules
func (*Manifest) GetReleaseImage ¶
GetReleaseImage returns the release image location for a given instance group/job
func (*Manifest) ImplicitVariables ¶ added in v0.4.0
ImplicitVariables returns a list of all implicit variables in a manifest
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) Marshal ¶ added in v0.3.1
Marshal serializes a BOSH manifest into yaml
type MigratedFrom ¶
MigratedFrom from BOSH deployment manifest.
type Network ¶
type Network struct {
Name string `json:"name"`
StaticIps []string `json:"static_ips,omitempty"`
Default []string `json:"default,omitempty"`
}
Network from BOSH deployment manifest.
type Port ¶ added in v0.2.0
type Port struct {
Name string `json:"name"`
Protocol string `json:"protocol"`
Internal int `json:"internal"`
}
Port represents the port to be opened up for this job.
type PostStart ¶ added in v0.4.0
type PostStart struct {
Condition *PostStartCondition `json:"condition,omitempty"`
}
PostStart allows post-start specifics to be passed through the manifest.
type PostStartCondition ¶ added in v0.4.0
type PostStartCondition struct {
Exec *corev1.ExecAction `json:"exec,omitempty"`
}
PostStartCondition represents the condition that should succeed in order to execute the post-start script. It's often set to be the same as the readiness probe of a job.
type PreRenderScripts ¶ added in v0.4.0
type PreRenderScripts struct {
BPM []string `json:"bpm" yaml:"bpm"`
IgResolver []string `json:"ig_resolver" yaml:"ig_resolver"`
Jobs []string `json:"jobs" yaml:"jobs"`
}
PreRenderScripts describes the different types of scripts that can be run inside a job.
type Quarks ¶ added in v0.4.0
type Quarks struct {
Consumes map[string]JobLink `json:"consumes"`
Instances []JobInstance `json:"instances"`
Release string `json:"release"`
BPM *bpm.Config `json:"bpm,omitempty" yaml:"bpm,omitempty"`
Ports []Port `json:"ports"`
Run RunConfig `json:"run"`
PreRenderScripts PreRenderScripts `json:"pre_render_scripts" yaml:"pre_render_scripts"`
PostStart PostStart `json:"post_start"`
Debug bool `json:"debug" yaml:"debug"`
IsAddon bool `json:"is_addon" yaml:"is_addon"`
Envs []corev1.EnvVar `json:"envs" yaml:"envs"`
}
Quarks represents the special 'quarks' property key. It contains all kubernetes structures we need to add to the BOSH manifest.
type Release ¶
type Release struct {
Name string `json:"name"`
Version string `json:"version"`
URL string `json:"url,omitempty"`
SHA1 string `json:"sha1,omitempty"`
Stemcell *ReleaseStemcell `json:"stemcell,omitempty"`
}
Release from BOSH deployment manifest
type ReleaseStemcell ¶
ReleaseStemcell from BOSH deployment manifest
type RunConfig ¶ added in v0.2.2
type RunConfig struct {
HealthCheck map[string]HealthCheck `json:"healthcheck" yaml:"healthcheck"`
SecurityContext *corev1.SecurityContext `json:"security_context" yaml:"security_context"`
}
RunConfig describes the runtime configuration for this job.
type Stemcell ¶
type Stemcell struct {
Alias string `json:"alias"`
OS string `json:"os,omitempty"`
Version string `json:"version"`
Name string `json:"name,omitempty"`
}
Stemcell from BOSH deployment manifest
type Update ¶
type Update struct {
Canaries int `json:"canaries"`
MaxInFlight string `json:"max_in_flight"`
CanaryWatchTime string `json:"canary_watch_time"`
UpdateWatchTime string `json:"update_watch_time"`
Serial bool `json:"serial,omitempty"`
VMStrategy *string `json:"vm_strategy,omitempty"`
}
Update from BOSH deployment manifest.
type VMResource ¶
type VMResource struct {
CPU int `json:"cpu"`
RAM int `json:"ram"`
EphemeralDiskSize int `json:"ephemeral_disk_size"`
}
VMResource from BOSH deployment manifest.
type Variable ¶
type Variable struct {
Name string `json:"name"`
Type string `json:"type"`
Options *VariableOptions `json:"options,omitempty"`
}
Variable from BOSH deployment manifest
type VariableOptions ¶
type VariableOptions struct {
CommonName string `json:"common_name"`
AlternativeNames []string `json:"alternative_names,omitempty"`
IsCA bool `json:"is_ca"`
CA string `json:"ca,omitempty"`
ExtendedKeyUsage []AuthType `json:"extended_key_usage,omitempty"`
SignerType string `json:"signer_type,omitempty"`
ServiceRef []esv1.ServiceReference `json:"serviceRef,omitempty"`
ActivateEKSWorkaroundForSAN bool `json:"activateEKSWorkaroundForSAN,omitempty"`
}
VariableOptions from BOSH deployment manifest
Source Files
¶
- addon_placement.go
- cmd_instance_group_resolver.go
- cmd_interpolate.go
- cmd_render_job_tmpls.go
- containerization.go
- instance_group.go
- job.go
- job_provider_links.go
- manifest.go