k8sutil

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: Apache-2.0 Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineManifests added in v0.17.0

func CombineManifests(base []byte, manifests ...[]byte) []byte

CombineManifests combines given manifests with a base manifest and adds yaml style separation. Nothing is appended if the manifest is empty or base already contains a trailing separator.

func Convertv1beta1Tov1CustomResourceDefinition added in v0.18.0

func Convertv1beta1Tov1CustomResourceDefinition(in *apiextv1beta1.CustomResourceDefinition) (*apiextv1.CustomResourceDefinition, error)

func CreateFQAPIs added in v0.11.0

func CreateFQAPIs(pkg string, gvs map[string][]string) (apis []string)

CreateFQAPIs return a slice of all fully qualified pkg + groups + versions of pkg and gvs in the format "pkg/groupA/v1".

func DefinitionsForV1CustomResourceDefinitions added in v0.18.0

func DefinitionsForV1CustomResourceDefinitions(crds ...apiextv1.CustomResourceDefinition) (keys []registry.DefinitionKey)

DefinitionsForV1CustomResourceDefinitions returns definition keys for all custom resource versions in each crd in crds.

func DefinitionsForV1beta1CustomResourceDefinitions added in v0.18.0

func DefinitionsForV1beta1CustomResourceDefinitions(crds ...apiextv1beta1.CustomResourceDefinition) (keys []registry.DefinitionKey)

DefinitionsForV1beta1CustomResourceDefinitions returns definition keys for all custom resource versions in each crd in crds.

func FormatOperatorNameDNS1123 added in v0.14.0

func FormatOperatorNameDNS1123(name string) string

FormatOperatorNameDNS1123 ensures name is DNS1123 label-compliant by replacing all non-compliant UTF-8 characters with "-".

func GVKsForV1CustomResourceDefinitions added in v0.18.0

func GVKsForV1CustomResourceDefinitions(crds ...apiextv1.CustomResourceDefinition) (gvks []schema.GroupVersionKind)

GVKsForV1CustomResourceDefinitions returns GroupVersionKind's for all custom resource versions in each crd in crds.

func GVKsForV1beta1CustomResourceDefinitions added in v0.18.0

func GVKsForV1beta1CustomResourceDefinitions(crds ...apiextv1beta1.CustomResourceDefinition) (gvks []schema.GroupVersionKind)

GVKsForV1beta1CustomResourceDefinitions returns GroupVersionKind's for all custom resource versions in each crd in crds.

func GenerateCombinedGlobalManifest added in v0.17.0

func GenerateCombinedGlobalManifest(crdsDir string) (*os.File, error)

GenerateCombinedGlobalManifest creates a temporary manifest yaml by combining all standard global resource manifests in crdsDir.

func GenerateCombinedNamespacedManifest added in v0.17.0

func GenerateCombinedNamespacedManifest(deployDir string) (*os.File, error)

GenerateCombinedNamespacedManifest creates a temporary manifest yaml by combining all standard namespaced resource manifests in deployDir.

func GetCustomResourceDefinitions added in v0.17.0

func GetCustomResourceDefinitions(crdsDir string) (
	v1crds []apiextv1.CustomResourceDefinition,
	v1beta1crds []apiextv1beta1.CustomResourceDefinition,
	err error)

GetCustomResourceDefinitions returns all CRD manifests of both v1 and v1beta1 versions in the directory crdsDir. If a duplicate object with different API versions is found, and error is returned.

func GetDisplayName added in v0.9.0

func GetDisplayName(name string) string

GetDisplayName turns a project dir name in any of {snake, chain, camel} cases, hierarchical dot structure, or space-delimited into a space-delimited, title'd display name. Ex. "another-_AppOperator_againTwiceThrice More" -> "Another App Operator Again Twice Thrice More"

func GetKubeconfigAndNamespace

func GetKubeconfigAndNamespace(configPath string) (*rest.Config, string, error)

GetKubeconfigAndNamespace returns the *rest.Config and default namespace defined in the kubeconfig at the specified path. If no path is provided, returns the default *rest.Config and namespace

func GetObjectBytes added in v0.6.0

func GetObjectBytes(obj interface{}, m MarshalFunc) ([]byte, error)

GetObjectBytes marshalls an object with m and removes runtime-managed fields: 'status', 'creationTimestamp'

func GetTypeMetaFromBytes added in v0.10.0

func GetTypeMetaFromBytes(b []byte) (t metav1.TypeMeta, err error)

GetTypeMetaFromBytes gets the type and object metadata from b. b is assumed to be a single Kubernetes resource manifest.

func ParseGroupSubpackages added in v0.11.0

func ParseGroupSubpackages(apisDir string) (map[string][]string, error)

ParseGroupSubpackages parses the apisDir directory tree and returns a map of all found API groups to subpackages.

func ParseGroupVersions added in v0.11.0

func ParseGroupVersions(apisDir string) (map[string][]string, error)

ParseGroupVersions parses the apisDir directory tree and returns a map of all found API groups to versions.

func TrimDNS1123Label added in v0.17.1

func TrimDNS1123Label(label string) string

TrimDNS1123Label trims a label to meet the DNS 1123 label length requirement by removing characters from the beginning of label such that len(label) <= 63.

Types

type CRDVersions added in v0.13.0

func (CRDVersions) Len added in v0.13.0

func (vs CRDVersions) Len() int

func (CRDVersions) Less added in v0.13.0

func (vs CRDVersions) Less(i, j int) bool

func (CRDVersions) Swap added in v0.13.0

func (vs CRDVersions) Swap(i, j int)

type MarshalFunc added in v0.9.0

type MarshalFunc func(interface{}) ([]byte, error)

type Scanner added in v0.17.0

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

Scanner scans a yaml manifest file for manifest tokens delimited by "---". See bufio.Scanner for semantics.

func NewYAMLScanner added in v0.17.0

func NewYAMLScanner(r io.Reader) *Scanner

func (*Scanner) Bytes added in v0.17.0

func (s *Scanner) Bytes() []byte

func (*Scanner) Err added in v0.17.0

func (s *Scanner) Err() error

func (*Scanner) Scan added in v0.17.0

func (s *Scanner) Scan() bool

func (*Scanner) Text added in v0.17.0

func (s *Scanner) Text() string

Jump to

Keyboard shortcuts

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