Documentation ¶
Index ¶
- type Client
- type ClientImpl
- func (c *ClientImpl) DeletePod(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error
- func (c *ClientImpl) GetEvents(ctx context.Context, namespace string) ([]corev1.Event, error)
- func (c *ClientImpl) GetStatefulSet(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*appsv1.StatefulSet, error)
- func (c *ClientImpl) ListNamespaces(ctx context.Context, opts metav1.ListOptions) ([]corev1.Namespace, error)
- func (c *ClientImpl) ListPods(ctx context.Context, namespace string, opts metav1.ListOptions) ([]corev1.Pod, error)
- func (c *ClientImpl) ListStatefulSets(ctx context.Context, namespace string, opts metav1.ListOptions) ([]appsv1.StatefulSet, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // ListNamespaces retrieves all namespaces in the cluster. ListNamespaces(ctx context.Context, opts metav1.ListOptions) ([]corev1.Namespace, error) // ListPods retrieves all pods in the namespace. ListPods(ctx context.Context, namespace string, opts metav1.ListOptions) ([]corev1.Pod, error) // DeletePod deletes a pod. DeletePod(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error // ListStatefulSets retrieves all stateful sets in the namespace. ListStatefulSets(ctx context.Context, namespace string, opts metav1.ListOptions) ([]appsv1.StatefulSet, error) // GetStatefulSet retrieves a single StatefulSet. GetStatefulSet(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*appsv1.StatefulSet, error) // GetEvents retrieves events for the given namespace. GetEvents(ctx context.Context, namespace string) ([]corev1.Event, error) }
Client provides an interface for interacting with a Kubernetes cluster. It is a thin wrapper around the Kubernetes API which allows for mocking requests.
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
ClientImpl implements Client.
func NewClient ¶
func NewClient(ctx context.Context, clientset *kubernetes.Clientset) (*ClientImpl, error)
NewClient returns a ClientImpl instance. TODO(borenet): Handle more of the setup here.
func NewInClusterClient ¶
func NewInClusterClient(ctx context.Context) (*ClientImpl, error)
NewInClusterClient creates a Client which can be used to interact with the cluster in which this service is running.
func NewLocalClient ¶
func NewLocalClient(ctx context.Context, kubeConfigFile, clusterConfigFile, cluster string) (*ClientImpl, error)
NewLocalClient uses the local kubeconfig file, the clusters config.json file, and a cluster name to create a Client which can be used to interact with that cluster. TODO(borenet): This requires that the user has previously created credentials for the requested cluster.
func (*ClientImpl) DeletePod ¶
func (c *ClientImpl) DeletePod(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error
DeletePod implements Client.
func (*ClientImpl) GetStatefulSet ¶
func (c *ClientImpl) GetStatefulSet(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*appsv1.StatefulSet, error)
GetStatefulSet implements Client.
func (*ClientImpl) ListNamespaces ¶
func (c *ClientImpl) ListNamespaces(ctx context.Context, opts metav1.ListOptions) ([]corev1.Namespace, error)
GetNamespaces implements Client.
func (*ClientImpl) ListPods ¶
func (c *ClientImpl) ListPods(ctx context.Context, namespace string, opts metav1.ListOptions) ([]corev1.Pod, error)
GetPods implements Client.
func (*ClientImpl) ListStatefulSets ¶
func (c *ClientImpl) ListStatefulSets(ctx context.Context, namespace string, opts metav1.ListOptions) ([]appsv1.StatefulSet, error)
ListStatefulSets implements Client.