Documentation
¶
Index ¶
- Constants
- func AnnotationsMergePatch(annotations map[string]any) ([]byte, error)
- func DecodeUnstructured[T any](u *unstructured.Unstructured) (*T, error)
- func DetectNodeIP() string
- func EnvBool(key string, fallback bool) bool
- func EnvDuration(key string, fallback time.Duration) time.Duration
- func EnvOrDefault(key, fallback string) string
- func GenerateSelfSignedCert(hostname, ip string) (tls.Certificate, error)
- func LoadConfig() (*rest.Config, error)
- func LoadOrGenerateCert(certPath, keyPath, hostname, ip string) (tls.Certificate, string, error)
- func NewReadyCondition(generation int64, status metav1.ConditionStatus, reason, message string) metav1.Condition
- func PatchHibernateState(ctx context.Context, cli client.Client, pod *corev1.Pod, state bool) error
- func PatchStatus[T DeepCopyObject[T]](ctx context.Context, cli client.Client, obj T, mutate func(T)) error
- func SleepCtx(ctx context.Context, d time.Duration) bool
- func StatusMergePatch(status any) ([]byte, error)
- type DeepCopyObject
Constants ¶
const ConditionTypeReady = "Ready"
ConditionTypeReady is the condition type for overall readiness.
Variables ¶
This section is empty.
Functions ¶
func AnnotationsMergePatch ¶ added in v0.1.2
AnnotationsMergePatch builds a merge patch for annotation updates.
func DecodeUnstructured ¶ added in v0.1.1
func DecodeUnstructured[T any](u *unstructured.Unstructured) (*T, error)
DecodeUnstructured converts an Unstructured object into a typed struct.
func DetectNodeIP ¶ added in v0.1.4
func DetectNodeIP() string
DetectNodeIP returns the first non-loopback IPv4 address, or "127.0.0.1" if none found.
func EnvBool ¶ added in v0.1.4
EnvBool parses a boolean env var, falling back to fallback when unset or invalid.
func EnvDuration ¶ added in v0.1.4
EnvDuration parses a duration env var, falling back to fallback when unset or invalid.
func EnvOrDefault ¶ added in v0.1.4
EnvOrDefault returns os.Getenv(key), falling back to fallback when unset or empty.
func GenerateSelfSignedCert ¶ added in v0.1.4
func GenerateSelfSignedCert(hostname, ip string) (tls.Certificate, error)
GenerateSelfSignedCert creates an in-memory ECDSA P-256 self-signed cert for hostname and ip.
func LoadConfig ¶
LoadConfig returns a client config from $KUBECONFIG, ~/.kube/config, or in-cluster (first match wins).
func LoadOrGenerateCert ¶ added in v0.1.4
func LoadOrGenerateCert(certPath, keyPath, hostname, ip string) (tls.Certificate, string, error)
LoadOrGenerateCert loads a TLS keypair from disk, falling back to a self-signed cert. Returns a source label for logging ("disk <path>" or "self-signed").
func NewReadyCondition ¶ added in v0.1.4
func NewReadyCondition(generation int64, status metav1.ConditionStatus, reason, message string) metav1.Condition
NewReadyCondition builds a Ready condition. LastTransitionTime is left zero so apimeta.SetStatusCondition preserves the existing timestamp on no-op updates.
func PatchHibernateState ¶ added in v0.1.4
PatchHibernateState patches the hibernate annotation, short-circuiting if already at the desired state.
func PatchStatus ¶ added in v0.1.4
func PatchStatus[T DeepCopyObject[T]](ctx context.Context, cli client.Client, obj T, mutate func(T)) error
PatchStatus applies mutate under a MergeFrom patch on the /status subresource.
func SleepCtx ¶ added in v0.1.4
SleepCtx blocks for d or until ctx is canceled. Returns false if ctx fired first.
func StatusMergePatch ¶ added in v0.1.1
StatusMergePatch builds a merge patch for a status subresource update.
Types ¶
type DeepCopyObject ¶ added in v0.1.4
DeepCopyObject is client.Object with a typed DeepCopy() method.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package admission provides shared admission-webhook helpers: decode/dispatch/encode, allow/deny builders, and JSON patch utilities.
|
Package admission provides shared admission-webhook helpers: decode/dispatch/encode, allow/deny builders, and JSON patch utilities. |