manifest

package
v0.0.0-...-8f52349 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppDockerImage

type AppDockerImage struct {
	Image string `json:"image,omitempty"`
}

AppDockerImage is the struct for docker configuration.

type Application

type Application struct {
	Name            string            `json:"name,omitempty"`
	Path            string            `json:"path,omitempty"`
	LegacyBuildpack string            `json:"buildpack,omitempty"`
	Buildpacks      []string          `json:"buildpacks,omitempty"`
	Stack           string            `json:"stack,omitempty"`
	Docker          AppDockerImage    `json:"docker,omitempty"`
	Env             map[string]string `json:"env,omitempty"`
	Services        []string          `json:"services,omitempty"`
	DiskQuota       string            `json:"disk_quota,omitempty"`
	Memory          string            `json:"memory,omitempty"`
	CPU             string            `json:"cpu,omitempty"`
	Instances       *int              `json:"instances,omitempty"`

	// TODO(#95): These aren't CF proper. How do we expose these in the
	// manifest?
	MinScale *int `json:"min-scale,omitempty"`
	MaxScale *int `json:"max-scale,omitempty"`

	Routes      []Route `json:"routes,omitempty"`
	NoRoute     *bool   `json:"no-route,omitempty"`
	RandomRoute *bool   `json:"random-route,omitempty"`

	// HealthCheckTimeout holds the health check timeout.
	// Note the serialized field is just timeout.
	HealthCheckTimeout int `json:"timeout,omitempty"`

	// HealthCheckType holds the type of health check that will be performed to
	// determine if the app is alive. Either port or http, blank means port.
	HealthCheckType string `json:"health-check-type,omitempty"`

	// HealthCheckHTTPEndpoint holds the HTTP endpoint that will receive the
	// get requests to determine liveness if HealthCheckType is http.
	HealthCheckHTTPEndpoint string `json:"health-check-http-endpoint,omitempty"`
}

Application is a configuration for a single 12-factor-app.

func (*Application) Buildpack

func (app *Application) Buildpack() string

Buildpack joins together the buildpacks in order as a CSV to be compatible with buildpacks v3. If no buildpacks are specified, the legacy buildpack field is checked.

Example
package main

import (
	"fmt"

	"github.com/poy/kf/pkg/kf/manifest"
)

func main() {
	app := manifest.Application{}
	app.LegacyBuildpack = "hidden-legacy-buildpack"
	fmt.Println("Legacy:", app.Buildpack())

	app.Buildpacks = []string{"java"}
	fmt.Println("One:", app.Buildpack())

	app.Buildpacks = []string{"maven", "java"}
	fmt.Println("Two:", app.Buildpack())

}
Output:

Legacy: hidden-legacy-buildpack
One: java
Two: maven,java

func (*Application) Override

func (app *Application) Override(overrides *Application) error

Override overrides values using corresponding non-empty values from overrides. Environment variables are extended with override taking priority.

type Manifest

type Manifest struct {
	Applications []Application `json:"applications"`
}

Manifest is an application's configuration.

func CheckForManifest

func CheckForManifest(directory string) (*Manifest, error)

CheckForManifest will optionally return a Manifest given a directory.

func New

func New(appName string) (*Manifest, error)

New creates a Manifest for a single app.

func NewFromFile

func NewFromFile(manifestFile string) (*Manifest, error)

NewFromFile creates a Manifest from a manifest file.

func NewFromReader

func NewFromReader(reader io.Reader) (*Manifest, error)

NewFromReader creates a Manifest from a reader.

func (Manifest) App

func (m Manifest) App(name string) (*Application, error)

App returns an Application by name.

type Route

type Route struct {
	Route string `json:"route,omitempty"`
}

Route is a route name (including hostname, domain, and path) for an application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL