Documentation ¶
Overview ¶
Package utils contains utilities to manage the external network.
Index ¶
- func DeleteClusterRoleBinding(ctx context.Context, cl client.Client, obj client.Object) error
- func EnsureMetrics(ctx context.Context, cl client.Client, s *runtime.Scheme, ...) error
- func EnsureServiceAccountAndClusterRoleBinding(ctx context.Context, cl client.Client, s *runtime.Scheme, ...) error
- func GetIfExists[T any](m map[string]interface{}, key string) (*T, bool)
- func GetValueOrDefault(m map[string]interface{}, key, defaultValue string) string
- func IgnoreAPINotFoundError(err error) error
- func KindToResource(kind string) string
- func NewOwnerEnqueuer(ownerKind string) handler.EventHandler
- func ParseEndpoint(endpoint map[string]interface{}) *networkingv1beta1.EndpointStatus
- func ParseGroupVersionResource(gvr string) (schema.GroupVersionResource, error)
- func ParseInternalEndpoint(internalEndpoint map[string]interface{}) *networkingv1beta1.InternalGatewayEndpoint
- func ParseRef(ref map[string]interface{}) *corev1.ObjectReference
- func RenderTemplate(obj, data interface{}, forceString bool) (interface{}, error)
- func ResourceToKind(gvr schema.GroupVersionResource, kubeClient kubernetes.Interface) (string, error)
- func TranslateMap(obj interface{}) map[string]string
- type OwnerEnqueuer
- func (h *OwnerEnqueuer) Create(_ context.Context, _ event.CreateEvent, ...)
- func (h *OwnerEnqueuer) Delete(_ context.Context, _ event.DeleteEvent, ...)
- func (h *OwnerEnqueuer) Generic(_ context.Context, evt event.GenericEvent, ...)
- func (h *OwnerEnqueuer) Update(_ context.Context, _ event.UpdateEvent, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteClusterRoleBinding ¶
DeleteClusterRoleBinding deletes the cluster role bindings owned by the given object.
func EnsureMetrics ¶
func EnsureMetrics(ctx context.Context, cl client.Client, s *runtime.Scheme, metrics *networkingv1beta1.Metrics, owner metav1.Object) error
EnsureMetrics ensures that the metrics service and service monitor are created or deleted.
func EnsureServiceAccountAndClusterRoleBinding ¶
func EnsureServiceAccountAndClusterRoleBinding(ctx context.Context, cl client.Client, s *runtime.Scheme, deploy *networkingv1beta1.DeploymentTemplate, owner client.Object, clusterRoleName string) error
EnsureServiceAccountAndClusterRoleBinding ensures that the service account and the cluster role binding are created or deleted.
func GetIfExists ¶
GetIfExists returns the value of a key in a map casting its type, or nil if the key is not present or the type is wrong.
func GetValueOrDefault ¶
GetValueOrDefault returns the value of a key in a map, or a default value if the key is not present.
func IgnoreAPINotFoundError ¶
IgnoreAPINotFoundError ignores the error if it is an API not found error (the CRD is not installed).
func KindToResource ¶
KindToResource returns the resource name for a given kind.
func NewOwnerEnqueuer ¶
func NewOwnerEnqueuer(ownerKind string) handler.EventHandler
NewOwnerEnqueuer returns a new OwnerEnqueuer.
func ParseEndpoint ¶
func ParseEndpoint(endpoint map[string]interface{}) *networkingv1beta1.EndpointStatus
ParseEndpoint parses an endpoint from a map.
func ParseGroupVersionResource ¶
func ParseGroupVersionResource(gvr string) (schema.GroupVersionResource, error)
ParseGroupVersionResource parses a GroupVersionResource from a string in the form group/version/resource.
func ParseInternalEndpoint ¶
func ParseInternalEndpoint(internalEndpoint map[string]interface{}) *networkingv1beta1.InternalGatewayEndpoint
ParseInternalEndpoint parses an internal endpoint from a map.
func ParseRef ¶
func ParseRef(ref map[string]interface{}) *corev1.ObjectReference
ParseRef parses an ObjectReference from a map.
func RenderTemplate ¶
RenderTemplate renders a template.
func ResourceToKind ¶
func ResourceToKind(gvr schema.GroupVersionResource, kubeClient kubernetes.Interface) (string, error)
ResourceToKind returns the kind name for a given resource.
func TranslateMap ¶
TranslateMap translates a map[string]interface{} to a map[string]string.
Types ¶
type OwnerEnqueuer ¶
type OwnerEnqueuer struct {
// contains filtered or unexported fields
}
OwnerEnqueuer is an event handler that enqueues the owner of the object for a given kind.
func (*OwnerEnqueuer) Create ¶
func (h *OwnerEnqueuer) Create(_ context.Context, _ event.CreateEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request])
Create enqueues the owner of the object for a given kind.
func (*OwnerEnqueuer) Delete ¶
func (h *OwnerEnqueuer) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request])
Delete enqueues the owner of the object for a given kind.
func (*OwnerEnqueuer) Generic ¶
func (h *OwnerEnqueuer) Generic(_ context.Context, evt event.GenericEvent, q workqueue.TypedRateLimitingInterface[reconcile.Request])
Generic enqueues the owner of the object for a given kind.
func (*OwnerEnqueuer) Update ¶
func (h *OwnerEnqueuer) Update(_ context.Context, _ event.UpdateEvent, _ workqueue.TypedRateLimitingInterface[reconcile.Request])
Update enqueues the owner of the object for a given kind.