k8sutil

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package k8sutil provides helper for interacting with Kubernetes API.

Index

Constants

View Source
const RolloutTimeout = 15 * time.Minute

RolloutTimeout is the timeout to wait for a daemonset or deployment to rollout changes.

View Source
const (
	// WaitDefaultTimeout is default timeout after which watching for workload should return error.
	WaitDefaultTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

func CreateOrUpdateNamespace added in v0.4.0

func CreateOrUpdateNamespace(ns Namespace, nsclient corev1typed.NamespaceInterface) error

CreateOrUpdateNamespace creates the release namespace or updates the namespace if it already exists.

func ListNamespaces added in v0.4.0

func ListNamespaces(nsclient corev1typed.NamespaceInterface) (*v1.NamespaceList, error)

ListNamespaces lists the namespaces present in the cluster.

func LoadManifests

func LoadManifests(files map[string]string) ([]manifest, error)

LoadManifests parses a map of Kubernetes manifests. Deprecated: YAMLToObjectMetadata should be used instead.

func NewClientset

func NewClientset(data []byte) (*kubernetes.Clientset, error)

NewClientset creates new Kubernetes Client set object from the contents of the given kubeconfig file.

func RolloutDaemonSet added in v0.8.0

func RolloutDaemonSet(ctx context.Context, dsi clientappsv1.DaemonSetInterface, name string) error

RolloutDaemonSet runs rolloutRestartDaemonSet and will wait for the DaemonSet to be fully rolled out.

func RolloutDeployment added in v0.8.0

func RolloutDeployment(ctx context.Context, deployClient clientappsv1.DeploymentInterface, name string) error

RolloutDeployment runs rolloutRestartDeployment and will wait for the DaemonSet to be fully rolled out.

func SplitYAMLDocuments added in v0.7.0

func SplitYAMLDocuments(yamlObj string) ([]string, error)

SplitYAMLDocuments separates a YAML file with multiple YAML documents separated by `---` into separate YAML files and returns a list.

func YAMLToUnstructured added in v0.7.0

func YAMLToUnstructured(yamlObj []byte) (*unstructured.Unstructured, error)

YAMLToUnstructured accepts a Kubernetes manifest in YAML format and returns an object of type `unstructured.Unstructured`. This object has many methods that can be used by the consumer to extract metadata from the Kubernetes manifest.

Types

type Getter added in v0.4.0

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

Getter implements k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface.

func NewGetter added in v0.4.0

func NewGetter(data []byte) (*Getter, error)

NewGetter takes content of kubeconfig file as an argument and returns implementation of RESTClientGetter k8s interface.

func (*Getter) ToDiscoveryClient added in v0.4.0

func (c *Getter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

ToDiscoveryClient is part of k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface.

func (*Getter) ToRESTConfig added in v0.4.0

func (c *Getter) ToRESTConfig() (*rest.Config, error)

ToRESTConfig is part of k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface.

func (*Getter) ToRESTMapper added in v0.4.0

func (c *Getter) ToRESTMapper() (meta.RESTMapper, error)

ToRESTMapper is part of k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface.

func (*Getter) ToRawKubeConfigLoader added in v0.4.0

func (c *Getter) ToRawKubeConfigLoader() clientcmd.ClientConfig

ToRawKubeConfigLoader is part of k8s.io/cli-runtime/pkg/genericclioptions.RESTClientGetter interface.

type Namespace added in v0.4.0

type Namespace struct {
	Name        string
	Labels      map[string]string
	Annotations map[string]string
}

Namespace struct for holding the Lokomotive specific metadata. when installing cluster or components.

type ObjectMetadata added in v0.7.0

type ObjectMetadata struct {
	Version string
	Kind    string
	Name    string
}

ObjectMetadata uniquely identifies any object in the list of YAML manifests.

func YAMLToObjectMetadata added in v0.7.0

func YAMLToObjectMetadata(yamlObj string) (ObjectMetadata, error)

YAMLToObjectMetadata extracts Kubernetes metadata from any YAML manifest and return an ObjectMetadata.

type WaitOptions added in v0.8.0

type WaitOptions struct {
	Generation int64
	Timeout    time.Duration
}

WaitOptions holds optional arguments for WaitFor... functions group.

Jump to

Keyboard shortcuts

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