Documentation
¶
Index ¶
- Constants
- func ApplicationLatestAvailableRelease(ctx context.Context, client *api.Client, app types.NamespacedName) (*apps.Release, error)
- func ApplicationLatestRelease(ctx context.Context, client *api.Client, app types.NamespacedName) (*apps.Release, error)
- func ApplicationStaticEgresses(ctx context.Context, client *api.Client, app types.NamespacedName) ([]networking.StaticEgress, error)
- func ApplyProbePatch(cfg *apps.Config, pp ProbePatch)
- func EnvVarByName(envVars apps.EnvVars, name string) *apps.EnvVar
- func EnvVarToString(envs apps.EnvVars) string
- func EnvVarsFromMap(env map[string]string, options ...EnvVarModifier) apps.EnvVars
- func GitAuthSecretName(app *apps.Application) string
- func OrderReleaseList(releaseList *apps.ReleaseList, reverse bool)
- func PatchCORS(base *storage.CORSConfig, addChunks []string, removeChunks []string) (*storage.CORSConfig, error)
- func PatchCustomHostnames(base []string, clear bool, add []string, remove []string) ([]string, error)
- func PatchLifecyclePolicies(base []*storage.BucketLifecyclePolicy, clear bool, addChunks []string, ...) ([]*storage.BucketLifecyclePolicy, error)
- func PatchPermissions(base []*storage.BucketPermission, add, remove []string) ([]*storage.BucketPermission, error)
- func PtrOrEmpty(p *[]string) []string
- func ToBucketLifecyclePolicy(ls LifecycleSpec) *storage.BucketLifecyclePolicy
- func ToStrings[T ~string](in []T) []string
- func UnverifiedAppHosts(app *apps.Application) []string
- func UpdateEnvVars(oldEnvs []apps.EnvVar, newEnvs, sensitiveEnvs map[string]string, ...) apps.EnvVars
- func ValidatePEM(content string) (*string, error)
- func VerifiedAppHosts(app *apps.Application) []string
- type BasicAuth
- type CORSFieldMask
- type DNSDetail
- type EnvVarModifier
- type GitAuth
- type LifecycleSpec
- type OptInt32
- type OptString
- type Patcher
- type PermissionSpec
- type ProbePatch
- type SetState
- type StringSet
Constants ¶
const ( ApplicationNameLabel = "application.apps.nine.ch/name" ManagedByAnnotation = "app.kubernetes.io/managed-by" NctlName = "nctl" PrivateKeySecretKey = "privatekey" UsernameSecretKey = "username" PasswordSecretKey = "password" // DNSSetupURL redirects to the proper deplo.io docs entry about // how to setup custom hosts DNSSetupURL = "https://docs.nine.ch/a/myshbw3EY1" NoneText = "<none>" )
const ( // BasicAuth key constants which represent the keys used in basic auth // secrets BasicAuthUsernameKey = "basicAuthUsername" BasicAuthPasswordKey = "basicAuthPassword" )
const ( PermKeyRole = "role" PermKeyUsers = "users" )
Variables ¶
This section is empty.
Functions ¶
func ApplicationLatestAvailableRelease ¶ added in v1.8.0
func ApplicationLatestRelease ¶ added in v1.8.1
func ApplicationLatestRelease(ctx context.Context, client *api.Client, app types.NamespacedName) (*apps.Release, error)
ApplicationLatestRelease returns the latest release of an app, prioritizing available releases and if no available release is found just the latest progressing or failed release.
func ApplicationStaticEgresses ¶ added in v1.9.0
func ApplicationStaticEgresses(ctx context.Context, client *api.Client, app types.NamespacedName) ([]networking.StaticEgress, error)
ApplicationStaticEgresses returns all static egress resources targeting the specified app.
func ApplyProbePatch ¶ added in v1.12.2
func ApplyProbePatch(cfg *apps.Config, pp ProbePatch)
ApplyProbePatch mutates cfg.
func EnvVarByName ¶ added in v1.2.3
func EnvVarToString ¶
func EnvVarsFromMap ¶
func EnvVarsFromMap(env map[string]string, options ...EnvVarModifier) apps.EnvVars
func GitAuthSecretName ¶
func GitAuthSecretName(app *apps.Application) string
GitAuthSecretName returns the name of the secret which contains the git credentials for the given applications git source
func OrderReleaseList ¶ added in v1.7.0
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 PatchCORS ¶ added in v1.12.2
func PatchCORS(base *storage.CORSConfig, addChunks []string, removeChunks []string) (*storage.CORSConfig, error)
PatchCORS applies additive (--cors) and subtractive (--delete-cors) updates to an existing CORS configuration. Semantics for add:
- origins/response-headers: union (trimmed, deduped, sorted)
- max-age: set only if explicitly provided
Removals:
- origins/response-headers: set-difference
- specifying max-age here is rejected
- if origins are targeted and removal leaves zero origins, the CORS configuration is cleared (function returns nil, changed=true)
func PatchCustomHostnames ¶ added in v1.12.2
func PatchCustomHostnames(base []string, clear bool, add []string, remove []string) ([]string, error)
PatchCustomHostnames applies add/clear/delete operations to a slice of BucketCustomHostname entries. It follows the common "patch" pattern:
- If clear is true, the result is an empty list regardless of input.
- Entries in add are parsed and replace any existing ones with the same host.
- Entries in remove identify hostnames to be removed.
func PatchLifecyclePolicies ¶ added in v1.12.2
func PatchLifecyclePolicies( base []*storage.BucketLifecyclePolicy, clear bool, addChunks []string, deleteChunks []string, ) ([]*storage.BucketLifecyclePolicy, error)
PatchLifecyclePolicies applies a sequence of operations to a set of bucket lifecycle policies. Operations are applied in the following order:
- Clear: optionally start from an empty set, discarding all existing policies.
- Add: merge new or updated policies into the working set. Policies are keyed by prefix; providing the same prefix again replaces the previous entry.
- Delete: remove policies by prefix from the working set.
The result is a deterministic, prefix-sorted slice.
func PatchPermissions ¶ added in v1.12.2
func PatchPermissions(base []*storage.BucketPermission, add, remove []string) ([]*storage.BucketPermission, error)
PatchPermissions applies additive and subtractive permission specs on top of an existing slice of BucketPermission objects. The input slices `add` and `remove` are raw flag values (e.g. "reader=user1,user2"), which are parsed and merged deterministically. Behavior:
- `add`: users are added to the given role (duplicates deduped).
- `remove`: users are removed from the given role.
- `remove` with no users removes the whole role.
- Empty/whitespace users are rejected.
The result is normalized so that roles and user names are sorted and duplicate-free.
Returns an error if role names are invalid, if empty users appear in `add`, or if parsing of the specs fails.
func PtrOrEmpty ¶ added in v1.12.2
PtrOrEmpty unwraps a *[]string flag value, returning nil if unset.
func ToBucketLifecyclePolicy ¶ added in v1.12.2
func ToBucketLifecyclePolicy(ls LifecycleSpec) *storage.BucketLifecyclePolicy
func ToStrings ¶ added in v1.12.2
ToStrings converts a slice of types which are 'strings' under the hood into a []string
func UnverifiedAppHosts ¶
func UnverifiedAppHosts(app *apps.Application) []string
func UpdateEnvVars ¶ added in v1.2.3
func ValidatePEM ¶ added in v1.3.0
ValidatePEM validates if the passed content is in valid PEM format, errors out if the content is empty
func VerifiedAppHosts ¶
func VerifiedAppHosts(app *apps.Application) []string
Types ¶
type BasicAuth ¶ added in v1.1.1
type BasicAuth struct {
Username string `json:"username" yaml:"username"`
Password string `json:"password" yaml:"password"`
}
BasicAuth contains credentials for basic authentication
type CORSFieldMask ¶ added in v1.12.2
CORSFieldMask indicates which keys were explicitly present across chunks.
type DNSDetail ¶ added in v1.2.2
type DNSDetail struct {
Application string `json:"application"`
Project string `json:"project"`
TXTRecord string `json:"txtRecord"`
CNAMETarget string `json:"cnameTarget"`
}
func GatherDNSDetails ¶ added in v1.2.2
func GatherDNSDetails(items []apps.Application) []DNSDetail
GatherDNSDetails retrieves the DNS details of all given applications
type EnvVarModifier ¶ added in v1.12.2
func Sensitive ¶ added in v1.12.2
func Sensitive() EnvVarModifier
type GitAuth ¶
func GitAuthFromApp ¶ added in v1.4.0
func (GitAuth) HasBasicAuth ¶ added in v1.3.0
func (GitAuth) HasPrivateKey ¶ added in v1.3.0
func (GitAuth) UpdateSecret ¶
UpdateSecret replaces the data of the secret with the data from GitAuth. Only replaces fields which are non-nil.
type LifecycleSpec ¶ added in v1.12.2
func LifecycleFromMap ¶ added in v1.12.2
func LifecycleFromMap(m map[string]string) (LifecycleSpec, error)
type OptInt32 ¶ added in v1.12.2
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 ¶ added in v1.12.2
OptString is an "Optional string field" wrapper. It carries both a string value and a state (Unset / Set / Clear).
type Patcher ¶ added in v1.12.2
type Patcher interface {
ToProbePatch() ProbePatch
}
Patcher is implemented by command-specific flag structs to produce a ProbePatch.
type PermissionSpec ¶ added in v1.12.2
PermissionSpec represents a parsed permission entry. Each spec binds a role to a (possibly empty) list of users.
type ProbePatch ¶ added in v1.12.2
ProbePatch is the normalized type used by both create and update paths.