Documentation ¶
Index ¶
- type AppDockerImage
- type Application
- func (app *Application) Buildpack() string
- func (app *Application) CommandArgs() []string
- func (app *Application) CommandEntrypoint() []string
- func (app *Application) Override(overrides *Application) error
- func (source *Application) ToAppSpecInstances() v1alpha1.AppSpecInstances
- func (source *Application) ToResourceRequests() (corev1.ResourceList, error)
- func (app *Application) Validate(ctx context.Context) (errs *apis.FieldError)
- func (app *Application) WarnUnofficialFields(w io.Writer) error
- type Dockerfile
- type KfApplicationExtension
- type Manifest
- type Route
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"` Instances *int `json:"instances,omitempty"` // Container command configuration Command string `json:"command,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"` // KfApplicationExtension holds fields that aren't officially in cf KfApplicationExtension `json:",inline"` }
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/google/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) CommandArgs ¶ added in v0.2.0
func (app *Application) CommandArgs() []string
CommandArgs returns the container args if they're defined or nil.
Example ¶
package main import ( "fmt" "github.com/google/kf/pkg/kf/manifest" ) func main() { app := manifest.Application{} fmt.Printf("Blank: %v\n", app.CommandArgs()) app = manifest.Application{ Command: "start.sh && exit 1", } fmt.Printf("Command: %v\n", app.CommandArgs()) app = manifest.Application{ KfApplicationExtension: manifest.KfApplicationExtension{ Args: []string{"-m", "SimpleHTTPServer"}, }, } fmt.Printf("Args: %v\n", app.CommandArgs()) }
Output: Blank: [] Command: [start.sh && exit 1] Args: [-m SimpleHTTPServer]
func (*Application) CommandEntrypoint ¶ added in v0.2.0
func (app *Application) CommandEntrypoint() []string
CommandEntrypoint gets an override for the entrypoint of the container.
Example ¶
package main import ( "fmt" "github.com/google/kf/pkg/kf/manifest" ) func main() { app := manifest.Application{} fmt.Printf("Blank: %v\n", app.CommandEntrypoint()) app = manifest.Application{ KfApplicationExtension: manifest.KfApplicationExtension{ Entrypoint: "python", }, } fmt.Printf("Entrypoint: %v\n", app.CommandEntrypoint()) }
Output: Blank: [] Entrypoint: [python]
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.
func (*Application) ToAppSpecInstances ¶ added in v0.2.0
func (source *Application) ToAppSpecInstances() v1alpha1.AppSpecInstances
ToAppSpecInstances extracts scaling info from the manifest.
func (*Application) ToResourceRequests ¶ added in v0.2.0
func (source *Application) ToResourceRequests() (corev1.ResourceList, error)
ToResourceRequests returns a ResourceList with memory, CPU, and storage set. If none are set by the user, the returned ResourceList will be nil.
func (*Application) Validate ¶ added in v0.2.0
func (app *Application) Validate(ctx context.Context) (errs *apis.FieldError)
Validate checks for errors in the Application's fields.
func (*Application) WarnUnofficialFields ¶ added in v0.2.0
func (app *Application) WarnUnofficialFields(w io.Writer) error
WarnUnofficialFields prints a message to the given writer if the user is using any kf specific fields in their configuration.
Example ¶
package main import ( "os" "github.com/google/kf/pkg/kf/manifest" "knative.dev/pkg/ptr" ) func main() { app := manifest.Application{ KfApplicationExtension: manifest.KfApplicationExtension{ EnableHTTP2: ptr.Bool(true), NoStart: ptr.Bool(false), }, } app.WarnUnofficialFields(os.Stdout) }
Output: WARNING! The field(s) [enable-http2 no-start] are Kf-specific manifest extensions and may change. See https://github.com/google/kf/issues/95 for more info.
type Dockerfile ¶ added in v0.2.0
type Dockerfile struct {
Path string `json:"path,omitempty"`
}
Dockerfile contains the path to a Dockerfile to build.
type KfApplicationExtension ¶ added in v0.2.0
type KfApplicationExtension struct { CPU string `json:"cpu,omitempty"` MinScale *int `json:"min-scale,omitempty"` MaxScale *int `json:"max-scale,omitempty"` NoStart *bool `json:"no-start,omitempty"` EnableHTTP2 *bool `json:"enable-http2,omitempty"` Entrypoint string `json:"entrypoint,omitempty"` Args []string `json:"args,omitempty"` Dockerfile Dockerfile `json:"dockerfile,omitempty"` }
KfApplicationExtension holds fields that aren't officially in cf
type Manifest ¶
type Manifest struct {
Applications []Application `json:"applications"`
}
Manifest is an application's configuration.
func CheckForManifest ¶
CheckForManifest will optionally return a Manifest given a directory.
func NewFromFile ¶
NewFromFile creates a Manifest from a manifest file.
func NewFromReader ¶
NewFromReader creates a Manifest from a reader.