utils

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package utils implements utility functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClusterOwner

func GetClusterOwner(client client.Client, ctx context.Context, obj metav1.ObjectMeta) *teranodev1alpha1.Cluster

func GetPrometheusLabels

func GetPrometheusLabels() map[string]string

GetPrometheusLabels returns a map of labels used for prometheus scraping

func GetScaleStatusFromDeployment added in v0.2.1

func GetScaleStatusFromDeployment(deployment *appsv1.Deployment) (replicas int32, selector string)

GetScaleStatusFromDeployment extracts replicas and selector from a deployment

func ReconcileBatch

func ReconcileBatch(l logr.Logger, reconcileFunctions ...ReconcileFunc) (bool, error)

ReconcileBatch will reconcile a batch of functions

func SetClusterOverrides

func SetClusterOverrides(client client.Client, dep *appsv1.Deployment, cr v1alpha1.TeranodeService)

func SetDeploymentOverrides

func SetDeploymentOverrides(client client.Client, dep *appsv1.Deployment, cr v1alpha1.TeranodeService)

func SetDeploymentOverridesWithContext added in v0.2.1

func SetDeploymentOverridesWithContext(ctx context.Context, log logr.Logger, client client.Client, dep *appsv1.Deployment, cr v1alpha1.TeranodeService, crKind string)

func UpdateScaleStatus added in v0.2.1

func UpdateScaleStatus(ctx context.Context, c client.Client, namespace, deploymentName string, status ScaleStatus) error

UpdateScaleStatus updates the scale-related status fields (replicas and selector) for a CR based on the actual deployment state. This is required for the /scale subresource to work properly.

Types

type ReconcileFunc

type ReconcileFunc func(logr.Logger) (bool, error)

ReconcileFunc is a reconcile function type

type ScaleStatus added in v0.2.1

type ScaleStatus interface {
	SetReplicas(replicas int32)
	SetSelector(selector string)
}

ScaleStatus defines the interface for CRs that support scale subresource

Jump to

Keyboard shortcuts

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