Documentation ¶
Index ¶
- Constants
- Variables
- func GetOperatorDockerImage() string
- func SetupOperatorDockerImage(org, repo, tag string)
- type BPMResourceDisk
- type BPMResourceDisks
- type BPMResources
- type ContainerFactory
- type DockerSource
- type Interpolator
- type InterpolatorImpl
- type JobFactory
- type KubeConverter
- type NewInterpolatorFunc
- type ReleaseImageProvider
- type Resolver
- type ResolverImpl
- func (r *ResolverImpl) DesiredManifest(ctx context.Context, boshDeploymentName, namespace string) (*bdm.Manifest, error)
- func (r *ResolverImpl) WithOpsManifest(ctx context.Context, instance *bdv1.BOSHDeployment, namespace string) (*bdm.Manifest, []string, error)
- func (r *ResolverImpl) WithOpsManifestDetailed(ctx context.Context, instance *bdv1.BOSHDeployment, namespace string) (*bdm.Manifest, []string, error)
Constants ¶
const ( // EnvJobsDir is a key for the container Env used to lookup the jobs dir. EnvJobsDir = "JOBS_DIR" // EnvLogsDir is the path from where to tail file logs. EnvLogsDir = "LOGS_DIR" )
const ( // EnvInstanceGroupName is a key for the container Env identifying the // instance group that container is started for EnvInstanceGroupName = "INSTANCE_GROUP_NAME" // EnvBOSHManifestPath is a key for the container Env pointing to the BOSH manifest EnvBOSHManifestPath = "BOSH_MANIFEST_PATH" // EnvCFONamespace is a key for the container Env used to lookup the // namespace CF operator is running in EnvCFONamespace = "CF_OPERATOR_NAMESPACE" // EnvBaseDir is a key for the container Env used to lookup the base dir EnvBaseDir = "BASE_DIR" // EnvVariablesDir is a key for the container Env used to lookup the variables dir EnvVariablesDir = "VARIABLES_DIR" // VarInterpolationContainerName is the name of the container that // performs variable interpolation for a manifest. It's also part of // the output secret's name VarInterpolationContainerName = "desired-manifest" // PodNameEnvVar is the environment variable containing metadata.name used to render BOSH spec.id. PodNameEnvVar = "POD_NAME" // PodIPEnvVar is the environment variable containing status.podIP used to render BOSH spec.ip. PodIPEnvVar = "POD_IP" )
const ( // VolumeRenderingDataName is the volume name for the rendering data. VolumeRenderingDataName = "rendering-data" // VolumeRenderingDataMountPath is the mount path for the rendering data. VolumeRenderingDataMountPath = "/var/vcap/all-releases" // VolumeJobsDirName is the volume name for the jobs directory. VolumeJobsDirName = "jobs-dir" // VolumeJobsDirMountPath is the mount path for the jobs directory. VolumeJobsDirMountPath = "/var/vcap/jobs" // VolumeJobsSrcDirName is the volume name for the jobs-src directory. VolumeJobsSrcDirName = "jobs-src-dir" // VolumeJobsSrcDirMountPath is the mount path for the jobs-src directory. VolumeJobsSrcDirMountPath = "/var/vcap/jobs-src" // VolumeDataDirName is the volume name for the data directory. VolumeDataDirName = "data-dir" // VolumeDataDirMountPath is the mount path for the ephemeral (data) directory. VolumeDataDirMountPath = bdm.DataDir // VolumeSysDirName is the volume name for the sys directory. VolumeSysDirName = "sys-dir" // VolumeSysDirMountPath is the mount path for the sys directory. VolumeSysDirMountPath = bdm.SysDir // VolumeStoreDirName is the volume name for the store directory. VolumeStoreDirName = "store-dir" // VolumeStoreDirMountPath is the mount path for the store directory. VolumeStoreDirMountPath = "/var/vcap/store" // AdditionalVolumeBaseName helps in building an additional volume name together with // the index under the additional_volumes bpm list inside the bpm process schema. AdditionalVolumeBaseName = "bpm-additional-volume" // AdditionalVolumesRegex ensures only a valid path is defined // under the additional_volumes bpm list inside the bpm process schema. AdditionalVolumesRegex = "((/var/vcap/data/.+)|(/var/vcap/store/.+)|(/var/vcap/sys/run/.+))" // AdditionalVolumesVcapStoreRegex ensures that the path is of the form // /var/vcap/store. AdditionalVolumesVcapStoreRegex = "(/var/vcap/store/.+)" // UnrestrictedVolumeBaseName is the volume name for the unrestricted ones. UnrestrictedVolumeBaseName = "bpm-unrestricted-volume" )
Variables ¶
var OperatorDockerImage = &DockerSource{}
OperatorDockerImage is the location of the operators own docker image
Functions ¶
Types ¶
type BPMResourceDisk ¶
type BPMResourceDisk struct { PersistentVolumeClaim *corev1.PersistentVolumeClaim Volume *corev1.Volume VolumeMount *corev1.VolumeMount Labels map[string]string }
BPMResourceDisk represents a converted BPM disk to k8s resources.
func (*BPMResourceDisk) MatchesFilter ¶
func (disk *BPMResourceDisk) MatchesFilter(filterKey, filterValue string) bool
MatchesFilter returns true if the disk matches the filter with one of its labels.
type BPMResourceDisks ¶
type BPMResourceDisks []BPMResourceDisk
BPMResourceDisks represents a slice of BPMResourceDisk.
func (BPMResourceDisks) Filter ¶
func (disks BPMResourceDisks) Filter(filterKey, filterValue string) BPMResourceDisks
Filter filters BPMResourceDisks on its labels.
func (BPMResourceDisks) VolumeMounts ¶
func (disks BPMResourceDisks) VolumeMounts() []corev1.VolumeMount
VolumeMounts returns a slice of VolumeMount of each BPMResourceDisk contained in BPMResourceDisks.
func (BPMResourceDisks) Volumes ¶
func (disks BPMResourceDisks) Volumes() []corev1.Volume
Volumes returns a slice of Volume of each BPMResourceDisk contained in BPMResourceDisks.
type BPMResources ¶
type BPMResources struct { InstanceGroups []essv1.ExtendedStatefulSet Errands []ejv1.ExtendedJob Services []corev1.Service Disks BPMResourceDisks }
BPMResources contains BPM related k8s resources, which were converted from BOSH objects
type ContainerFactory ¶
type ContainerFactory struct {
// contains filtered or unexported fields
}
ContainerFactory builds Kubernetes containers from BOSH jobs.
func NewContainerFactory ¶
func NewContainerFactory(manifestName string, instanceGroupName string, version string, disableLogSidecar bool, releaseImageProvider ReleaseImageProvider, bpmConfigs bpm.Configs) *ContainerFactory
NewContainerFactory returns a new ContainerFactory for a BOSH instant group.
func (*ContainerFactory) JobsToContainers ¶
func (c *ContainerFactory) JobsToContainers( jobs []bdm.Job, defaultVolumeMounts []corev1.VolumeMount, bpmDisks BPMResourceDisks, ) ([]corev1.Container, error)
JobsToContainers creates a list of Containers for corev1.PodSpec Containers field.
func (*ContainerFactory) JobsToInitContainers ¶
func (c *ContainerFactory) JobsToInitContainers( jobs []bdm.Job, defaultVolumeMounts []corev1.VolumeMount, bpmDisks BPMResourceDisks, ) ([]corev1.Container, error)
JobsToInitContainers creates a list of Containers for corev1.PodSpec InitContainers field.
type DockerSource ¶
type DockerSource struct { // Organization is the organization which provides the operator image Organization string // Repository is the repository which provides the operator image Repository string // Tag is the tag of the operator image Tag string }
DockerSource describes a docker image on docker hub
func (DockerSource) GetName ¶
func (d DockerSource) GetName() string
GetName returns the name of the docker image More info: https://kubernetes.io/docs/concepts/containers/images
type Interpolator ¶
type Interpolator interface { BuildOps(opsBytes []byte) error Interpolate(manifestBytes []byte) ([]byte, error) }
Interpolator renders BOSH manifests by operations files
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 JobFactory ¶
type JobFactory struct { Manifest bdm.Manifest Namespace string // contains filtered or unexported fields }
JobFactory creates Jobs for a given manifest
func NewJobFactory ¶
func NewJobFactory(manifest bdm.Manifest, namespace string) *JobFactory
NewJobFactory returns a new JobFactory
func (*JobFactory) BPMConfigsJob ¶
func (f *JobFactory) BPMConfigsJob() (*ejv1.ExtendedJob, error)
BPMConfigsJob returns an extended job to calculate BPM information
func (*JobFactory) InstanceGroupManifestJob ¶
func (f *JobFactory) InstanceGroupManifestJob() (*ejv1.ExtendedJob, error)
InstanceGroupManifestJob generates the job to create an instance group manifest
func (*JobFactory) VariableInterpolationJob ¶
func (f *JobFactory) VariableInterpolationJob() (*ejv1.ExtendedJob, error)
VariableInterpolationJob returns an extended job to interpolate variables
type KubeConverter ¶
type KubeConverter struct {
// contains filtered or unexported fields
}
KubeConverter represents a Manifest in kube resources
func NewKubeConverter ¶
func NewKubeConverter(namespace string) *KubeConverter
NewKubeConverter converts a Manifest into kube resources
func (*KubeConverter) BPMResources ¶
func (kc *KubeConverter) BPMResources(manifestName string, version string, instanceGroup *bdm.InstanceGroup, releaseImageProvider ReleaseImageProvider, bpmConfigs bpm.Configs) (*BPMResources, error)
BPMResources uses BOSH Process Manager information to create k8s container specs from single BOSH instance group. It returns extended stateful sets, services and extended jobs.
func (*KubeConverter) Variables ¶
func (kc *KubeConverter) Variables(manifestName string, variables []bdm.Variable) []esv1.ExtendedSecret
Variables returns extended secrets for a list of BOSH variables
type NewInterpolatorFunc ¶
type NewInterpolatorFunc func() Interpolator
NewInterpolatorFunc returns a fresh Interpolator
type ReleaseImageProvider ¶
type ReleaseImageProvider interface { // GetReleaseImage returns the release image for an job in an instance group GetReleaseImage(instanceGroupName, jobName string) (string, error) }
ReleaseImageProvider interface to provide the docker release image for a BOSH job This lookup is currently implemented by the manifest model.
type Resolver ¶
type Resolver interface { WithOpsManifest(ctx context.Context, instance *bdv1.BOSHDeployment, namespace string) (*bdm.Manifest, []string, error) WithOpsManifestDetailed(ctx context.Context, instance *bdv1.BOSHDeployment, namespace string) (*bdm.Manifest, []string, error) }
Resolver interface to provide a BOSH manifest resolved references from bdpl CRD
type ResolverImpl ¶
type ResolverImpl struct {
// contains filtered or unexported fields
}
ResolverImpl resolves references from bdpl CRD to a BOSH manifest
func NewResolver ¶
func NewResolver(client client.Client, f NewInterpolatorFunc) *ResolverImpl
NewResolver constructs a resolver
func (*ResolverImpl) DesiredManifest ¶
func (r *ResolverImpl) DesiredManifest(ctx context.Context, boshDeploymentName, namespace string) (*bdm.Manifest, error)
DesiredManifest reads the versioned secret created by the variable interpolation job and unmarshals it into a Manifest object
func (*ResolverImpl) WithOpsManifest ¶
func (r *ResolverImpl) WithOpsManifest(ctx context.Context, instance *bdv1.BOSHDeployment, namespace string) (*bdm.Manifest, []string, error)
WithOpsManifest returns manifest and a list of implicit variables referenced by our bdpl CRD The resulting manifest has variables interpolated and ops files applied. It is the 'with-ops' manifest.
func (*ResolverImpl) WithOpsManifestDetailed ¶
func (r *ResolverImpl) WithOpsManifestDetailed(ctx context.Context, instance *bdv1.BOSHDeployment, namespace string) (*bdm.Manifest, []string, error)
WithOpsManifestDetailed returns manifest and a list of implicit variables referenced by our bdpl CRD The resulting manifest has variables interpolated and ops files applied. It is the 'with-ops' manifest. This variant processes each ops file individually, so it's more debuggable - but slower.