Documentation
¶
Overview ¶
package kubernetes is a colletion of funtions for interactng with a live kubernetes cluster
Index ¶
- Constants
- func FileExists(filename string) bool
- func FindKubeConfigPath(path ...string) (string, error)
- func GetClusterRoleBindingSpec(cs kubernetes.Clientset) (clusterRoleBinding []string, err error)
- func GetDeploymentSpec(cs kubernetes.Clientset, namespace string) (deploy []string, err error)
- func GetFormattedJSON(source string) (result string)
- func GetIngressSpec(cs kubernetes.Clientset, namespace string) (ingress []string, err error)
- func GetKubernetesClientSet(kubeconfigPath, context string) (*kubernetes.Clientset, error)
- func GetNodeSpec(cs kubernetes.Clientset) (nodes []string, err error)
- func GetPodSecurityPolicySpec(cs kubernetes.Clientset) (podSecPol []string, err error)
- func GetPodSpec(cs kubernetes.Clientset, namespace string) (po []string, err error)
- func GetResourceList(cs kubernetes.Clientset, namespace string) []string
- type KubernetesAPI
Constants ¶
const Platform = "kubernetes"
Platform - kubernetes
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶
FileExists checks if a file exists and is not a directory before we try using it to prevent further errors.
func FindKubeConfigPath ¶
FindKubeConfigPath checks will return a path for the kubernetes config file
func GetClusterRoleBindingSpec ¶
func GetClusterRoleBindingSpec(cs kubernetes.Clientset) (clusterRoleBinding []string, err error)
GetClusterRoleBindingSpec provide a list an of JSON Cluster Role Binding specs from the clientset
func GetDeploymentSpec ¶
func GetDeploymentSpec(cs kubernetes.Clientset, namespace string) (deploy []string, err error)
GetDeploymentSpec provide a list an of JSON Deployment specs from the clientset
func GetFormattedJSON ¶
GetFormattedJSON takes a source string and outputs a formatted JSON string using 2 space characters as the indent
func GetIngressSpec ¶
func GetIngressSpec(cs kubernetes.Clientset, namespace string) (ingress []string, err error)
GetIngressSpec provide a list an of JSON Ingress specs from the clientset /!\ The only rule we currently have doesn't seem to be triggerable /!\ K8S-IN-0001: https://github.com/reliablyhq/opa-policies/blob/main/kubernetes/ingress.rego /!\ It looks for indentical Ingress hosts in different namespaces, and we are currently working /!\ in only one namespace, passed as a parameter. /!\ Probably a TODO here.
func GetKubernetesClientSet ¶
func GetKubernetesClientSet(kubeconfigPath, context string) (*kubernetes.Clientset, error)
GetKubernetesClientSet uses the default kubectl config file to create a Clientset for the default config
func GetNodeSpec ¶ added in v0.6.0
func GetNodeSpec(cs kubernetes.Clientset) (nodes []string, err error)
GetNodeSpec returns the list of JSON Nodes specs from the clientset
func GetPodSecurityPolicySpec ¶
func GetPodSecurityPolicySpec(cs kubernetes.Clientset) (podSecPol []string, err error)
GetPodSecurityPolicySpec provide a list an of JSON Pod Security Policy specs from the clientset
func GetPodSpec ¶
func GetPodSpec(cs kubernetes.Clientset, namespace string) (po []string, err error)
GetPodSpec provide a list an of JSON Pod specs from the clientset
func GetResourceList ¶
func GetResourceList(cs kubernetes.Clientset, namespace string) []string
Types ¶
type KubernetesAPI ¶
type KubernetesAPI struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Metadata struct {
Annotations struct {
} `json:"annotations"`
Labels struct {
App string `json:"app"`
} `json:"labels"`
Name string `json:"name"`
Namespace string `json:"namespace"`
} `json:"metadata"`
Spec struct {
Containers []struct {
Image string `json:"image"`
Name string `json:"name"`
} `json:"containers"`
RestartPolicy string `json:"restartPolicy"`
} `json:"spec"`
}
func GetHeaderInfo ¶
func GetHeaderInfo(content string) (*KubernetesAPI, error)
func (KubernetesAPI) URI ¶
func (m KubernetesAPI) URI() string