Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(manifestsBaseDir string, restClientGetter func(string) genericclioptions.RESTClientGetter, applyTimeout time.Duration, maxHistory int, ) *client
NewClient creates a new client.
Types ¶
type Client ¶
type Client interface {
// Apply ensures the state of a InstallableChart on the cluster.
// When state is StatePresent, Apply will install or upgrade the chart using the specified values as configuration. Apply returns true if the chart was not installed, or any values were changed.
// When state is StateUpgradeOnly, Apply will upgrade the chart using the specified values as configuration. Apply returns true if the chart was not installed, or any values were changed. An error is returned if the chart is not already installed.
// When state is StateDeleted, Apply will ensure that the chart is removed. If the chart is not installed, this is a no-op. Apply returns true if the chart was previously installed.
// Apply returns an error in case of failure.
Apply(ctx context.Context, f InstallableChart, desired State, values map[string]any) (bool, error)
}
Client handles the lifecycle of charts (manifests + config) on the cluster.
type InstallableChart ¶
type InstallableChart struct {
// Name is the install name of the chart.
Name string
// Namespace is the namespace to install the chart.
Namespace string
// ManifestPath is the path to the chart's manifest, typically relative to "$SNAP/k8s/manifests".
// TODO(neoaggelos): this should be a *chart.Chart, and we should use the "embed" package to load it when building k8sd.
ManifestPath string
}
InstallableChart describes a chart that can be deployed on a running cluster.
type State ¶
type State int
State is used to define how Client.Apply() handles install, upgrade or delete operations.
const ( // StateDeleted means that the chart should not be installed. StateDeleted State = iota // StatePresent means that the chart must be present. If it already exists, it is upgraded with the new configuration, otherwise it is installed. StatePresent // StateUpgradeOnly means that the chart will be refreshed if installed, fail otherwise. StateUpgradeOnly )
func StatePresentOrDeleted ¶
Click to show internal directories.
Click to hide internal directories.