Documentation
¶
Index ¶
- Variables
- func ApplyClusterIDLabel(ep *prometheusoperatorv1.Endpoint, clusterID string)
- func ApplyClusterIDLabelToPodMonitor(ep *prometheusoperatorv1.PodMetricsEndpoint, clusterID string)
- func ApplyClusterIDLabelToRecordingRule(rule *prometheusoperatorv1.Rule, clusterID string)
- func ClampToInt32(v float64) int32
- func Compress(payload []byte) (*bytes.Buffer, error)
- func CompressAndEncode(payload []byte) (*bytes.Buffer, error)
- func ComputeHash(s string) string
- func CountAvailableNodes(ctx context.Context, client client.Client) (int32, error)
- func DecodeAndDecompress(payload []byte) (*bytes.Buffer, error)
- func DetermineHostedClusterPayloadArch(ctx context.Context, c client.Client, hc *hyperv1.HostedCluster, ...) (hyperv1.PayloadArchType, error)
- func EnableIfCustomKubeconfig(hcp *hyperv1.HostedControlPlane) bool
- func GetKubeClientSet() (kubeclient.Interface, error)
- func GetKubeClientSetWithKubeconfig(kubeconfigPath string) (kubeclient.Interface, error)
- func GetMgmtClusterCPUArch(kc kubeclient.Interface) (string, error)
- func GetPullSecretBytes(ctx context.Context, c client.Client, hc *hyperv1.HostedCluster) ([]byte, error)
- func HashBytes(data []byte) (string, error)
- func HashConfigMapData(data map[string]string) string
- func HashSimple(o interface{}) string
- func HashStruct(data interface{}) (string, error)
- func HashStructWithJSONMapper(data interface{}, mapper JSONMapper) (string, error)
- func InsecureHTTPClient() *http.Client
- func LogLevelToEtcdLevel(level hyperv1.LogLevel) string
- func LogLevelToKlogVerbosity(level hyperv1.LogLevel) int
- func MapsDiff(current, input map[string]string) (changed map[string]string, deleted map[string]string, different bool)
- func ParseNamespacedName(name string) types.NamespacedName
- func RemoveEmptyJSONField(stringData string, field string) string
- func SanitizeIgnitionPayload(payload []byte) error
- func StringListContains(list string, s string) bool
- type JSONMapper
Constants ¶
This section is empty.
Variables ¶
ErrPullSecretUnavailable indicates the pull secret is missing or malformed.
Functions ¶
func ApplyClusterIDLabel ¶
func ApplyClusterIDLabel(ep *prometheusoperatorv1.Endpoint, clusterID string)
func ApplyClusterIDLabelToPodMonitor ¶
func ApplyClusterIDLabelToPodMonitor(ep *prometheusoperatorv1.PodMetricsEndpoint, clusterID string)
func ApplyClusterIDLabelToRecordingRule ¶
func ApplyClusterIDLabelToRecordingRule(rule *prometheusoperatorv1.Rule, clusterID string)
func ClampToInt32 ¶ added in v0.1.83
ClampToInt32 clamps a float64 value into a valid non-negative int32 range. Negative values are clamped to 0 and values exceeding math.MaxInt32 are capped.
func CompressAndEncode ¶
CompressAndEncode compresses and base-64 encodes a given byte array. Ideal for loading an arbitrary byte array into a ConfigMap or Secret.
func ComputeHash ¶
func CountAvailableNodes ¶ added in v0.1.71
CountAvailableNodes counts the number of available nodes in the cluster. Available nodes are defined as Ready nodes that are not cordoned (Unschedulable).
func DecodeAndDecompress ¶
DecodeAndDecompress decompresses and base-64 decodes a given byte array. Ideal for consuming a gzipped / base64-encoded byte array from a ConfigMap or Secret.
func DetermineHostedClusterPayloadArch ¶ added in v0.1.48
func DetermineHostedClusterPayloadArch(ctx context.Context, c client.Client, hc *hyperv1.HostedCluster, imageMetadataProvider imageregistry.ImageMetadataProvider) (hyperv1.PayloadArchType, error)
DetermineHostedClusterPayloadArch returns the HostedCluster payload's CPU architecture type
func EnableIfCustomKubeconfig ¶ added in v0.1.58
func EnableIfCustomKubeconfig(hcp *hyperv1.HostedControlPlane) bool
EnableIfCustomKubeconfig returns true if the hosted control plane has a custom kubeconfig defined
func GetKubeClientSet ¶ added in v0.1.48
func GetKubeClientSet() (kubeclient.Interface, error)
func GetKubeClientSetWithKubeconfig ¶ added in v0.1.78
func GetKubeClientSetWithKubeconfig(kubeconfigPath string) (kubeclient.Interface, error)
GetKubeClientSetWithKubeconfig creates a Kubernetes clientset using the specified kubeconfig file path. If kubeconfigPath is empty, it falls back to the default kubeconfig resolution.
func GetMgmtClusterCPUArch ¶ added in v0.1.23
func GetMgmtClusterCPUArch(kc kubeclient.Interface) (string, error)
func GetPullSecretBytes ¶ added in v0.1.48
func HashBytes ¶ added in v0.1.55
HashBytes takes a byte array and returns a 32-bit FNV-1a hashed version of the byte array as a string
func HashConfigMapData ¶ added in v0.1.80
HashConfigMapData hashes the key-value pairs of a ConfigMap's Data field deterministically, using null-byte delimiters to prevent key/value collisions. Returns an empty string for nil or empty maps.
func HashSimple ¶ added in v0.1.23
func HashSimple(o interface{}) string
HashSimple takes a value, typically a string, and returns a 32-bit FNV-1a hashed version of the value as a string
func HashStruct ¶
HashStruct takes a struct and returns a 32-bit FNV-1a hashed version of the struct as a string The struct is first marshaled to JSON before hashing
func HashStructWithJSONMapper ¶ added in v0.1.55
func HashStructWithJSONMapper(data interface{}, mapper JSONMapper) (string, error)
HashStructWithJSONMapper takes a struct and returns a 32-bit FNV-1a hashed version of the struct as a string after The struct is first marshaled to JSON before hashing. You can provide a JSONMapper that transforms the marshaled JSON before computing the hash or nil if no transformation is needed.
func InsecureHTTPClient ¶ added in v0.1.10
InsecureHTTPClient return a http.Client which skips server certificate verification
func LogLevelToEtcdLevel ¶ added in v0.1.83
LogLevelToEtcdLevel maps a LogLevel enum to the ETCD_LOG_LEVEL environment variable. etcd only supports "info" and "debug"; Trace and TraceAll are not valid for etcd and are rejected at the API level (CEL), so they are treated as unhandled here and panic. An unhandled value panics so that expanding the enum without updating this switch is caught loudly rather than silently mishandled.
func LogLevelToKlogVerbosity ¶ added in v0.1.83
LogLevelToKlogVerbosity maps a LogLevel enum value to a klog verbosity integer. The LogLevel enum is the source of truth; every value must be handled here. An unhandled value panics so that expanding the enum without updating this switch is caught loudly rather than silently mishandled.
func MapsDiff ¶ added in v0.1.64
func MapsDiff(current, input map[string]string) (changed map[string]string, deleted map[string]string, different bool)
MapsDiff compares two maps and returns a map of changed/created keys with their new values, a map of deleted keys, and a boolean indicating if there are any differences.
func ParseNamespacedName ¶
func ParseNamespacedName(name string) types.NamespacedName
ParseNamespacedName expects a string with the format "namespace/name" and returns the proper types.NamespacedName. This is useful when watching a CR annotated with the format above to requeue the CR described in the annotation.
func RemoveEmptyJSONField ¶ added in v0.1.55
RemoveEmptyJSONField removes a field from a given JSON if it's empty regardless of its position
func SanitizeIgnitionPayload ¶ added in v0.1.48
SanitizeIgnitionPayload make sure the IgnitionPayload is valid and does not contain inconsistencies.
func StringListContains ¶
Contains checks if a comma-delimited string contains a specific string.
Types ¶
type JSONMapper ¶ added in v0.1.55
func NewOmitFieldIfEmptyJSONMapper ¶ added in v0.1.55
func NewOmitFieldIfEmptyJSONMapper(field string) JSONMapper
NewOmitFieldIfEmptyJSONMapper is a JSONMapper that omits the given field in case it was empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package registryoverride applies registry-prefix overrides to image references with strict, deterministic matching semantics.
|
Package registryoverride applies registry-prefix overrides to image references with strict, deterministic matching semantics. |