Documentation ¶
Index ¶
- Variables
- func DecodeResource(b []byte) (k8stypes.Resource, error)
- func EncodeResource(resource k8stypes.Resource) ([]byte, error)
- func GetAllResources(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetAnnotations(resource k8stypes.Resource) map[string]string
- func GetContainers(resource k8stypes.Resource) []*k8stypes.ContainerV1
- func GetCronJobs(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetDaemonSets(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetDeployments(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetKubernetesVersion(clientset kubernetes.Interface) (*version.Info, error)
- func GetLabels(resource k8stypes.Resource) map[string]string
- func GetNamespaces(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetNetworkPolicies(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetObjectMeta(resource k8stypes.Resource) *metav1.ObjectMeta
- func GetPodObjectMeta(resource k8stypes.Resource) *metav1.ObjectMeta
- func GetPodSpec(resource k8stypes.Resource) *k8stypes.PodSpecV1
- func GetPodTemplateSpec(resource k8stypes.Resource) *v1.PodTemplateSpec
- func GetPodTemplates(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetPods(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetReplicationControllers(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetServiceAccounts(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func GetStatefulSets(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
- func IsRunningInCluster(client Client) bool
- func NewFalse() *bool
- func NewKubeClientCluster(client Client) (*kubernetes.Clientset, error)
- func NewKubeClientLocal(configPath string) (*kubernetes.Clientset, error)
- func NewTrue() *bool
- type Client
- type ClientOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = k8sClient{}
var ErrNoReadableKubeConfig = errors.New("unable to open kubeconfig file")
ErrNoReadableKubeConfig represents any error that prevents the client from opening a kubeconfig file.
Functions ¶
func GetAllResources ¶
func GetAllResources(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetAllResources gets all supported resources from the cluster
func GetAnnotations ¶
GetAnnotations returns the annotations at the pod level. If the resource does not have pods, then it returns the least-nested annotations
func GetContainers ¶
func GetContainers(resource k8stypes.Resource) []*k8stypes.ContainerV1
func GetCronJobs ¶
func GetCronJobs(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetCronJobs gets all CronJob resources from the cluster
func GetDaemonSets ¶
func GetDaemonSets(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetDaemonSets gets all DaemonSet resources from the cluster
func GetDeployments ¶
func GetDeployments(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetDeployments gets all Deployment resources from the cluster
func GetKubernetesVersion ¶
func GetKubernetesVersion(clientset kubernetes.Interface) (*version.Info, error)
GetKubernetesVersion returns the kubernetes client version
func GetLabels ¶
GetLabels returns the labels at the pod level. If the resource does not have pods, then it returns the least-nested labels
func GetNamespaces ¶
func GetNamespaces(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetNamespaces gets all Namespace resources from the cluster
func GetNetworkPolicies ¶
func GetNetworkPolicies(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetNetworkPolicies gets all NetworkPolicy resources from the cluster
func GetObjectMeta ¶
func GetObjectMeta(resource k8stypes.Resource) *metav1.ObjectMeta
GetObjectMeta returns the highest-level ObjectMeta
func GetPodObjectMeta ¶
func GetPodObjectMeta(resource k8stypes.Resource) *metav1.ObjectMeta
GetPodObjectMeta returns the ObjectMeta at the pod level. If the resource does not have pods, then it returns the highest-level ObjectMeta
func GetPodSpec ¶
GetPodSpec gets the PodSpec for a resource. Avoid using this function if you need support for Namespace or ServiceAccount resources, and write a helper functions in this package instead
func GetPodTemplateSpec ¶
func GetPodTemplateSpec(resource k8stypes.Resource) *v1.PodTemplateSpec
GetPodTemplateSpec gets the PodTemplateSpec for a resource. Avoid using this function if you need support for Pod, Namespace, or ServiceAccount resources, and write a helper functions in this package instead
func GetPodTemplates ¶
func GetPodTemplates(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetPodTemplates gets all PodTemplate resources from the cluster
func GetPods ¶
func GetPods(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetPods gets all Pod resources from the cluster
func GetReplicationControllers ¶
func GetReplicationControllers(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetReplicationControllers gets all ReplicationController resources from the cluster
func GetServiceAccounts ¶ added in v0.11.2
func GetServiceAccounts(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetServiceAccounts gets all ServiceAccount resources from the cluster
func GetStatefulSets ¶
func GetStatefulSets(clientset kubernetes.Interface, options ClientOptions) []k8stypes.Resource
GetStatefulSets gets all StatefulSet resources from the cluster
func IsRunningInCluster ¶
IsRunningInCluster returns true if kubeaudit is running inside a cluster
func NewKubeClientCluster ¶
func NewKubeClientCluster(client Client) (*kubernetes.Clientset, error)
NewKubeClientCluster creates a new kube client for cluster mode
func NewKubeClientLocal ¶
func NewKubeClientLocal(configPath string) (*kubernetes.Clientset, error)
NewKubeClientLocal creates a new kube client for local mode
Types ¶
type ClientOptions ¶
type ClientOptions struct { // Namespace filters resources by namespace. Defaults to all namespaces. Namespace string }