Documentation
¶
Overview ¶
Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func ReleaseToObjects(release *release.Release) ([]runtime.Object, error)
- func ReleaseToResourceID(release *release.Release) string
- func Template(ctx context.Context, bundleID string, manifest *manifest.Manifest, ...) (*release.Release, error)
- type DeployedBundle
- type Helm
- func (h *Helm) Delete(ctx context.Context, bundleID string) error
- func (h *Helm) DeleteRelease(ctx context.Context, deployment DeployedBundle) error
- func (h *Helm) Deploy(ctx context.Context, bundleID string, manifest *manifest.Manifest, ...) (*release.Release, error)
- func (h *Helm) EnsureInstalled(bundleID, resourcesID string) (bool, error)
- func (h *Helm) ImpersonatedClient(ctx context.Context, serviceAccountName string) (client.Client, error)
- func (h *Helm) ListDeployments(list ListAction) ([]DeployedBundle, error)
- func (h *Helm) NewListAction() *action.List
- func (h *Helm) RemoveExternalChanges(ctx context.Context, bd *fleet.BundleDeployment) (string, error)
- func (h *Helm) Resources(bundleID, resourcesID string) (*Resources, error)
- func (h *Helm) ResourcesFromPreviousReleaseVersion(bundleID, resourcesID string) (*Resources, error)
- func (h *Helm) Setup(ctx context.Context, client client.Client, ...) error
- type ListAction
- type Resources
Constants ¶
const ( BundleIDAnnotation = "fleet.cattle.io/bundle-id" CommitAnnotation = "fleet.cattle.io/commit" AgentNamespaceAnnotation = "fleet.cattle.io/agent-namespace" ServiceAccountNameAnnotation = "fleet.cattle.io/service-account" DefaultServiceAccount = "fleet-default" KeepResourcesAnnotation = "fleet.cattle.io/keep-resources" HelmUpgradeInterruptedError = "another operation (install/upgrade/rollback) is in progress" MaxHelmHistory = 2 )
const CRDKind = "CustomResourceDefinition"
Variables ¶
var ( ErrNoRelease = errors.New("failed to find release") ErrNoResourceID = errors.New("no resource ID available") DefaultKey = "values.yaml" )
Functions ¶
func ReleaseToObjects ¶ added in v0.11.0
func ReleaseToResourceID ¶ added in v0.11.0
Types ¶
type DeployedBundle ¶
type DeployedBundle struct {
// BundleID is the bundledeployment.Name
BundleID string
// ReleaseName is actually in the form "namespace/release name"
ReleaseName string
// KeepResources indicate if resources should be kept when deleting a GitRepo or Bundle
KeepResources bool
}
DeployedBundle is the link between a bundledeployment and a helm release
type Helm ¶
type Helm struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.10.0
New returns a new helm deployer * agentNamespace is the system namespace, which is the namespace the agent is running in, e.g. cattle-fleet-system
func (*Helm) Delete ¶
Delete the release for the given bundleID. The bundleID is the name of the bundledeployment.
func (*Helm) DeleteRelease ¶ added in v0.10.0
func (h *Helm) DeleteRelease(ctx context.Context, deployment DeployedBundle) error
DeleteRelease deletes the release for the DeployedBundle.
func (*Helm) Deploy ¶
func (h *Helm) Deploy(ctx context.Context, bundleID string, manifest *manifest.Manifest, options fleet.BundleDeploymentOptions) (*release.Release, error)
Deploy deploys an unpacked content resource with helm. bundleID is the name of the bundledeployment.
func (*Helm) EnsureInstalled ¶
func (*Helm) ImpersonatedClient ¶ added in v0.13.16
func (h *Helm) ImpersonatedClient(ctx context.Context, serviceAccountName string) (client.Client, error)
ImpersonatedClient returns a controller-runtime client that impersonates the service account resolved for the given deployment, to be used for namespace label/annotation mutations. Performing those mutations as the same identity the deployment runs as ensures they are gated by the same downstream RBAC, rather than by the agent's own (cluster-admin) credentials.
Service account resolution is identical to the Helm install path (getServiceAccount): an explicitly pinned account is used as-is, otherwise it falls back to "fleet-default" when present. It returns a nil client only when no service account is resolved at all (none pinned and no "fleet-default"); in that case the deployment runs as the agent itself, and callers should fall back to their own client to preserve the existing behaviour.
func (*Helm) ListDeployments ¶
func (h *Helm) ListDeployments(list ListAction) ([]DeployedBundle, error)
ListDeployments returns a list of deployedBundles by listing all helm releases via helm's storage driver (secrets) It only returns deployedBundles for helm releases which have the "fleet.cattle.io/bundle-id" annotation.
func (*Helm) NewListAction ¶ added in v0.10.0
func (*Helm) RemoveExternalChanges ¶
func (h *Helm) RemoveExternalChanges(ctx context.Context, bd *fleet.BundleDeployment) (string, error)
RemoveExternalChanges does a helm rollback to remove changes made outside of fleet. It removes the helm history entry if the rollback fails.
func (*Helm) ResourcesFromPreviousReleaseVersion ¶
func (*Helm) Setup ¶ added in v0.10.0
func (h *Helm) Setup(ctx context.Context, client client.Client, getter genericclioptions.RESTClientGetter) error