package
0.0.0-20240829215211-b018aa001c28
Repository: https://github.com/diranged/oz.git
Documentation: pkg.go.dev
# Functions
CreateAccessCommand templates an access command string, evaluates data from a pod.ObjectMeta.
CreatePod creates a new Pod based on the supplied PodTemplateSpec, ensuring that the OwnerReference is set appropriately before the creation to guarantee proper cleanup.
CreateRole will create a Kubernetes Role for a specific Access Request with the supplied permissions.
CreateRoleBinding will create a RoleBinding to a Role for a set of Groups defined in an Access Template.
GenerateResourceName takes in an API.IRequestResource conforming object and returns a unique resource name string that can be used to safely create other resources (roles, bindings, etc).
GetAccessDuration is a generic function for getting the proper Access Duration for a particular Access Request.
GetPodTemplateFromController will return a PodTemplate resource from an understood controller type (Deployment, DaemonSet, Rollout, or StatefulSet).
GetSelectorLabels understands how to return a labels.Selector struct from a supplied controller object - as long as it is one of the following:
- Deployment - DaemonSet - StatefulSet - Rollout
https://medium.com/coding-kubernetes/using-k8s-label-selectors-in-go-the-right-way-733cde7e8630
Returns:
- labels.Selector: A populated labels.Selector which can be used when searching for Pods - error
revive:disable:cyclomatic.
GetTargetRefResource returns a generic client.Object resource from the Kubernetes API that points to the Access Template Spec.targetRef configured resource.
ObjectToJSON is a quick helper function for pretty-printing an entire K8S object in JSON form.
SetOwnerReference provides a generic wrapper for setting the OwnerReference on a resource and updating the pointer to that resource.