Documentation
¶
Overview ¶
Package application provides utility functions for interacting with Deploio applications.
Index ¶
- Constants
- func ApplyBuildType(app *apps.Application, buildType string)
- func ApplyProbePatch(cfg *apps.Config, pp ProbePatch)
- func EnvVarByName(envVars apps.EnvVars, name string) *apps.EnvVar
- func EnvVarsFromMap(env map[string]string, options ...EnvVarModifier) apps.EnvVars
- func GroupVersionKindFromKind(kind string) (schema.GroupVersionKind, error)
- func KongVars() (kong.Vars, error)
- func LatestAvailableRelease(releases *apps.ReleaseList) *apps.Release
- func OrderReleaseList(releaseList *apps.ReleaseList, reverse bool)
- func Releases(ctx context.Context, client *api.Client, app types.NamespacedName) (*apps.ReleaseList, error)
- func ServicesFromReferences(services []NamedServiceReference, namespace string) apps.NamedServiceTargetList
- func StaticEgresses(ctx context.Context, client *api.Client, app types.NamespacedName) ([]networking.StaticEgress, error)
- func UnverifiedHosts(app *apps.Application) []string
- func UpdateEnvVars(oldEnvs []apps.EnvVar, newEnvs, sensitiveEnvs map[string]string, ...) apps.EnvVars
- func UpdateServices(existing apps.NamedServiceTargetList, toAdd apps.NamedServiceTargetList, ...) apps.NamedServiceTargetList
- func ValidateConfig(config apps.Config) error
- func ValidatePEM(content string) (*string, error)
- type BasicAuth
- type DNSDetail
- type EnvVarModifier
- type NamedServiceReference
- type OptInt32
- type OptString
- type Patcher
- type ProbePatch
- type RepositoryValidator
- type SetState
- type TypedReference
Constants ¶
const ( // BasicAuth key constants which represent the keys used in basic auth // secrets BasicAuthUsernameKey = "basicAuthUsername" BasicAuthPasswordKey = "basicAuthPassword" )
const (
ApplicationNameLabel = "application.apps.nine.ch/name"
)
const BuildTypeDockerfile = "dockerfile"
BuildTypeDockerfile is the build type of applications which are built using a Dockerfile. All other build types are buildpack stacks.
const ( // DNSSetupURL redirects to the proper deplo.io docs entry about // how to setup custom hosts DNSSetupURL = "https://docs.nine.ch/a/myshbw3EY1" )
const DefaultReplicas = 2
DefaultReplicas is the number of replicas an application is created with when --replicas is not passed.
Variables ¶
This section is empty.
Functions ¶
func ApplyBuildType ¶ added in v1.22.0
func ApplyBuildType(app *apps.Application, buildType string)
ApplyBuildType configures app to be built with buildType, which is either BuildTypeDockerfile or the name of a buildpack stack. The buildpack stack is kept when switching to Dockerfile builds, as it is ignored for them.
func ApplyProbePatch ¶
func ApplyProbePatch(cfg *apps.Config, pp ProbePatch)
ApplyProbePatch mutates cfg.
func EnvVarsFromMap ¶
func EnvVarsFromMap(env map[string]string, options ...EnvVarModifier) apps.EnvVars
func GroupVersionKindFromKind ¶ added in v1.17.0
func GroupVersionKindFromKind(kind string) (schema.GroupVersionKind, error)
GroupVersionKindFromKind resolves a case-insensitive kind string to a schema.GroupVersionKind using the registered scheme.
func KongVars ¶ added in v1.21.0
KongVars returns the variables which the flags of the application create and update commands interpolate: defaults and help texts they share.
func LatestAvailableRelease ¶
func LatestAvailableRelease(releases *apps.ReleaseList) *apps.Release
func OrderReleaseList ¶
func OrderReleaseList(releaseList *apps.ReleaseList, reverse bool)
OrderReleaseList orders the given list of releases first by name and then by creation timestamp latest to oldest. Reverse reverses the order by creation timestamp to oldest to latest.
func Releases ¶
func Releases(ctx context.Context, client *api.Client, app types.NamespacedName) (*apps.ReleaseList, error)
Releases returns a release list of an app. If the returned error is nil, the release list is guaranteed to have at least one item.
func ServicesFromReferences ¶ added in v1.21.0
func ServicesFromReferences(services []NamedServiceReference, namespace string) apps.NamedServiceTargetList
ServicesFromReferences converts a slice of NamedServiceReference into a NamedServiceTargetList. The namespace is set on each target.
func StaticEgresses ¶
func StaticEgresses(ctx context.Context, client *api.Client, app types.NamespacedName) ([]networking.StaticEgress, error)
StaticEgresses returns all static egress resources targeting the specified app.
func UnverifiedHosts ¶
func UnverifiedHosts(app *apps.Application) []string
func UpdateEnvVars ¶
func UpdateServices ¶ added in v1.17.0
func UpdateServices(existing apps.NamedServiceTargetList, toAdd apps.NamedServiceTargetList, toDelete []string, w format.Writer) apps.NamedServiceTargetList
UpdateServices merges toAdd into existing services (upsert by name) and removes services listed in toDelete. Warnings are emitted for delete-not-found cases.
func ValidateConfig ¶
ValidateConfig validates the configuration of an application.
func ValidatePEM ¶
ValidatePEM validates if the passed content is in valid PEM format, errors out if the content is empty
Types ¶
type BasicAuth ¶
type BasicAuth struct {
Username string `json:"username" yaml:"username"`
Password string `json:"password" yaml:"password"`
}
BasicAuth contains credentials for basic authentication
type DNSDetail ¶
type DNSDetail struct {
Application string `json:"application"`
Project string `json:"project"`
TXTRecord string `json:"txtRecord"`
CNAMETarget string `json:"cnameTarget"`
}
func DNSDetails ¶
func DNSDetails(items []apps.Application) []DNSDetail
DNSDetails retrieves the DNS details of all given applications
type EnvVarModifier ¶
func Sensitive ¶
func Sensitive() EnvVarModifier
type NamedServiceReference ¶ added in v1.21.0
type NamedServiceReference struct {
Name string
Target TypedReference
}
NamedServiceReference is a named reference to a service target, in the form "name=kind/target-name".
func (*NamedServiceReference) UnmarshalText ¶ added in v1.21.0
func (n *NamedServiceReference) UnmarshalText(text []byte) error
UnmarshalText parses a named service reference from a string in "name=kind/target-name" format.
type OptInt32 ¶
OptInt32 is an "Optional int32 field" wrapper. It works the same way as OptString, but for numeric fields. Again, this lets us distinguish Unset (no flag) vs Set (positive value) vs Clear (explicitly reset to nil/default).
type OptString ¶
OptString is an "Optional string field" wrapper. It carries both a string value and a state (Unset / Set / Clear).
type Patcher ¶
type Patcher interface {
ToProbePatch() ProbePatch
}
Patcher is implemented by command-specific flag structs to produce a ProbePatch.
type ProbePatch ¶
ProbePatch is the normalized type used by both create and update paths.
type RepositoryValidator ¶
type RepositoryValidator struct {
format.Writer
Auth gitinfo.Auth
Client *gitinfo.Client
Debug bool
}
RepositoryValidator validates a git repository
type TypedReference ¶ added in v1.17.0
type TypedReference struct {
meta.TypedReference
}
TypedReference is a reference to a resource with a specific type. It implements encoding.TextUnmarshaler to parse "kind/name" strings, which allows it to be used directly as a Kong flag type.
func (*TypedReference) UnmarshalText ¶ added in v1.17.0
func (r *TypedReference) UnmarshalText(text []byte) error
UnmarshalText parses a typed reference from a string in "kind/name" format.