Documentation ¶
Overview ¶
Package app contains the main logic for the application.
Index ¶
- Variables
- func Indent(s, prefix string) string
- func Main() int
- func NullBoolTransformer(typ reflect.Type) func(dst, src reflect.Value) error
- func ToolExists(tool string) bool
- type ChartInfo
- type CmdPipe
- type Command
- type Config
- type CustomResource
- type ExitStatus
- type HelmTime
- type Limit
- type Limits
- type Logger
- type MergoTransformer
- type Namespace
- type NullBool
- type Quotas
- type Release
- type Resources
- type State
- type StateFiles
- type StatePath
Constants ¶
This section is empty.
Variables ¶
var ( True = NullBool{HasValue: true, Value: true} False = NullBool{HasValue: true, Value: false} )
truthy and falsy NullBool values
Functions ¶
func Indent ¶
Indent inserts prefix at the beginning of each non-empty line of s. The end-of-line marker is NL.
func NullBoolTransformer ¶
NullBoolTransformer is a custom imdario/mergo transformer for the NullBool type
func ToolExists ¶
ToolExists returns true if the tool is present in the environment and false otherwise. It takes as input the tool's command to check if it is recognizable or not. e.g. helm or kubectl
Types ¶
type CmdPipe ¶
type CmdPipe []Command
CmdPipe is a os/exec.Commnad wrapper for UNIX pipe
func (CmdPipe) Exec ¶
func (p CmdPipe) Exec() (ExitStatus, error)
Exec pipes the executable commands and returns the exit code and execution result
func (CmdPipe) RetryExec ¶
func (p CmdPipe) RetryExec(attempts int) (ExitStatus, error)
RetryExec runs piped commands with retry
func (CmdPipe) RetryExecWithThreshold ¶
func (p CmdPipe) RetryExecWithThreshold(attempts, exitCodeThreshold int) (ExitStatus, error)
RetryExecWithThreshold runs piped commands with retry and allows specifying the threshold for the exit code to be considered erroneous
type Command ¶
Command type representing all executable commands Helmsman needs to execute in order to inspect the environment|releases|charts etc.
func (*Command) Exec ¶
func (c *Command) Exec() (ExitStatus, error)
Exec executes the executable command and returns the exit code and execution result
func (*Command) RetryExec ¶
func (c *Command) RetryExec(attempts int) (ExitStatus, error)
RetryExec runs exec command with retry
func (*Command) RetryExecWithThreshold ¶
func (c *Command) RetryExecWithThreshold(attempts, exitCodeThreshold int) (ExitStatus, error)
RetryExecWithThreshold runs exec command with retry and allows specifying the threshold for the exit code to be considered erroneous
type Config ¶
type Config struct { // KubeContext is the kube context you want Helmsman to use or create KubeContext string `json:"kubeContext,omitempty"` // Username to be used for kubectl credentials Username string `json:"username,omitempty"` // Password to be used for kubectl credentials Password string `json:"password,omitempty"` // ClusterURI is the URI for your cluster API or the name of an environment variable (starting with `$`) containing the URI ClusterURI string `json:"clusterURI,omitempty"` // ServiceAccount to be used for tiller (deprecated) ServiceAccount string `json:"serviceAccount,omitempty"` // StorageBackend indicates the storage backened used by helm, defaults to secret StorageBackend string `json:"storageBackend,omitempty"` // SlackWebhook is the slack webhook URL for slack notifications SlackWebhook string `json:"slackWebhook,omitempty"` // MSTeamsWebhook is the Microsoft teams webhook URL for teams notifications MSTeamsWebhook string `json:"msTeamsWebhook,omitempty"` // ReverseDelete indicates if the applications should be deleted in reverse orderin relation to the installation order ReverseDelete bool `json:"reverseDelete,omitempty"` // BearerToken indicates whether you want helmsman to connect to the cluster using a bearer token BearerToken bool `json:"bearerToken,omitempty"` // BearerTokenPath allows specifying a custom path for the token BearerTokenPath string `json:"bearerTokenPath,omitempty"` // NamespaceLabelsAuthoritativei indicates whether helmsman should remove namespace labels that are not in the DSF NamespaceLabelsAuthoritative bool `json:"namespaceLabelsAuthoritative,omitempty"` // VaultEnabled indicates whether the helm vault plugin is used for encrypted files VaultEnabled bool `json:"vaultEnabled,omitempty"` // VaultDeliminator allows secret deliminator used when parsing to be overridden VaultDeliminator string `json:"vaultDeliminator,omitempty"` // VaultPath allows the secret mount location in Vault to be overridden VaultPath string `json:"vaultPath,omitempty"` // VaultMountPoint allows the Vault Mount Point to be overridden VaultMountPoint string `json:"vaultMountPoint,omitempty"` // VaultTemplate Substring with path to vault key instead of deliminator VaultTemplate string `json:"vaultTemplate,omitempty"` // VaultKvVersion The version of the KV secrets engine in Vault VaultKvVersion string `json:"vaultKvVersion,omitempty"` // VaultEnvironment Environment that secrets should be stored under VaultEnvironment string `json:"vaultEnvironment,omitempty"` // EyamlEnabled indicates whether eyaml is used for encrypted files EyamlEnabled bool `json:"eyamlEnabled,omitempty"` // EyamlPrivateKeyPath is the path to the eyaml private key EyamlPrivateKeyPath string `json:"eyamlPrivateKeyPath,omitempty"` // EyamlPublicKeyPath is the path to the eyaml public key EyamlPublicKeyPath string `json:"eyamlPublicKeyPath,omitempty"` // EyamlGkms indicates whether to use GKMS for eyaml EyamlGkms bool `json:"eyamlGkms,omitepty"` // EyamlGkmsProject is the GCP project where GKMS keys are stored EyamlGkmsProject string `json:"eyamlGkmsProject,omitempty"` // EyamlGkmsLocation is the KMS location EyamlGkmsLocation string `json:"eyamlGkmsLocation,omitempty"` // EyamlGkmsKeyring is the ID of the Cloud KMS key ring EyamlGkmsKeyring string `json:"eyamlGkmsKeyring,omitempty"` // EyamlGkmsCryptoKey is the ID of the key to use EyamlGkmsCryptoKey string `json:"eyamlGkmsCryptoKey,omitempty"` // GlobalHooks is a set of global lifecycle hooks GlobalHooks map[string]interface{} `json:"globalHooks,omitempty"` // GlobalMaxHistory sets the global max number of historical release revisions to keep GlobalMaxHistory int `json:"globalMaxHistory,omitempty"` // SkipIgnoredApps if set to true, ignored apps will not be considered in the plan SkipIgnoredApps bool `json:"skipIgnoredApps,omitempty"` // SkipPendingApps is set to true,apps in a pending state will be ignored SkipPendingApps bool `json:"skipPendingApps,omitempty"` }
Config type represents the settings fields
type CustomResource ¶
type CustomResource struct { // Name of the custom resource Name string `json:"name,omitempty"` // Value of the custom resource Value string `json:"value,omitempty"` }
custom resource type
type ExitStatus ¶
type ExitStatus struct {
// contains filtered or unexported fields
}
func (ExitStatus) String ¶
func (e ExitStatus) String() string
type Limit ¶
type Limit struct { // Max defines the resource limits Max Resources `json:"max,omitempty"` // Min defines the resource request Min Resources `json:"min,omitempty"` // Default stes resource limits to pods without defined resource limits Default Resources `json:"default,omitempty"` // DefaultRequest sets the resource requests for pods without defined resource requests DefaultRequest Resources `json:"defaultRequest,omitempty"` // MaxLimitRequestRatio set the max limit request ratio MaxLimitRequestRatio Resources `json:"maxLimitRequestRatio,omitempty"` Type string `json:"type"` }
Limit represents a resource limit
type MergoTransformer ¶
func (MergoTransformer) Transformer ¶
type Namespace ¶
type Namespace struct { // Protected if set to true no changes can be applied to the namespace Protected bool `json:"protected"` // Limits to set on the namespace Limits Limits `json:"limits,omitempty"` // Labels to set to the namespace Labels map[string]string `json:"labels,omitempty"` // Annotations to set on the namespace Annotations map[string]string `json:"annotations,omitempty"` // Quotas to set on the namespace Quotas *Quotas `json:"quotas,omitempty"` // contains filtered or unexported fields }
Namespace type represents the fields of a Namespace
type NullBool ¶
NullBool represents a bool that may be null.
func (NullBool) JSONSchema ¶
func (NullBool) JSONSchema() *jsonschema.Schema
JSONSchema instructs the jsonschema generator to represent NullBool type as boolean
func (NullBool) MarshalJSON ¶
func (*NullBool) UnmarshalJSON ¶
func (*NullBool) UnmarshalText ¶
type Quotas ¶
type Quotas struct { // Pods is the pods quota Pods string `json:"pods,omitempty"` // CPULimits is the CPU quota CPULimits string `json:"limits.cpu,omitempty"` // CPURequests is the CPU requests quota CPURequests string `json:"requests.cpu,omitempty"` // MemoryLimits is the memory quota MemoryLimits string `json:"limits.memory,omitempty"` // MemoryRequests is the memory requests quota MemoryRequests string `json:"requests.memory,omitempty"` // CustomResource is a list of custom resource quotas CustomQuotas []CustomResource `json:"customQuotas,omitempty"` }
quota type
type Release ¶
type Release struct { // Name is the helm release name Name string `json:"name"` // Description is a user friendly description of the helm release Description string `json:"description,omitempty"` // Namespace where to deploy the helm release Namespace string `json:"namespace"` // Enabled can be used to togle a helm release Enabled NullBool `json:"enabled"` Group string `json:"group,omitempty"` Chart string `json:"chart"` // Version of the helm chart to deploy Version string `json:"version"` // ValuesFile is the path for a values file for the helm release ValuesFile string `json:"valuesFile,omitempty"` // ValuesFiles is a list of paths a values files for the helm release ValuesFiles []string `json:"valuesFiles,omitempty"` // SecretsFile is the path for an encrypted values file for the helm release SecretsFile string `json:"secretsFile,omitempty"` // SecretsFiles is a list of paths for encrypted values files for the helm release SecretsFiles []string `json:"secretsFiles,omitempty"` // PostRenderer is the path to an executable to be used for post rendering PostRenderer string `json:"postRenderer,omitempty"` // Test indicates if the chart tests should be executed Test NullBool `json:"test,omitempty"` // Protected defines if the release should be protected against changes Protected NullBool `json:"protected,omitempty"` // Wait defines whether helm should block execution until all k8s resources are in a ready state Wait NullBool `json:"wait,omitempty"` // Priority allows defining the execution order, releases with the same priority can be executed in parallel Priority int `json:"priority,omitempty"` // Set can be used to overwrite the chart values Set map[string]string `json:"set,omitempty"` // SetString can be used to overwrite string values SetString map[string]string `json:"setString,omitempty"` // SetFile can be used to overwrite the chart values SetFile map[string]string `json:"setFile,omitempty"` // HelmFlags is a list of additional flags to pass to the helm command HelmFlags []string `json:"helmFlags,omitempty"` // HelmDiffFlags is a list of cli flags to pass to helm diff HelmDiffFlags []string `json:"helmDiffFlags,omitempty"` // NoHooks can be used to disable the execution of helm hooks NoHooks NullBool `json:"noHooks,omitempty"` // Timeout is the number of seconds to wait for the release to complete Timeout int `json:"timeout,omitempty"` // Hooks can be used to define lifecycle hooks specific to this release Hooks map[string]interface{} `json:"hooks,omitempty"` // MaxHistory is the maximum number of histoical releases to keep MaxHistory int `json:"maxHistory,omitempty"` // contains filtered or unexported fields }
Release type representing Helm releases which are described in the desired state
type Resources ¶
type Resources struct { // CPU is the number of CPU cores CPU string `json:"cpu,omitempty"` // Memory is the amount of memory Memory string `json:"memory,omitempty"` }
Resources type
type State ¶
type State struct { // Metadata for human reader of the desired state file Metadata map[string]string `json:"metadata,omitempty"` // Certificates are used to connect kubectl to a cluster Certificates map[string]string `json:"certificates,omitempty"` // Settings for configuring helmsman Settings Config `json:"settings,omitempty"` // Context defines an helmsman scope Context string `json:"context,omitempty"` // HelmRepos from where to find the application helm charts HelmRepos map[string]string `json:"helmRepos,omitempty"` // PreconfiguredHelmRepos is a list of helm repos that are configured outside of the DSF PreconfiguredHelmRepos []string `json:"preconfiguredHelmRepos,omitempty"` // Namespaces where helmsman will deploy applications Namespaces map[string]*Namespace `json:"namespaces"` // Apps holds the configuration for each helm release managed by helmsman Apps map[string]*Release `json:"apps"` // AppsTemplates allow defining YAML objects thatcan be used as a reference with YAML anchors to keep the configuration DRY AppsTemplates map[string]*Release `json:"appsTemplates,omitempty"` // contains filtered or unexported fields }
State type represents the desired State of applications on a k8s cluster.
type StateFiles ¶
type StateFiles struct {
StateFiles []StatePath `json:"stateFiles"`
}