cleanup pass
parent
e8aadc67f0
commit
57c77ca557
|
|
@ -32,10 +32,9 @@ var (
|
|||
Long: `K9s is a CLI to view and manage your Kubernetes clusters.`,
|
||||
Run: run,
|
||||
}
|
||||
_ config.KubeSettings = &k8s.Config{}
|
||||
)
|
||||
|
||||
var _ config.KubeSettings = &k8s.Config{}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd(), infoCmd())
|
||||
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package k8s
|
||||
|
||||
// Cluster manages a Kubernetes ClusterRole.
|
||||
// Cluster represents a Kubernetes cluster.
|
||||
type Cluster struct{}
|
||||
|
||||
// NewCluster instantiates a new ClusterRole.
|
||||
// NewCluster instantiates a new cluster.
|
||||
func NewCluster() *Cluster {
|
||||
return &Cluster{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ func NewClusterRole() Res {
|
|||
return &ClusterRole{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a cluster role.
|
||||
func (*ClusterRole) Get(_, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().RbacV1().ClusterRoles().Get(n, opts)
|
||||
}
|
||||
|
||||
// List all ClusterRoles in a given namespace
|
||||
// List all ClusterRoles on a cluster.
|
||||
func (*ClusterRole) List(_ string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*ClusterRole) List(_ string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a ClusterRole
|
||||
// Delete a ClusterRole.
|
||||
func (*ClusterRole) Delete(_, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().RbacV1().ClusterRoles().Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ func (*ClusterRoleBinding) Get(_, n string) (interface{}, error) {
|
|||
return conn.dialOrDie().RbacV1().ClusterRoleBindings().Get(n, opts)
|
||||
}
|
||||
|
||||
// List all ClusterRoleBindings in a given namespace
|
||||
// List all ClusterRoleBindings on a cluster.
|
||||
func (*ClusterRoleBinding) List(_ string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*ClusterRoleBinding) List(_ string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a ClusterRoleBinding
|
||||
// Delete a ClusterRoleBinding.
|
||||
func (*ClusterRoleBinding) Delete(_, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().RbacV1().ClusterRoleBindings().Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ func (c *ConfigMap) Get(ns, n string) (interface{}, error) {
|
|||
return conn.dialOrDie().CoreV1().ConfigMaps(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all ConfigMaps in a given namespace
|
||||
// List all ConfigMaps in a given namespace.
|
||||
func (c *ConfigMap) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (c *ConfigMap) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a ConfigMap
|
||||
// Delete a ConfigMap.
|
||||
func (c *ConfigMap) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().ConfigMaps(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"k8s.io/client-go/tools/clientcmd/api"
|
||||
)
|
||||
|
||||
// ContextRes represents a kubernetes clusters configurations.
|
||||
// ContextRes represents a Kubernetes clusters configurations.
|
||||
type ContextRes interface {
|
||||
Res
|
||||
Switch(n string) error
|
||||
|
|
@ -45,7 +45,7 @@ func (*Context) Get(_, n string) (interface{}, error) {
|
|||
return &NamedContext{Name: n, Context: ctx}, nil
|
||||
}
|
||||
|
||||
// List all Contexts in a given namespace
|
||||
// List all Contexts on the current cluster.
|
||||
func (*Context) List(string) (Collection, error) {
|
||||
ctxs, err := conn.config.Contexts()
|
||||
if err != nil {
|
||||
|
|
@ -58,7 +58,7 @@ func (*Context) List(string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a Context
|
||||
// Delete a Context.
|
||||
func (*Context) Delete(_, n string) error {
|
||||
ctx, err := conn.config.CurrentContextName()
|
||||
if err != nil {
|
||||
|
|
@ -70,7 +70,7 @@ func (*Context) Delete(_, n string) error {
|
|||
return conn.config.DelContext(n)
|
||||
}
|
||||
|
||||
// Switch cluster Context.
|
||||
// Switch to another context.
|
||||
func (*Context) Switch(n string) error {
|
||||
conn.switchContextOrDie(n)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ func (*CRD) Get(_, n string) (interface{}, error) {
|
|||
return conn.nsDialOrDie().Get(n, opts)
|
||||
}
|
||||
|
||||
// List all CRDs in a given namespace
|
||||
// List all CRDs in a given namespace.
|
||||
func (*CRD) List(string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*CRD) List(string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a CRD
|
||||
// Delete a CRD.
|
||||
func (*CRD) Delete(_, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.nsDialOrDie().Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
const maxJobNameSize = 42
|
||||
|
||||
// CronJob represents a Kubernetes CronJob
|
||||
// CronJob represents a Kubernetes CronJob.
|
||||
type CronJob struct{}
|
||||
|
||||
// NewCronJob returns a new CronJob.
|
||||
|
|
@ -23,7 +23,7 @@ func (c *CronJob) Get(ns, n string) (interface{}, error) {
|
|||
return conn.dialOrDie().BatchV1beta1().CronJobs(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all CronJobs in a given namespace
|
||||
// List all CronJobs in a given namespace.
|
||||
func (c *CronJob) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ func (c *CronJob) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a CronJob
|
||||
// Delete a CronJob.
|
||||
func (c *CronJob) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().BatchV1beta1().CronJobs(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Deployment represents a Kubernetes Deployment
|
||||
// Deployment represents a Kubernetes Deployment.
|
||||
type Deployment struct{}
|
||||
|
||||
// NewDeployment returns a new Deployment.
|
||||
|
|
@ -12,13 +12,13 @@ func NewDeployment() Res {
|
|||
return &Deployment{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a deployment.
|
||||
func (*Deployment) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().Apps().Deployments(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all Deployments in a given namespace
|
||||
// List all Deployments in a given namespace.
|
||||
func (*Deployment) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*Deployment) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a Deployment
|
||||
// Delete a Deployment.
|
||||
func (*Deployment) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().Apps().Deployments(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ func NewDaemonSet() Res {
|
|||
return &DaemonSet{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a DaemonSet.
|
||||
func (*DaemonSet) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().ExtensionsV1beta1().DaemonSets(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all DaemonSets in a given namespace
|
||||
// List all DaemonSets in a given namespace.
|
||||
func (*DaemonSet) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*DaemonSet) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a DaemonSet
|
||||
// Delete a DaemonSet.
|
||||
func (*DaemonSet) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().ExtensionsV1beta1().DaemonSets(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Endpoints represents a Kubernetes Endpoints
|
||||
// Endpoints represents a Kubernetes Endpoints.
|
||||
type Endpoints struct{}
|
||||
|
||||
// NewEndpoints returns a new Endpoints.
|
||||
|
|
@ -12,13 +12,13 @@ func NewEndpoints() Res {
|
|||
return &Endpoints{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a Endpoint.
|
||||
func (*Endpoints) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().CoreV1().Endpoints(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all Endpointss in a given namespace
|
||||
// List all Endpoints in a given namespace.
|
||||
func (*Endpoints) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*Endpoints) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a Endpoints
|
||||
// Delete a Endpoint.
|
||||
func (*Endpoints) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().Endpoints(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Event represents a Kubernetes Event
|
||||
// Event represents a Kubernetes Event.
|
||||
type Event struct{}
|
||||
|
||||
// NewEvent returns a new Event.
|
||||
|
|
@ -12,13 +12,13 @@ func NewEvent() Res {
|
|||
return &Event{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a Event.
|
||||
func (*Event) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().CoreV1().Events(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all Events in a given namespace.
|
||||
func (*Event) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*Event) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete an Event.
|
||||
func (*Event) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().Events(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ func NewHPA() Res {
|
|||
return &HPA{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a HPA.
|
||||
func (*HPA) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().AutoscalingV2beta2().HorizontalPodAutoscalers(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all HPAs in a given namespace.
|
||||
func (*HPA) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*HPA) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a HPA.
|
||||
func (*HPA) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().AutoscalingV2beta2().HorizontalPodAutoscalers(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Ingress represents a Kubernetes Ingress
|
||||
// Ingress represents a Kubernetes Ingress.
|
||||
type Ingress struct{}
|
||||
|
||||
// NewIngress returns a new Ingress.
|
||||
|
|
@ -12,13 +12,13 @@ func NewIngress() Res {
|
|||
return &Ingress{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a Ingress.
|
||||
func (*Ingress) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().ExtensionsV1beta1().Ingresses(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all Ingresss in a given namespace
|
||||
// List all Ingresss in a given namespace.
|
||||
func (*Ingress) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*Ingress) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a Ingress
|
||||
// Delete a Ingress.
|
||||
func (*Ingress) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().ExtensionsV1beta1().Ingresses(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
restclient "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// Job represents a Kubernetes Job
|
||||
// Job represents a Kubernetes Job.
|
||||
type Job struct{}
|
||||
|
||||
// NewJob returns a new Job.
|
||||
|
|
@ -24,7 +24,7 @@ func (*Job) Get(ns, n string) (interface{}, error) {
|
|||
return conn.dialOrDie().BatchV1().Jobs(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all Jobs in a given namespace
|
||||
// List all Jobs in a given namespace.
|
||||
func (*Job) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -41,13 +41,13 @@ func (*Job) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a Job
|
||||
// Delete a Job.
|
||||
func (*Job) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().BatchV1().Jobs(ns).Delete(n, &opts)
|
||||
}
|
||||
|
||||
// Containers returns all container names on pod
|
||||
// Containers returns all container names on job.
|
||||
func (j *Job) Containers(ns, n string, includeInit bool) ([]string, error) {
|
||||
pod, err := j.assocPod(ns, n)
|
||||
if err != nil {
|
||||
|
|
@ -57,7 +57,7 @@ func (j *Job) Containers(ns, n string, includeInit bool) ([]string, error) {
|
|||
return NewPod().(Loggable).Containers(ns, pod, includeInit)
|
||||
}
|
||||
|
||||
// Logs fetch container logs for a given pod and container.
|
||||
// Logs fetch container logs for a given job and container.
|
||||
func (j *Job) Logs(ns, n, co string, lines int64, prev bool) *restclient.Request {
|
||||
pod, err := j.assocPod(ns, n)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Node represents a Kubernetes service
|
||||
// Node represents a Kubernetes node.
|
||||
type Node struct{}
|
||||
|
||||
// NewNode returns a new Node.
|
||||
|
|
@ -12,13 +12,13 @@ func NewNode() Res {
|
|||
return &Node{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a node.
|
||||
func (*Node) Get(_, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().CoreV1().Nodes().Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all nodes on the cluster.
|
||||
func (*Node) List(_ string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*Node) List(_ string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a node.
|
||||
func (*Node) Delete(_, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().Nodes().Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Namespace represents a Kubernetes service
|
||||
// Namespace represents a Kubernetes namespace.
|
||||
type Namespace struct{}
|
||||
|
||||
// NewNamespace returns a new Namespace.
|
||||
|
|
@ -12,13 +12,13 @@ func NewNamespace() Res {
|
|||
return &Namespace{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a namespace.
|
||||
func (*Namespace) Get(_, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().CoreV1().Namespaces().Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all namespaces on the cluster.
|
||||
func (*Namespace) List(_ string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*Namespace) List(_ string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a namespace.
|
||||
func (*Namespace) Delete(_, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().Namespaces().Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ func NewPod() Res {
|
|||
return &Pod{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a pod.
|
||||
func (*Pod) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().CoreV1().Pods(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all pods in a given namespace.
|
||||
func (*Pod) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ func (*Pod) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a pod.
|
||||
func (*Pod) Delete(ns, n string) error {
|
||||
var grace = defaultKillGrace
|
||||
opts := metav1.DeleteOptions{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// PV represents a Kubernetes service
|
||||
// PV represents a Kubernetes PersistentVolume.
|
||||
type PV struct{}
|
||||
|
||||
// NewPV returns a new PV.
|
||||
|
|
@ -12,13 +12,13 @@ func NewPV() Res {
|
|||
return &PV{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a PV.
|
||||
func (*PV) Get(_, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().CoreV1().PersistentVolumes().Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all PVs in a given namespace.
|
||||
func (*PV) List(_ string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*PV) List(_ string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a PV.
|
||||
func (*PV) Delete(_, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().PersistentVolumes().Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// PVC represents a Kubernetes service
|
||||
// PVC represents a Kubernetes service.
|
||||
type PVC struct{}
|
||||
|
||||
// NewPVC returns a new PVC.
|
||||
|
|
@ -12,13 +12,13 @@ func NewPVC() Res {
|
|||
return &PVC{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a PVC.
|
||||
func (*PVC) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().CoreV1().PersistentVolumeClaims(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all PVCs in a given namespace.
|
||||
func (*PVC) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*PVC) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a PVC.
|
||||
func (*PVC) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().PersistentVolumeClaims(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// ReplicationController represents a Kubernetes service
|
||||
// ReplicationController represents a Kubernetes service.
|
||||
type ReplicationController struct{}
|
||||
|
||||
// NewReplicationController returns a new ReplicationController.
|
||||
|
|
@ -12,13 +12,13 @@ func NewReplicationController() Res {
|
|||
return &ReplicationController{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a RC.
|
||||
func (*ReplicationController) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().Core().ReplicationControllers(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all RCs in a given namespace.
|
||||
func (*ReplicationController) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*ReplicationController) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a RC.
|
||||
func (*ReplicationController) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().Core().ReplicationControllers(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ func (r *Resource) Get(ns, n string) (interface{}, error) {
|
|||
return r.base().Namespace(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all Resources in a given namespace
|
||||
// List all Resources in a given namespace.
|
||||
func (r *Resource) List(ns string) (Collection, error) {
|
||||
obj, err := r.listAll(ns, r.name)
|
||||
if err != nil {
|
||||
|
|
@ -53,7 +53,7 @@ func (r *Resource) List(ns string) (Collection, error) {
|
|||
return Collection{obj.(*metav1beta1.Table)}, nil
|
||||
}
|
||||
|
||||
// Delete a Resource
|
||||
// Delete a Resource.
|
||||
func (r *Resource) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return r.base().Namespace(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Role represents a Kubernetes service
|
||||
// Role represents a Kubernetes Role.
|
||||
type Role struct{}
|
||||
|
||||
// NewRole returns a new Role.
|
||||
|
|
@ -13,13 +13,13 @@ func NewRole() Res {
|
|||
return &Role{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a Role.
|
||||
func (*Role) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().RbacV1().Roles(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all Roles in a given namespace.
|
||||
func (*Role) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ func (*Role) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a Role.
|
||||
func (*Role) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().RbacV1().Roles(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package k8s
|
|||
|
||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
// RoleBinding represents a Kubernetes service
|
||||
// RoleBinding represents a Kubernetes RoleBinding.
|
||||
type RoleBinding struct{}
|
||||
|
||||
// NewRoleBinding returns a new RoleBinding.
|
||||
|
|
@ -10,13 +10,13 @@ func NewRoleBinding() Res {
|
|||
return &RoleBinding{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a RoleBinding.
|
||||
func (*RoleBinding) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().RbacV1().RoleBindings(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all RoleBindings in a given namespace.
|
||||
func (*RoleBinding) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ func (*RoleBinding) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a RoleBinding.
|
||||
func (*RoleBinding) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().RbacV1().RoleBindings(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// ReplicaSet represents a Kubernetes service
|
||||
// ReplicaSet represents a Kubernetes ReplicaSet.
|
||||
type ReplicaSet struct{}
|
||||
|
||||
// NewReplicaSet returns a new ReplicaSet.
|
||||
|
|
@ -12,13 +12,13 @@ func NewReplicaSet() Res {
|
|||
return &ReplicaSet{}
|
||||
}
|
||||
|
||||
// Get a service.
|
||||
// Get a ReplicaSet.
|
||||
func (*ReplicaSet) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
return conn.dialOrDie().Apps().ReplicaSets(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all services in a given namespace
|
||||
// List all ReplicaSets in a given namespace.
|
||||
func (*ReplicaSet) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*ReplicaSet) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a service
|
||||
// Delete a ReplicaSet.
|
||||
func (*ReplicaSet) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().Apps().ReplicaSets(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ func NewServiceAccount() Res {
|
|||
return &ServiceAccount{}
|
||||
}
|
||||
|
||||
// Get a ServiceAccount
|
||||
// Get a ServiceAccount.
|
||||
func (*ServiceAccount) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
o, err := conn.dialOrDie().CoreV1().ServiceAccounts(ns).Get(n, opts)
|
||||
|
|
@ -22,7 +22,7 @@ func (*ServiceAccount) Get(ns, n string) (interface{}, error) {
|
|||
return o, nil
|
||||
}
|
||||
|
||||
// List all ServiceAccounts in a given namespace
|
||||
// List all ServiceAccounts in a given namespace.
|
||||
func (*ServiceAccount) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ func (*ServiceAccount) List(ns string) (Collection, error) {
|
|||
|
||||
}
|
||||
|
||||
// Delete a ServiceAccount
|
||||
// Delete a ServiceAccount.
|
||||
func (*ServiceAccount) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().ServiceAccounts(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Secret represents a Kubernetes Secret
|
||||
// Secret represents a Kubernetes Secret.
|
||||
type Secret struct{}
|
||||
|
||||
// NewSecret returns a new Secret.
|
||||
|
|
@ -18,7 +18,7 @@ func (c *Secret) Get(ns, n string) (interface{}, error) {
|
|||
return conn.dialOrDie().CoreV1().Secrets(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all Secrets in a given namespace
|
||||
// List all Secrets in a given namespace.
|
||||
func (c *Secret) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (c *Secret) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a Secret
|
||||
// Delete a Secret.
|
||||
func (c *Secret) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().Secrets(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ func NewStatefulSet() Res {
|
|||
return &StatefulSet{}
|
||||
}
|
||||
|
||||
// Get a StatefulSet
|
||||
// Get a StatefulSet.
|
||||
func (*StatefulSet) Get(ns, n string) (interface{}, error) {
|
||||
opts := metav1.GetOptions{}
|
||||
o, err := conn.dialOrDie().AppsV1().StatefulSets(ns).Get(n, opts)
|
||||
|
|
@ -22,7 +22,7 @@ func (*StatefulSet) Get(ns, n string) (interface{}, error) {
|
|||
return o, nil
|
||||
}
|
||||
|
||||
// List all StatefulSets in a given namespace
|
||||
// List all StatefulSets in a given namespace.
|
||||
func (*StatefulSet) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ func (*StatefulSet) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a StatefulSet
|
||||
// Delete a StatefulSet.
|
||||
func (*StatefulSet) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().AppsV1().StatefulSets(ns).Delete(n, &opts)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Service represents a Kubernetes Service
|
||||
// Service represents a Kubernetes Service.
|
||||
type Service struct{}
|
||||
|
||||
// NewService returns a new Service.
|
||||
|
|
@ -18,7 +18,7 @@ func (*Service) Get(ns, n string) (interface{}, error) {
|
|||
return conn.dialOrDie().CoreV1().Services(ns).Get(n, opts)
|
||||
}
|
||||
|
||||
// List all Services in a given namespace
|
||||
// List all Services in a given namespace.
|
||||
func (*Service) List(ns string) (Collection, error) {
|
||||
opts := metav1.ListOptions{}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ func (*Service) List(ns string) (Collection, error) {
|
|||
return cc, nil
|
||||
}
|
||||
|
||||
// Delete a Service
|
||||
// Delete a Service.
|
||||
func (*Service) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
return conn.dialOrDie().CoreV1().Services(ns).Delete(n, &opts)
|
||||
|
|
|
|||
Loading…
Reference in New Issue