Documentation
¶
Overview ¶
Package deployment manages Kubernetes Deployments and Services for CobaltCore operators. It provides functions for creating and updating Deployments, ensuring Services exist, and checking Deployment readiness.
Feature: CC-0005
Index ¶
- func DeleteHPA(ctx context.Context, c client.Client, namespace, name string) error
- func EnsureDeployment(ctx context.Context, c client.Client, scheme *runtime.Scheme, ...) (bool, error)
- func EnsureHPA(ctx context.Context, c client.Client, scheme *runtime.Scheme, ...) error
- func EnsurePDB(ctx context.Context, c client.Client, scheme *runtime.Scheme, ...) error
- func EnsureService(ctx context.Context, c client.Client, scheme *runtime.Scheme, ...) error
- func IsDeploymentReady(deploy *appsv1.Deployment) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteHPA ¶
DeleteHPA deletes the HorizontalPodAutoscaler identified by namespace and name. It is a no-op if the HPA does not exist (CC-0038).
func EnsureDeployment ¶
func EnsureDeployment(ctx context.Context, c client.Client, scheme *runtime.Scheme, owner client.Object, deploy *appsv1.Deployment) (bool, error)
EnsureDeployment creates a Deployment if it does not exist or updates its spec if it already exists. It returns (true, nil) when all replicas are available, (false, nil) when the Deployment exists but is not yet ready, and (false, error) on unexpected failures (CC-0005).
func EnsureHPA ¶
func EnsureHPA(ctx context.Context, c client.Client, scheme *runtime.Scheme, owner client.Object, hpa *autoscalingv2.HorizontalPodAutoscaler) error
EnsureHPA creates a HorizontalPodAutoscaler if it does not exist or updates its spec and metadata if it already exists. An owner reference is set on the HPA so that it is garbage-collected when the owning resource is deleted. On the update path, owner references, labels, and annotations are reconciled to correct any out-of-band drift (CC-0038).
func EnsurePDB ¶
func EnsurePDB(ctx context.Context, c client.Client, scheme *runtime.Scheme, owner client.Object, pdb *policyv1.PodDisruptionBudget) error
EnsurePDB creates a PodDisruptionBudget if it does not exist or updates its spec and metadata if it already exists. An owner reference is set on the PDB so that it is garbage-collected when the owning resource is deleted. On the update path, owner references, labels, and annotations are reconciled to correct any out-of-band drift (CC-0037).
func EnsureService ¶
func EnsureService(ctx context.Context, c client.Client, scheme *runtime.Scheme, owner client.Object, svc *corev1.Service) error
EnsureService creates a Service if it does not exist or updates its spec if it already exists. Server-assigned fields (ClusterIP, ClusterIPs, IPFamilies) are preserved on updates. If the desired spec explicitly sets any of these fields to a value that differs from the existing service, an error is returned to signal an API usage problem (CC-0005).
func IsDeploymentReady ¶
func IsDeploymentReady(deploy *appsv1.Deployment) bool
IsDeploymentReady returns true if the Deployment has an Available condition set to True and its ready replicas meet the desired replica count (CC-0005).
Types ¶
This section is empty.