k8spkg

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
	PKG_NAME_LABEL = "app.kubernetes.io/part-of"
	PKG_NS_LABEL   = "k8spkg.mgoltzsche.github.com/namespaces"
)

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

func TransformedObjects

func TransformedObjects(reader io.Reader, namespace, name string) (obj []*model.K8sObject, err error)

TransformedObjects read API objects from reader and modify their name and namespace if provided

Types

type APIResourceType

type APIResourceType struct {
	Name       string
	ShortNames []string
	APIGroup   string
	Kind       string
	Namespaced bool
}

APIResourceType represents a Kubernetes API resource type's metadata

func LoadAPIResourceTypes

func LoadAPIResourceTypes(ctx context.Context, kubeconfigFile string) (types []*APIResourceType, err error)

func (*APIResourceType) FullName

func (t *APIResourceType) FullName() (name string)

Returns the type's short name with APIGroup suffix if there is one

func (*APIResourceType) ShortName

func (t *APIResourceType) ShortName() (name string)

Returns the type's short name if any or its name

type K8sPackage

type K8sPackage struct {
	*PackageInfo
	Objects []*model.K8sObject
}

K8sPackage define a collection of objects and their package metadata

func PkgFromManifest

func PkgFromManifest(reader io.Reader, namespace, name string) (pkg *K8sPackage, err error)

type PackageInfo

type PackageInfo struct {
	Name       string
	Namespaces []string
}

func PackageInfosFromObjects

func PackageInfosFromObjects(obj []*model.K8sObject) (pkgs []*PackageInfo, err error)

Returns a list of the packages declared within the provided objects. An error is only returned if an object has no k8spkg label while all declared packages are still returned.

type PackageManager

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

func NewPackageManager

func NewPackageManager(kubeconfigFile string) *PackageManager

func (*PackageManager) Apply

func (m *PackageManager) Apply(ctx context.Context, pkg *K8sPackage, prune bool) (err error)

func (*PackageManager) Delete

func (m *PackageManager) Delete(ctx context.Context, namespace, pkgName string) (err error)

func (*PackageManager) DeleteObjects

func (m *PackageManager) DeleteObjects(ctx context.Context, obj []*model.K8sObject) (err error)

func (*PackageManager) List

func (m *PackageManager) List(ctx context.Context, allNamespaces bool, namespace string) (pkgs []*PackageInfo, err error)

func (*PackageManager) State

func (m *PackageManager) State(ctx context.Context, namespace, pkgName string) (pkg *K8sPackage, err error)

Jump to

Keyboard shortcuts

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