k8sinternal

package
v0.14.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = k8sClient{}
View Source
var ErrNoReadableKubeConfig = errors.New("unable to open kubeconfig file")

ErrNoReadableKubeConfig represents any error that prevents the client from opening a kubeconfig file.

Functions

func DecodeResource

func DecodeResource(b []byte) (k8s.Resource, error)

func EncodeResource

func EncodeResource(resource k8s.Resource) ([]byte, error)

func GetAllResources

func GetAllResources(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetAllResources gets all supported resources from the cluster

func GetCronJobs

func GetCronJobs(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetCronJobs gets all CronJob resources from the cluster

func GetDaemonSets

func GetDaemonSets(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetDaemonSets gets all DaemonSet resources from the cluster

func GetDeployments

func GetDeployments(clientset kubernetes.Interface, options ClientOptions) []k8s.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 GetNamespaces

func GetNamespaces(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetNamespaces gets all Namespace resources from the cluster

func GetNetworkPolicies

func GetNetworkPolicies(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetNetworkPolicies gets all NetworkPolicy resources from the cluster

func GetPodTemplates

func GetPodTemplates(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetPodTemplates gets all PodTemplate resources from the cluster

func GetPods

func GetPods(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetPods gets all Pod resources from the cluster

func GetReplicationControllers

func GetReplicationControllers(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetReplicationControllers gets all ReplicationController resources from the cluster

func GetServiceAccounts

func GetServiceAccounts(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetServiceAccounts gets all ServiceAccount resources from the cluster

func GetServices

func GetServices(clientset kubernetes.Interface, option ClientOptions) []k8s.Resource

GetServices gets all Service resources from a namespace in a cluster

func GetStatefulSets

func GetStatefulSets(clientset kubernetes.Interface, options ClientOptions) []k8s.Resource

GetStatefulSets gets all StatefulSet resources from the cluster

func IsRunningInCluster

func IsRunningInCluster(client Client) bool

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 Client

type Client interface {
	InClusterConfig() (*rest.Config, error)
}

Client abstracts the API to allow testing.

type ClientOptions

type ClientOptions struct {
	// Namespace filters resources by namespace. Defaults to all namespaces.
	Namespace string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL