Help us shape the future of Go! Take the 2026 Go Developer Survey

eirini

package module
v0.0.0-...-fe79887 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

Build Status

Eirini - what this?

Eirini is a Kubernetes backend for Cloud Foundry. It deploys CF apps to a kube backend, using OCI images and Kube deployments.

But there's more!

Eirini exports staged CF images as docker images. So you can schedule them however you'd like. And separately it gives you the nice integrated cf push flow, with CF Apps mapped directly to kube Deployment objects. In other words it decouples buildpack staging and stateless-multitenant-app running.

But there's more!

Eirini uses a little abstraction library, "OPI", which means it's not actually a Kube backend at all: it's a generic backend for any scheduler! This means it can schedule to diego/kube/swarm and whatever else is cool next year.

It uses the diego abstractions -- LRPs and Tasks -- in order to support generic orchestrators.

Deployment instructions are available at https://github.com/cloudfoundry-incubator/eirini-release

What components?

Eirini has the following components, the first two are available as subcommands of the eirini binary:

  • Bifrost converts and transfers cloud controller app specific requests to OPI specific objects and runs them in Kubernetes. It relies on the bits-service to serve OCI images for droplets, and OPI to abstract the communication with Kube.
  • OPI or the "orchestrator provider interface" provides a declarative abstraction over multiple schedulers inspired by Diego's LRP/Task model and Bosh's CPI concept.
  • Stager implements staging by running Kubernetes/OPI one-off tasks

Tell me more 'bout OPI

The really great thing about Diego is the high level abstractions above the level of containers and pods. Specifically, these are LRPs and Tasks. Actually, LRPs and Tasks are most of what you need to build both a PaaS and quite a lot of other things. And they're cross-cutting concepts that map nicely to all current orchestrators (for example to LRPs/Tasks directly in Diego, to Deployments/One-Off Tasks in Kube, and to Services and Containers in Swarm).

One of the great things about Bosh is the CPI abstraction that lets it work on any IaaS. But so far Cloud Foundry has been tightly coupled to one specific Orchestrator (Diego). This was fine for fast iteration, but now orchestration is increasingly commodotised it makes a lot of sense to abstract ourselves away from the details of scheduling so an operator can use whatever orchestrator he or she wants and higher level systems can support all of them for free.

OPI uses the LRP/Task abstractions to do that.

The OPI config file

In order to start OPI you need to call the connect command and provide a OPI config YAML file:

$ opi connect --config path/to/config.yml

opi:
  kube_config: "path/to/kube/config/file"
  kube_namespace: "the kubernetes namespace used by the cf deployment"
  kube_endpoint: "the kubernetes endpoint where to schedule workload to"
  api_endpoint: "the CF API endpoint (eg. api.bosh-lite.com)"
  cf_username: "cf admin user"
  cf_password: "cf admin password"
  cc_internal_user: "cloud controller internal user"
  cc_internal_password: "cloud controller internal password"
  external_eirini_address: "the external eirini address"
  stager_image_tag: "The tag of the recipe image, which is used to stage an app. If empty, latest is used."

Development

  • go get code.cloudfoundry.org/eirini
  • cd into the package you want to test
  • ginkgo

Some integration tests require a running minikube.

Documentation

Index

Constants

View Source
const (
	//Environment Variable Names
	EnvDownloadURL        = "DOWNLOAD_URL"
	EnvBuildpacks         = "BUILDPACKS"
	EnvDropletUploadURL   = "DROPLET_UPLOAD_URL"
	EnvAppID              = "APP_ID"
	EnvStagingGUID        = "STAGING_GUID"
	EnvCompletionCallback = "COMPLETION_CALLBACK"
	EnvCfUsername         = "CF_USERNAME"
	EnvCfPassword         = "CF_PASSWORD"
	EnvAPIAddress         = "API_ADDRESS"
	EnvEiriniAddress      = "EIRINI_ADDRESS"

	RegisteredRoutes = "routes"

	CCUploaderInternalURL = "cc-uploader.service.cf.internal"
	CCCertsMountPath      = "/etc/config/certs"
	CCCertsVolumeName     = "cc-certs-volume"
	CCAPICertName         = "cc-server-crt"
	CCAPIKeyName          = "cc-server-crt-key"
	CCUploaderCertName    = "cc-uploader-crt"
	CCUploaderKeyName     = "cc-uploader-crt-key"
	CCInternalCACertName  = "internal-ca-cert"

	UAACertName           = "uaa-server-cert"
	UAAKeyName            = "uaa-server-cert-key"
	UAAInternalCACertName = "uaa-internal-ca-cert"
)

