Documentation ¶
Overview ¶
Package kubernetes encapsulates all calls to the Kubernetes API into meaningful functions for use by the CLI and controllers
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventInterface ¶
type EventInterface interface { // Retrieve all events from a namespace GetEvents(namespace string) (*v1beta1.EventList, error) }
EventInterface has functions that interacts with pod object in the Kubernetes cluster
func Event ¶
func Event() EventInterface
Event will fetch the inner API for Kubernetes event resource with a default client
func EventC ¶
func EventC(c *client.Client) EventInterface
EventC will use a defined client to fetch the Kubernetes event resources
type NamespaceInterface ¶
type NamespaceInterface interface { Fetch(name string) (*corev1.Namespace, error) Create(name string) (*corev1.Namespace, error) CreateIfNotExists(name string) (*corev1.Namespace, error) }
NamespaceInterface has functions that interacts with namespace object in the Kubernetes cluster
func Namespace ¶
func Namespace() NamespaceInterface
Namespace will fetch the inner Kubernetes API with a default client
func NamespaceC ¶
func NamespaceC(c *client.Client) NamespaceInterface
NamespaceC will use a defined client to fetch the Kubernetes API
type PodInterface ¶
type PodInterface interface { // Immediately return pod log GetLogs(namespace, podName, containerName string) (string, error) // Wait until pod is terminated and then return pod log GetLogsWithFollow(namespace, podName, containerName string) (string, error) }
PodInterface has functions that interacts with pod object in the Kubernetes cluster
func Pod ¶
func Pod() PodInterface
Pod will fetch the inner API for Kubernetes pod resource with a default client
func PodC ¶
func PodC(c *client.Client) PodInterface
PodC will use a defined client to fetch the Kubernetes pod resources
type ResourceInterface ¶
type ResourceInterface interface { ResourceReader ResourceWriter // CreateIfNotExists will fetch for the object resource in the Kubernetes cluster, if not exists, will create it. CreateIfNotExists(resource ResourceObject) (err error) // CreateIfNotExistsForOwner sets the controller owner to the given resource and creates if it not exists. // If the given resource exists, won't update the object with the given owner. CreateIfNotExistsForOwner(resource ResourceObject, owner metav1.Object, scheme *runtime.Scheme) (err error) // CreateForOwner sets the controller owner to the given resource and creates the resource. CreateForOwner(resource ResourceObject, owner metav1.Object, scheme *runtime.Scheme) error // CreateFromYamlContent creates Kubernetes resources from a yaml string content CreateFromYamlContent(yamlContent, namespace string, resourceRef ResourceObject, beforeCreate func(object interface{})) error }
ResourceInterface has functions that interacts with any resource object in the Kubernetes cluster
func Resource ¶
func Resource() ResourceInterface
Resource will fetch the inner API for any Kubernetes resource with a default client
func ResourceC ¶
func ResourceC(c *client.Client) ResourceInterface
ResourceC will use a defined client to fetch the Kubernetes API
type ResourceObject ¶
ResourceObject is any object in a Kubernetes or OpenShift cluster
type ResourceReader ¶
type ResourceReader interface { // FetchWithKey fetches and binds a resource from the Kubernetes cluster with the defined key. If not exists, returns false. FetchWithKey(key types.NamespacedName, resource ResourceObject) (exists bool, err error) // Fetch fetches and binds a resource with given name and namespace from the Kubernetes cluster. If not exists, returns false. Fetch(resource ResourceObject) (exists bool, err error) // ListWithNamespace fetches and binds a list resource from the Kubernetes cluster with the defined namespace. ListWithNamespace(namespace string, list runtime.Object) error // ListWithNamespaceAndLabel same as ListWithNamespace, but also limit the query scope by the given labels ListWithNamespaceAndLabel(namespace string, list runtime.Object, labels map[string]string) error // ListAll returns a map of Kubernetes resources organized by type, based on provided List objects ListAll(objectTypes []runtime.Object, namespace string, ownerObject metav1.Object) (map[reflect.Type][]resource2.KubernetesResource, error) }
ResourceReader interface to read kubernetes object
func ResourceReaderC ¶
func ResourceReaderC(cli *client.Client) ResourceReader
ResourceReaderC provide ResourceReader reference
type ResourceWriter ¶
type ResourceWriter interface { // Create creates a new Kubernetes object in the cluster. // Note that no checks will be performed in the cluster. If you're not sure, use CreateIfNotExists. Create(resource ResourceObject) error // Delete delete the given object Delete(resource ResourceObject) error // Update the given object Update(resource ResourceObject) error // UpdateStatus update the given object status UpdateStatus(resource ResourceObject) error // CreateResources create provided objects CreateResources(resources []resource2.KubernetesResource) (bool, error) // UpdateResources update provided objects UpdateResources(existing []resource2.KubernetesResource, resources []resource2.KubernetesResource) (bool, error) // DeleteResources delete provided objects DeleteResources(resources []resource2.KubernetesResource) (bool, error) }
ResourceWriter interface to write kubernetes object
func ResourceWriterC ¶
func ResourceWriterC(cli *client.Client) ResourceWriter
ResourceWriterC provide ResourceWrite reference