Documentation ¶
Index ¶
- func Apply(client Client, namespace string, files ...string) error
- func CreateOrUpdateSecret(client Client, namespace, secretName string, data, labels map[string]string) (result *corev1.Secret, err error)
- func CreateSecret(client *rest.RESTClient, namespace string, secret *corev1.Secret) (result *corev1.Secret, err error)
- func DefaultSafeContexts() []string
- func Delete(client Client, namespace string, timeout time.Duration, files ...string) error
- func DeleteSecret(client *rest.RESTClient, namespace, secretName string) error
- func GetPodsByLabel(client Client, namespace, labelKey, labelValue string) ([]v1.Pod, error)
- func GetSecret(client *rest.RESTClient, namespace, secretName string) (result *corev1.Secret, err error)
- func NormalizeNamespace(namespace string) string
- func PortForward(opts ForwardingOptions) (err error)
- func RolloutStatus(client Client, namespace string, timeout time.Duration, ...) error
- func SubscribeToResources(ctx context.Context, client Client, subscribeOpts SubscribeOptions) error
- func UpdateSecret(client *rest.RESTClient, namespace string, secret *corev1.Secret) (result *corev1.Secret, err error)
- type Client
- type ForwardingOptions
- type InformerHandlers
- type ObservableResource
- type Resource
- type ResourceEventHandler
- type SubscribeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateOrUpdateSecret ¶
func CreateOrUpdateSecret(client Client, namespace, secretName string, data, labels map[string]string) (result *corev1.Secret, err error)
CreateOrUpdateSecret either creates a secret if one does not exist OR it updates a secret that does exist, overwriting its data
func CreateSecret ¶
func CreateSecret(client *rest.RESTClient, namespace string, secret *corev1.Secret) (result *corev1.Secret, err error)
CreateSecret creates a secret
func DefaultSafeContexts ¶
func DefaultSafeContexts() []string
DefaultSafeContexts returns known safe Kubernetes contexts
func Delete ¶
Delete removes Kubernetes resources from a cluster based on a set of provided manifests
func DeleteSecret ¶
func DeleteSecret(client *rest.RESTClient, namespace, secretName string) error
DeleteSecret removes a secret
func GetPodsByLabel ¶
GetPodsByLabel returns a slice of pod objects that match a label FIXME: this function should use the k8s namespace on the client
func GetSecret ¶
func GetSecret(client *rest.RESTClient, namespace, secretName string) (result *corev1.Secret, err error)
GetSecret checks for the existence of a secret
func NormalizeNamespace ¶
NormalizeNamespace cleans a namespace to ensure kubernetes compatibility
func PortForward ¶
func PortForward(opts ForwardingOptions) (err error)
PortForward builds out all of the required options to port forward, aggregates them into the ForwardingOptions struct and then runs the Execute() function to run the port forward operation
func RolloutStatus ¶
func RolloutStatus(client Client, namespace string, timeout time.Duration, resourceType, resourceName string) error
RolloutStatus polls Kubernetes for a rollout status for Deployments, DaemonSets and StatefulSets; the function exits when the rollout has completed or the timeout threshold is met
func SubscribeToResources ¶
func SubscribeToResources( ctx context.Context, client Client, subscribeOpts SubscribeOptions, ) error
SubscribeToResources start informers
func UpdateSecret ¶
func UpdateSecret(client *rest.RESTClient, namespace string, secret *corev1.Secret) (result *corev1.Secret, err error)
UpdateSecret updates a secret that already exists
Types ¶
type Client ¶
Client is a container for a kubernetes cmdutil factory
func Init ¶
func Init(getter genericclioptions.RESTClientGetter) Client
Init creates a new domain k8s kube.Client This will attempt to match the server API version
func InitWithSafeContexts ¶
InitWithSafeContexts initializes a new kubernetes client set
func (*Client) CurrentContext ¶
CurrentContext returns the current context from the kube config
func (*Client) GetPodByResource ¶
func (c *Client) GetPodByResource( resourceType, resourceName string, timeout time.Duration, ) (*corev1.Pod, error)
GetPodByResource queries a kubernetes cluster for a corev1.pod by deployment
func (*Client) Namespace ¶
Namespace returns the current clients namespace - Checks namespace override - Checks kube config namespace - Defaults to v1.NamespaceDefault
func (*Client) NewNamespacedBuilder ¶
NewNamespacedBuilder returns a new resource builder for structured api objects.
type ForwardingOptions ¶
type ForwardingOptions struct { Namespace string Pod v1.Pod Client Client Ports []string StopChannel chan struct{} ReadyChannel chan struct{} DoneChannel chan error // contains filtered or unexported fields }
ForwardingOptions a container for options and channels that help orchestrate the port forwarder
func (*ForwardingOptions) Stop ¶
func (f *ForwardingOptions) Stop()
type InformerHandlers ¶
type InformerHandlers = map[Resource]ResourceEventHandler
InformerHandlers a map for resources and handlers
type ObservableResource ¶
ObservableResource provides a container for passing around resource kinds and names
func GetObservableResourceNamesByLabel ¶
func GetObservableResourceNamesByLabel(client Client, namespace, labelKey, labelValue string) ([]ObservableResource, error)
GetObservableResourceNamesByLabel returns a map of resources that have a specific label this is used to provide name and kind information to the RolloutStatus function
type ResourceEventHandler ¶
type ResourceEventHandler interface { OnAddFunc(obj interface{}) OnUpdateFunc(oldObj, newObj interface{}) OnDeleteFunc(obj interface{}) GetIndexes() map[string]func(interface{}) ([]string, error) AddIndex(string, func(interface{}) ([]string, error)) }
ResourceEventHandler is the contract that all resources need to implement in order to be used as an informer
type SubscribeOptions ¶
type SubscribeOptions struct { InformerHnadlers InformerHandlers Duration time.Duration }
SubscribeOptions holds the handlers that will be used and the refresh rate of the informers