packages

package
v0.0.0-...-fe3d3e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package packages facilitates the creation of Carvel package repositories and package installs within the cluster. In order for its operations to be successful, an instance of kapp-controller is expected to be running in the cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PackageClient

type PackageClient struct {
	// contains filtered or unexported fields
}

PackageClient implements PackageManager and holds references to both clientSet and restClient objects. clientSet is used to interact with native Kubernetes objects and restClient is used to interact with CRDs.

func (*PackageClient) CreatePackageInstall

func (am *PackageClient) CreatePackageInstall(opts *PackageInstallOpts) (*packaging.PackageInstall, error)

func (*PackageClient) CreatePackageRepo

func (am *PackageClient) CreatePackageRepo(ns, name, url string) (*packaging.PackageRepository, error)

func (*PackageClient) CreateRootServiceAccount

func (am *PackageClient) CreateRootServiceAccount(ns, name string) (*v1.ServiceAccount, error)

func (*PackageClient) GetRepositoryStatus

func (am *PackageClient) GetRepositoryStatus(ns, name string) (string, error)

func (*PackageClient) GetRootServiceAccount

func (am *PackageClient) GetRootServiceAccount(ns, name string) (*v1.ServiceAccount, error)

func (*PackageClient) ListPackagesInNamespace

func (am *PackageClient) ListPackagesInNamespace(ns string) ([]datapackaging.Package, error)

type PackageInstallOpts

type PackageInstallOpts struct {
	// The namespace the PackageInstall object should be created in
	Namespace string
	// The name of the create PackageInstall object
	InstallName string
	// The fully qualified name of the package to install. This and Version are how packages are resolved
	// from a repository.
	FqPkgName string
	// The version of the package to install. This and FqPkgName are how packages are resolved
	// from a repository.
	Version string
	// Optional configuration to be added alongside the package installation. When this value is non-nil, a
	// Secret object is created in the cluster and the package install references it as a values configuration.
	Configuration []byte
	// The ServiceAccount used to facilitate the package install. It must have all privileges required for
	// kapp-controller to create the appropriate objects.
	ServiceAccount string
}

type PackageManager

type PackageManager interface {
	// CreatePackageRepo adds a PackageRepository to the cluster, which in turn makes packages
	// available. If it can successfully add the repository to the cluster, it returns the
	// PackageRepository object created, otherwise an error. It does not wait for a package
	// repository to reconcile. Upon success, it returns the created PackageRepository object.
	CreatePackageRepo(ns, name, url string) (*packaging.PackageRepository, error)
	// CreatePackageInstall adds a PackageInstall object to the cluster. It requires you provide
	// the namespace, install name, fully qualified package name, version, and service account.
	// Configuration may also be passed, if nil, no configuration is added. Configuration is added
	// by injecting a secret object into the cluster and referencing it from the package install.
	// Upon success, it returns the created PackageInstall object.
	CreatePackageInstall(opts *PackageInstallOpts) (*packaging.PackageInstall, error)
	// CreateRootServiceAccount creates a service account in the target namespace with a ClusterRoleBinding
	// referencing the cluster-admin CluterRole. This essentially provides full admin access to anything
	// referencing this service account. Upon success, it returns the created ServiceAccount.
	CreateRootServiceAccount(ns, name string) (*v1.ServiceAccount, error)
	// GetRootServiceAccount returns the root service account
	// given a namespace and the name of the service account
	// Returns nil if service account does not exist
	GetRootServiceAccount(ns, name string) (*v1.ServiceAccount, error)
	// GetRepositoryStatus outputs the status of a repository based on the namespace and repository name
	// requested. It provides details on kapp-controller process such as "Reconciling" and "Reconcile Succeeded"
	GetRepositoryStatus(ns, name string) (string, error)
	// ListPackagesInNamespace returns a list of packages based on the namespace.
	ListPackagesInNamespace(ns string) ([]datapackaging.Package, error)
}

PackageManager provides operations for doing package management against a cluster.

func NewClient

func NewClient(kubeconfigBytes []byte) PackageManager

NewClient create an instance of a PackageManager, implemented by PackageClient, by passing a kubeconfig targeting the cluster. It also sets up both a restClient for CRD interaction (Package APIs) and a clientSet for Kubernetes API interaction. For the restClient, it registers the packaging APIs to the scheme.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL