Documentation
¶
Overview ¶
Package application provides utility functions for interacting with Deploio applications.
Index ¶
- Constants
- 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 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 ServicesFromMap(services ServiceMap, 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 OptInt32
- type OptString
- type Patcher
- type ProbePatch
- type RepositoryValidator
- type ServiceMap
- 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 ( // DNSSetupURL redirects to the proper deplo.io docs entry about // how to setup custom hosts DNSSetupURL = "https://docs.nine.ch/a/myshbw3EY1" )
Variables ¶
This section is empty.
Functions ¶
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 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 ServicesFromMap ¶ added in v1.17.0
func ServicesFromMap(services ServiceMap, namespace string) apps.NamedServiceTargetList
ServicesFromMap converts a map of name -> TypedReference 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 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 ServiceMap ¶ added in v1.17.0
type ServiceMap map[string]TypedReference
ServiceMap is a map of service name to typed reference, used as a CLI flag type.
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.