Documentation ¶
Overview ¶
Package k8sutil provides helper for interacting with Kubernetes API.
Index ¶
- Constants
- func CreateOrUpdateNamespace(ns Namespace, nsclient corev1typed.NamespaceInterface) error
- func ListNamespaces(nsclient corev1typed.NamespaceInterface) (*v1.NamespaceList, error)
- func LoadManifests(files map[string]string) ([]manifest, error)
- func NewClientset(data []byte) (*kubernetes.Clientset, error)
- func RolloutDaemonSet(ctx context.Context, dsi clientappsv1.DaemonSetInterface, name string) error
- func RolloutDeployment(ctx context.Context, deployClient clientappsv1.DeploymentInterface, ...) error
- func SplitYAMLDocuments(yamlObj string) ([]string, error)
- func YAMLToUnstructured(yamlObj []byte) (*unstructured.Unstructured, error)
- type Getter
- type Namespace
- type ObjectMetadata
- type WaitOptions
Constants ¶
const RolloutTimeout = 15 * time.Minute
RolloutTimeout is the timeout to wait for a daemonset or deployment to rollout changes.
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 ¶
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
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
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
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
Namespace struct for holding the Lokomotive specific metadata. when installing cluster or components.
type ObjectMetadata ¶ added in v0.7.0
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
WaitOptions holds optional arguments for WaitFor... functions group.