Documentation ¶
Overview ¶
This package provides primitives for working with Kubernetes objects. TODO We should merge this package with the kube package.
Index ¶
- func ComputeHash(obj interface{}) string
- func DeepHashObject(hasher hash.Hash, objectToWrite interface{})
- func GetContainerImagesFromJob(job *batchv1.Job) (kube.ContainerImages, error)
- func GetContainerImagesFromPodSpec(spec corev1.PodSpec) kube.ContainerImages
- func GetImmediateOwnerReference(pod *corev1.Pod) kube.Object
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeHash ¶
func ComputeHash(obj interface{}) string
ComputeHash returns a hash value calculated from pod spec. The hash will be safe encoded to avoid bad words.
func DeepHashObject ¶
DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.
func GetContainerImagesFromJob ¶
func GetContainerImagesFromJob(job *batchv1.Job) (kube.ContainerImages, error)
func GetContainerImagesFromPodSpec ¶
func GetContainerImagesFromPodSpec(spec corev1.PodSpec) kube.ContainerImages
func GetImmediateOwnerReference ¶
GetImmediateOwnerReference returns the immediate owner of the specified pod. For example, for a pod controlled by a Deployment it will return the active ReplicaSet, whereas for an unmanaged pod the immediate owner is the pod itself.
Note that kubelet can manage pods independently by reading pod definition files from a configured host directory (typically /etc/kubernetes/manifests). Such pods are called *static pods* and are owned by a cluster Node. In this case we treat them as unmanaged pods. (Otherwise we'd require cluster-scoped permissions to get Nodes in order to set the owner reference when we create an instance of custom security report.)
Pods created and controlled by third party frameworks, such as Argo workflow engine, are considered as unmanaged. Otherwise we'd need to maintain and extend the list of RBAC permissions over time. TODO Merge this method with OwnerResolver, which accepts kube.Object and resolves client.Object.
Types ¶
This section is empty.