Documentation ¶
Index ¶
- Constants
- func AggregateSignatures(signatures []string) string
- func FlattenOpinions(opinions map[string]interface{}, total bool) map[string]string
- func LeastPodSecurityPolicy() string
- func MergePodSecurityPolicies(policyA, policyB string) string
- func PodSecurityPolicies() []string
- func ValidPodSecurityPolicy(name string) bool
- type AuthAccount
- type AuthRole
- type AuthRule
- type CVMap
- type CVOptions
- type CVType
- type Configuration
- type FlightStage
- type HealthCheck
- type HealthProbe
- type InstanceGroup
- func (g *InstanceGroup) ColocatedContainers() []string
- func (g *InstanceGroup) GetColocatedRoles() InstanceGroups
- func (g *InstanceGroup) GetLongDescription() string
- func (g *InstanceGroup) GetRoleDevVersion(opinions *Opinions, tagExtra, fissileVersion string, grapher util.ModelGrapher) (string, error)
- func (g *InstanceGroup) GetScriptPaths() map[string]string
- func (g *InstanceGroup) GetScriptSignatures() (string, error)
- func (g *InstanceGroup) GetTemplateSignatures() (string, error)
- func (r *InstanceGroup) GetVariablesForRole() (Variables, error)
- func (g *InstanceGroup) HasTag(tag RoleTag) bool
- func (g *InstanceGroup) IsColocated() bool
- func (g *InstanceGroup) IsPrivileged() bool
- func (g *InstanceGroup) LookupJob(name string) *JobReference
- func (g *InstanceGroup) PodSecurityPolicy() string
- func (g *InstanceGroup) Validate(mappedReleases releaseByName) validation.ErrorList
- type InstanceGroups
- type Job
- type JobBoshContainerization
- type JobContainerProperties
- type JobExposedPort
- type JobProperty
- type JobReference
- type JobReferences
- type JobTemplate
- type Jobs
- type LoadRoleManifestOptions
- type Opinions
- type Package
- func (p *Package) Extract(destination string) (string, error)
- func (p *Package) GetPackageCompiledDir(workDir string) string
- func (p *Package) GetPackageCompiledTempDir(workDir string) string
- func (p *Package) GetTargetPackageSourcesDir(workDir string) string
- func (p *Package) Marshal() (interface{}, error)
- func (p *Package) ValidateSHA1() error
- type Packages
- type Release
- type ReleaseConfig
- type ReleaseLicense
- type ReleaseRef
- type RoleManifest
- type RoleManifestValidationOptions
- type RoleRun
- type RoleRunAffinity
- type RoleRunCPU
- type RoleRunMemory
- type RoleRunScaling
- type RoleRunVolume
- type RoleTag
- type RoleType
- type VariableDefinition
- type VariableOptions
- type Variables
- type VolumeType
Constants ¶
const ( RoleTypeBoshTask = RoleType("bosh-task") // A role that is a BOSH task RoleTypeBosh = RoleType("bosh") // A role that is a BOSH job RoleTypeColocatedContainer = RoleType("colocated-container") // A role that is supposed to be used by other roles to specify a colocated container )
These are the types of roles available
const ( RoleTagStopOnFailure = RoleTag("stop-on-failure") RoleTagSequentialStartup = RoleTag("sequential-startup") RoleTagActivePassive = RoleTag("active-passive") )
The list of acceptable tags
const ( PodSecurityPolicyNonPrivileged = "nonprivileged" PodSecurityPolicyPrivileged = "privileged" )
Pod security policy constants
const ( VolumeTypePersistent = VolumeType("persistent") // A volume that is only used for this instance of the role VolumeTypeHost = VolumeType("host") // A volume that is a mount of a host directory VolumeTypeNone = VolumeType("none") // A volume that isn't mounted to anything VolumeTypeEmptyDir = VolumeType("emptyDir") // A volume that is shared between containers )
These are the volume type available
const ( FlightStagePreFlight = FlightStage("pre-flight") // A role that runs before the main jobs start FlightStageFlight = FlightStage("flight") // A role that is a main job FlightStagePostFlight = FlightStage("post-flight") // A role that runs after the main jobs are up FlightStageManual = FlightStage("manual") // A role that only runs via user intervention )
These are the flight stages available
const ( // CVTypeUser is for user-specified variables (default) CVTypeUser = CVType("user") // CVTypeEnv is for script-specified variables CVTypeEnv = CVType("environment") )
Variables ¶
This section is empty.
Functions ¶
func AggregateSignatures ¶
AggregateSignatures returns the SHA1 for a slice of strings
func FlattenOpinions ¶
FlattenOpinions converts the incoming nested map of opinions into a flat map of properties to values (strings). When 'total' is set (to true) array values are recursed into and flattened as well.
func LeastPodSecurityPolicy ¶
func LeastPodSecurityPolicy() string
LeastPodSecurityPolicy returns the name of the bottom-level pod security policy (least-privileged)
func MergePodSecurityPolicies ¶
MergePodSecurityPolicies takes two policies (names) and returns the policy (name) representing the union of their privileges.
func PodSecurityPolicies ¶
func PodSecurityPolicies() []string
PodSecurityPolicies returns the names of the pod security policies usable in fissile manifests
func ValidPodSecurityPolicy ¶
ValidPodSecurityPolicy checks if the argument is the name of a fissile pod security policy
Types ¶
type AuthAccount ¶
An AuthAccount is a service account for RBAC authorization The NumGroups field records the number of instance groups referencing the account in question.
type AuthRule ¶
type AuthRule struct { APIGroups []string `yaml:"apiGroups"` Resources []string `yaml:"resources"` Verbs []string `yaml:"verbs"` }
An AuthRule is a single rule for a RBAC authorization role
type CVMap ¶
type CVMap map[string]*VariableDefinition
CVMap is a map from variable name to ConfigurationVariable, for various places which require quick access/search/existence check.
func MakeMapOfVariables ¶
func MakeMapOfVariables(roleManifest *RoleManifest) CVMap
MakeMapOfVariables converts the sequence of configuration variables into a map we can manipulate more directly by name.
type CVOptions ¶
type CVOptions struct { PreviousNames []string `yaml:"previous_names"` Default interface{} `yaml:"default"` Description string `yaml:"description"` Example string `yaml:"example"` Type CVType `yaml:"type"` Internal bool `yaml:"internal,omitempty"` Secret bool `yaml:"secret,omitempty"` Required bool `yaml:"required,omitempty"` Immutable bool `yaml:"immutable,omitempty"` }
CVOptions is a configuration to be exposed to the IaaS
Notes on the fields Type and Internal.
Type's legal values are `user` and `environment`. `user` is default.
A `user` CV is rendered into k8s yml config files, etc. to make it available to roles who need it. - An internal CV is rendered to all roles. - A public CV is rendered only to the roles whose templates refer to the CV.
An `environment` CV comes from a script, not the user. Being internal this way it is not rendered to any configuration files.
- Internal's legal values are all YAML boolean values. A public CV is used in templates An internal CV is not, consumed in a script instead.
type CVType ¶
type CVType string
CVType is the type of the configuration variable; see the constants below
type Configuration ¶
type Configuration struct { Authorization struct { RoleUse map[string]int Roles map[string]AuthRole `yaml:"roles,omitempty"` Accounts map[string]AuthAccount `yaml:"accounts,omitempty"` } `yaml:"auth,omitempty"` Templates yaml.MapSlice `yaml:"templates"` }
Configuration contains information about how to configure the resulting images
type HealthCheck ¶
type HealthCheck struct { Liveness *HealthProbe `yaml:"liveness,omitempty"` // Details of liveness probe configuration Readiness *HealthProbe `yaml:"readiness,omitempty"` // Ditto for readiness probe }
HealthCheck describes a non-standard health check endpoint
type HealthProbe ¶
type HealthProbe struct { URL string `yaml:"url"` // URL for a HTTP GET to return 200~399. Cannot be used with other checks. Headers map[string]string `yaml:"headers"` // Custom headers; only used for URL. Command []string `yaml:"command,omitempty"` // Individual commands to run inside the container; each is interpreted as a shell command. Cannot be used with other checks. Port int `yaml:"port"` // Port for a TCP probe. Cannot be used with other checks. InitialDelay int `yaml:"initial_delay,omitempty"` // Initial Delay in seconds, default 3, minimum 1 Period int `yaml:"period,omitempty"` // Period in seconds, default 10, minimum 1 Timeout int `yaml:"timeout,omitempty"` // Timeout in seconds, default 3, minimum 1 SuccessThreshold int `yaml:"success_threshold,omitempty"` // Success threshold in seconds, default 1, minimum 1 FailureThreshold int `yaml:"failure_threshold,omitempty"` // Failure threshold in seconds, default 3, minimum 1 }
HealthProbe holds the configuration for liveness and readiness probes based on the HealthCheck containing them.
type InstanceGroup ¶
type InstanceGroup struct { Name string `yaml:"name"` Description string `yaml:"description"` EnvironScripts []string `yaml:"environment_scripts"` Scripts []string `yaml:"scripts"` PostConfigScripts []string `yaml:"post_config_scripts"` Type RoleType `yaml:"type,omitempty"` JobReferences JobReferences `yaml:"jobs"` Configuration *Configuration `yaml:"configuration"` Tags []RoleTag `yaml:"tags"` Run *RoleRun `yaml:"-"` // contains filtered or unexported fields }
InstanceGroup represents a collection of jobs that are colocated on a container
func (*InstanceGroup) ColocatedContainers ¶
func (g *InstanceGroup) ColocatedContainers() []string
ColocatedContainers returns colocated_container entries from all jobs
func (*InstanceGroup) GetColocatedRoles ¶
func (g *InstanceGroup) GetColocatedRoles() InstanceGroups
GetColocatedRoles lists all colocation roles references by this instance group
func (*InstanceGroup) GetLongDescription ¶
func (g *InstanceGroup) GetLongDescription() string
GetLongDescription returns the description of the instance group plus a list of all included jobs
func (*InstanceGroup) GetRoleDevVersion ¶
func (g *InstanceGroup) GetRoleDevVersion(opinions *Opinions, tagExtra, fissileVersion string, grapher util.ModelGrapher) (string, error)
GetRoleDevVersion determines the version hash for the role, using the basic role dev version, and the aggregated spec and opinion information. In this manner opinion changes cause a rebuild of the associated role images.
func (*InstanceGroup) GetScriptPaths ¶
func (g *InstanceGroup) GetScriptPaths() map[string]string
GetScriptPaths returns the paths to the startup / post configgin scripts for a instance group
func (*InstanceGroup) GetScriptSignatures ¶
func (g *InstanceGroup) GetScriptSignatures() (string, error)
GetScriptSignatures returns the SHA1 of all of the script file names and contents
func (*InstanceGroup) GetTemplateSignatures ¶
func (g *InstanceGroup) GetTemplateSignatures() (string, error)
GetTemplateSignatures returns the SHA1 of all of the templates and contents
func (*InstanceGroup) GetVariablesForRole ¶
func (r *InstanceGroup) GetVariablesForRole() (Variables, error)
GetVariablesForRole returns all the environment variables required for calculating all the templates for the role
func (*InstanceGroup) HasTag ¶
func (g *InstanceGroup) HasTag(tag RoleTag) bool
HasTag returns true if the role has a specific tag
func (*InstanceGroup) IsColocated ¶
func (g *InstanceGroup) IsColocated() bool
IsColocated tests if the role is of type ColocatedContainer, or not. It returns true if this role is of that type, or false otherwise.
func (*InstanceGroup) IsPrivileged ¶
func (g *InstanceGroup) IsPrivileged() bool
IsPrivileged tests if the instance group capabilities enable fully privileged mode.
func (*InstanceGroup) LookupJob ¶
func (g *InstanceGroup) LookupJob(name string) *JobReference
LookupJob will find the given job in this role, or nil if not found
func (*InstanceGroup) PodSecurityPolicy ¶
func (g *InstanceGroup) PodSecurityPolicy() string
PodSecurityPolicy determines the name of the pod security policy governing the specified instance group.
func (*InstanceGroup) Validate ¶
func (g *InstanceGroup) Validate(mappedReleases releaseByName) validation.ErrorList
Validate implements several checks for the instance group and its job references. It's run after the instance groups are filtered and i.e. Run has been calculated.
type InstanceGroups ¶
type InstanceGroups []*InstanceGroup
InstanceGroups is an array of Role*
func (InstanceGroups) Len ¶
func (igs InstanceGroups) Len() int
Len is the number of instance groups in the slice
func (InstanceGroups) Less ¶
func (igs InstanceGroups) Less(i, j int) bool
Less reports whether role at index i sort before role at index j
func (InstanceGroups) Swap ¶
func (igs InstanceGroups) Swap(i, j int)
Swap exchanges roles at index i and index j
type Job ¶
type Job struct { Name string Description string Templates []*JobTemplate Packages Packages Path string Fingerprint string SHA1 string Properties []*JobProperty Version string Release *Release AvailableProviders map[string]jobProvidesInfo DesiredConsumers []jobConsumesInfo // contains filtered or unexported fields }
Job represents a BOSH job
func (*Job) Extract ¶
Extract will extract the contents of the job archive to destination It creates a directory with the name of the job Returns the full path of the extracted archive
func (*Job) GetPropertiesForJob ¶
GetPropertiesForJob returns the parameters for the given job, using its specs and opinions
func (*Job) MergeSpec ¶
MergeSpec is used to merge temporary spec patches into each job. otherJob should only be the fissile-compat/patch-properties job. The code assumes package and property objects are immutable, as they're now being shared across jobs. Also, when specified packages or properties are specified in the "other" job, that one takes precedence.
func (*Job) ValidateSHA1 ¶
ValidateSHA1 validates that the SHA1 of the actual job archive is the same as the one from the release manifest
type JobBoshContainerization ¶
type JobBoshContainerization struct { PodSecurityPolicy string `yaml:"pod-security-policy,omitempty"` Ports []JobExposedPort `yaml:"ports"` Run *RoleRun `yaml:"run"` ColocatedContainers []string `yaml:"colocated_containers,omitempty"` ServiceName string `yaml:"service_name,omitempty"` }
JobBoshContainerization describes settings specific to containerization
type JobContainerProperties ¶
type JobContainerProperties struct {
BoshContainerization JobBoshContainerization `yaml:"bosh_containerization"`
}
JobContainerProperties describes job configuration
type JobExposedPort ¶
type JobExposedPort struct { Name string `yaml:"name"` Protocol string `yaml:"protocol"` External string `yaml:"external"` Internal string `yaml:"internal"` Public bool `yaml:"public"` Count int `yaml:"count"` Max int `yaml:"max"` PortIsConfigurable bool `yaml:"port-configurable"` CountIsConfigurable bool `yaml:"count-configurable"` InternalPort int ExternalPort int }
JobExposedPort describes a port to be available to other jobs, or the outside world
type JobProperty ¶
JobProperty is a generic key-value property referenced by a job
func (*JobProperty) MarshalJSON ¶
func (p *JobProperty) MarshalJSON() ([]byte, error)
MarshalJSON implements the encoding/json.Marshaler interface
func (*JobProperty) MarshalYAML ¶
func (p *JobProperty) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface
type JobReference ¶
type JobReference struct { *Job `yaml:"-"` // The resolved job Name string `yaml:"name"` // The name of the job ReleaseName string `yaml:"release"` // The release the job comes from ExportedProviders map[string]jobProvidesInfo `yaml:"provides"` ResolvedConsumers map[string]jobConsumesInfo `yaml:"consumes"` ContainerProperties JobContainerProperties `yaml:"properties"` }
JobReference represents a job in the context of a role
func (*JobReference) WriteConfigs ¶
func (j *JobReference) WriteConfigs(instanceGroup *InstanceGroup, lightOpinionsPath, darkOpinionsPath string) ([]byte, error)
WriteConfigs merges the job's spec with the opinions and returns the result as JSON.
type JobReferences ¶
type JobReferences []*JobReference
JobReferences is a collection of pointers to job references
func (JobReferences) WithRunProperty ¶
func (jobs JobReferences) WithRunProperty() JobReferences
WithRunProperty returns all jobs with a BOSH containerization run property could cache this on InstanceGroup if it turns out to be expensive
type JobTemplate ¶
JobTemplate represents a BOSH job template
func (*JobTemplate) Marshal ¶
func (t *JobTemplate) Marshal() (interface{}, error)
Marshal implements the util.Marshaler interface
type Jobs ¶
type Jobs []*Job
Jobs is an array of Job*
type LoadRoleManifestOptions ¶
type LoadRoleManifestOptions struct { ReleasePaths []string ReleaseNames []string ReleaseVersions []string BOSHCacheDir string Grapher util.ModelGrapher ValidationOptions RoleManifestValidationOptions }
LoadRoleManifestOptions provides the input to LoadRoleManifest()
type Opinions ¶
Opinions holds the light and dark opinions given to fissile
func NewEmptyOpinions ¶
func NewEmptyOpinions() *Opinions
NewEmptyOpinions returns an empty opinions object, used for testing and generating the version of the package layer, that doesn't change if opinions change
func NewOpinions ¶
NewOpinions returns the json opinions for the light and dark opinion files
func (*Opinions) GetOpinionForKey ¶
func (o *Opinions) GetOpinionForKey(opinions map[string]interface{}, keyPieces []string) (result interface{})
GetOpinionForKey pulls an opinion out of the holding container.
type Package ¶
type Package struct { Name string Version string Fingerprint string SHA1 string Release *Release Path string Dependencies Packages // contains filtered or unexported fields }
Package represents a BOSH package
func (*Package) Extract ¶
Extract will extract the contents of the package archive to destination It creates a directory with the name of the package Returns the full path of the extracted archive
func (*Package) GetPackageCompiledDir ¶
GetPackageCompiledDir returns the path to the build result directory of the package, underneath the main cache directory
func (*Package) GetPackageCompiledTempDir ¶
GetPackageCompiledTempDir returns the path to the build temp directory for the package, underneath the main cache directory
func (*Package) GetTargetPackageSourcesDir ¶
GetTargetPackageSourcesDir returns the path to the sources of the package, underneath the main cache directory
func (*Package) ValidateSHA1 ¶
ValidateSHA1 validates that the SHA1 of the actual package archive is the same as the one from the release manifest
type Packages ¶
type Packages []*Package
Packages is an array of *Package
type Release ¶
type Release struct { Jobs Jobs Packages Packages License ReleaseLicense Name string UncommittedChanges bool CommitHash string Version string Path string DevBOSHCacheDir string FinalRelease bool // contains filtered or unexported fields }
Release represents a BOSH release
func LoadReleases ¶
func LoadReleases(releasePaths, releaseNames, releaseVersions []string, cacheDir string) ([]*Release, error)
LoadReleases loads information about BOSH releases
func NewDevRelease ¶
NewDevRelease will create an instance of a BOSH development release
func NewFinalRelease ¶
NewFinalRelease will create an instance of a BOSH final release
func (*Release) GetUniqueConfigs ¶
func (r *Release) GetUniqueConfigs() map[string]*ReleaseConfig
GetUniqueConfigs returns all unique configs available in a release
func (*Release) LookupPackage ¶
LookupPackage will find a package within a BOSH release
func (*Release) ReleaseType ¶
ReleaseType returns a string identifying the type of the release: Dev or Final.
type ReleaseConfig ¶
ReleaseConfig is a global deployment configuration key
type ReleaseLicense ¶
type ReleaseLicense struct { // Files is a mapping of license file names to contents Files map[string][]byte // Release this license belongs to Release *Release }
ReleaseLicense represents the license of a BOSH release
type ReleaseRef ¶
type ReleaseRef struct { Name string `yaml:"name"` URL string `yaml:"url"` SHA1 string `yaml:"sha1"` Version string `yaml:"version"` }
ReleaseRef represents a reference to a BOSH release from a manifest
type RoleManifest ¶
type RoleManifest struct { InstanceGroups InstanceGroups `yaml:"instance_groups"` Configuration *Configuration `yaml:"configuration"` Variables Variables Releases []*ReleaseRef `yaml:"releases"` LoadedReleases []*Release // contains filtered or unexported fields }
RoleManifest represents a collection of roles
func LoadRoleManifest ¶
func LoadRoleManifest(manifestFilePath string, options LoadRoleManifestOptions) (*RoleManifest, error)
LoadRoleManifest loads a yaml manifest that details how jobs get grouped into roles
func (*RoleManifest) LookupInstanceGroup ¶
func (m *RoleManifest) LookupInstanceGroup(name string) *InstanceGroup
LookupInstanceGroup will find the given instance group in the role manifest
func (*RoleManifest) SelectInstanceGroups ¶
func (m *RoleManifest) SelectInstanceGroups(roleNames []string) (InstanceGroups, error)
SelectInstanceGroups will find only the given instance groups in the role manifest
type RoleManifestValidationOptions ¶
type RoleManifestValidationOptions struct {
AllowMissingScripts bool
}
RoleManifestValidationOptions allows tests to skip some parts of validation
type RoleRun ¶
type RoleRun struct { Scaling *RoleRunScaling `yaml:"scaling"` Capabilities []string `yaml:"capabilities"` PersistentVolumes []*RoleRunVolume `yaml:"persistent-volumes"` // Backwards compat only Volumes []*RoleRunVolume `yaml:"volumes"` MemRequest *int64 `yaml:"memory"` Memory *RoleRunMemory `yaml:"mem"` VirtualCPUs *float64 `yaml:"virtual-cpus"` CPU *RoleRunCPU `yaml:"cpu"` FlightStage FlightStage `yaml:"flight-stage"` HealthCheck *HealthCheck `yaml:"healthcheck,omitempty"` ActivePassiveProbe string `yaml:"active-passive-probe,omitempty"` ServiceAccount string `yaml:"service-account,omitempty"` Affinity *RoleRunAffinity `yaml:"affinity,omitempty"` }
RoleRun describes how a role should behave at runtime
type RoleRunAffinity ¶
type RoleRunAffinity struct { PodAntiAffinity interface{} `yaml:"podAntiAffinity,omitempty"` PodAffinity interface{} `yaml:"podAffinity,omitempty"` NodeAffinity interface{} `yaml:"nodeAffinity,omitempty"` }
RoleRunAffinity describes how a role should behave with regard to node / pod selection
type RoleRunCPU ¶
RoleRunCPU describes how a role should behave with regard to cpu usage.
type RoleRunMemory ¶
RoleRunMemory describes how a role should behave with regard to memory usage.
type RoleRunScaling ¶
type RoleRunScaling struct { Min int `yaml:"min"` Max int `yaml:"max"` HA int `yaml:"ha,omitempty"` MustBeOdd bool `yaml:"must_be_odd,omitempty"` }
RoleRunScaling describes how a role should scale out at runtime
type RoleRunVolume ¶
type RoleRunVolume struct { Type VolumeType `yaml:"type"` Path string `yaml:"path"` Tag string `yaml:"tag"` Size int `yaml:"size"` Annotations map[string]string `yaml:"annotations"` }
RoleRunVolume describes a volume to be attached at runtime
type VariableDefinition ¶
type VariableDefinition struct { Name string Type string Options VariableOptions CVOptions CVOptions }
VariableDefinition from the BOSH deployment manifest Type is used to decide on a generator
type VariableOptions ¶
type VariableOptions map[string]interface{}
VariableOptions are not structured, their content depends on the type