Variables

This section is empty.

Functions

func GetInternalHeadlessServiceName

func GetInternalHeadlessServiceName(appName string) string

func GetInternalServiceName

func GetInternalServiceName(appName string) string

Types

type Bifrost

type Bifrost interface {
	Transfer(ctx context.Context, request cf.DesireLRPRequest) error
	List(ctx context.Context) ([]*models.DesiredLRPSchedulingInfo, error)
	Update(ctx context.Context, update cf.UpdateDesiredLRPRequest) error
	Stop(ctx context.Context, identifier opi.LRPIdentifier) error
	GetApp(ctx context.Context, identifier opi.LRPIdentifier) *models.DesiredLRP
	GetInstances(ctx context.Context, identifier opi.LRPIdentifier) ([]*cf.Instance, error)
}

type CfClient

type CfClient interface {
	GetDropletByAppGuid(string) ([]byte, error)
	PushDroplet(string, string) error
	GetAppBitsByAppGuid(string) (*http.Response, error)
}

type Config

type Config struct {
	Properties Properties `yaml:"opi"`
}

type Extractor

type Extractor interface {
	Extract(src, targetDir string) error
}

type Properties

type Properties struct {
	KubeConfig        string `yaml:"kube_config"`
	KubeNamespace     string `yaml:"kube_namespace"`
	KubeEndpoint      string `yaml:"kube_endpoint"`
	NatsPassword      string `yaml:"nats_password"`
	NatsIP            string `yaml:"nats_ip"`
	CcUploaderIP      string `yaml:"cc_uploader_ip"`
	CcAPI             string `yaml:"api_endpoint"`
	CcInternalAPI     string `yaml:"cc_internal_api"`
	Backend           string `yaml:"backend"`
	CfUsername        string `yaml:"cf_username"`
	CfPassword        string `yaml:"cf_password"`
	CcUser            string `yaml:"cc_internal_user"`
	CcPassword        string `yaml:"cc_internal_password"`
	CCCertsSecretName string `yaml:"cc_certs_secret_name"`
	RegistryAddress   string `yaml:"external_eirini_address"`
	EiriniAddress     string `yaml:"eirini_address"`
	StagerImageTag    string `yaml:"stager_image_tag"`
	UseIngress        bool   `yaml:"use_ingress"`

	MetricsSourceAddress string `yaml:"metrics_source_address"`

	LoggregatorAddress  string `yaml:"loggregator_address"`
	LoggregatorCertPath string `yaml:"loggergator_cert_path"`
	LoggregatorKeyPath  string `yaml:"loggregator_key_path"`
	LoggregatorCAPath   string `yaml:"loggregator_ca_path"`

	CCCertPath string `yaml:"cc_cert_path"`
	CCKeyPath  string `yaml:"cc_key_path"`
	CCCAPath   string `yaml:"cc_ca_path"`
}

type RemoveCallbackFunc

type RemoveCallbackFunc func(string) error

type Stager

type Stager interface {
	Stage(string, cf.StagingRequest) error
	CompleteStaging(*models.TaskCallbackResponse) error
}

type StagerConfig

type StagerConfig struct {
	CfUsername    string
	CfPassword    string
	APIAddress    string
	EiriniAddress string
	Image         string
}

Directories

Path Synopsis
bifrostfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
cmd
opi command
Code generated by counterfeiter.
Code generated by counterfeiter.
eventsfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
k8s
k8sfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
launchcmd command
metricsfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
models
cf
opi
opifakes
Code generated by counterfeiter.
Code generated by counterfeiter.
cmd command
recipefakes
Code generated by counterfeiter.
Code generated by counterfeiter.
routefakes
Code generated by counterfeiter.
Code generated by counterfeiter.
utilfakes
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