Documentation
¶
Overview ¶
pkg/utils/gvk.go
pkg/utils/loadfile.go
pkg/utils/rawmap.go
Index ¶
- Constants
- Variables
- func BoolPtr(b bool) *bool
- func BuildAnnotationPatch(key, value string) map[string]interface{}
- func Center(text string) string
- func Exit(err error)
- func FormatYAMLError(err error, data []byte) string
- func GVKFor(obj runtime.Object, scheme *runtime.Scheme) (schema.GroupVersionKind, error)
- func IsRunningInCluster() bool
- func Jitter(d time.Duration) time.Duration
- func LoadFile(path string) ([]byte, error)
- func LoadFileWithAuth(path string, auth *FileAuth) ([]byte, error)
- func Merge(target *string, incoming, sep string)
- func MetaField(objMap map[string]interface{}, field string) string
- func RawToMap(raw interface{}) (map[string]interface{}, error)
- func RequireStrParams(required map[string]string) error
- func Retry(fn func() error, opts RetryOptions) error
- func RetryBackoff(fn func() error, opts RetryOptions) error
- func Reversed[T any](s []T) []T
- func SetGroupVersionKindObj(gvk schema.GroupVersionKind) string
- func Sleep(n int)
- func StrictUnmarshal(data []byte, out any) error
- func WaitForCRD(cfg *rest.Config, group, kind, version string) error
- func WriteJSON(w http.ResponseWriter, status int, data interface{})
- func WriteJSONPruned(w http.ResponseWriter, status int, v interface{})
- type FileAuth
- type GroupVersionKind
- type H
- type RetryOptions
- type Status
Constants ¶
const ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorMagenta = "\033[35m" ColorCyan = "\033[36m" ColorBold = "\033[1m" ColorDim = "\033[2m" ColorItalic = "\033[3m" ColorUnderline = "\033[4m" ColorBlink = "\033[5m" ColorReverse = "\033[7m" ColorHidden = "\033[8m" )
Variables ¶
var OrkestraLogo = `` /* 267-byte string literal not displayed */
var OrkestraLogoCLI = `` /* 174-byte string literal not displayed */
Functions ¶
func BuildAnnotationPatch ¶
BuildAnnotationPatch constructs a JSON merge patch that sets one annotation.
func FormatYAMLError ¶
func IsRunningInCluster ¶ added in v0.1.9
func IsRunningInCluster() bool
IsRunningInCluster returns true when running inside a Kubernetes pod. The service account token is always present inside a pod.
func LoadFile ¶
LoadFile loads a file from local disk or HTTP(S).
For remote files, auth is optional. When nil, an unauthenticated GET is performed. When set, the appropriate Authorization header is added based on auth.Type.
For local files, auth is ignored.
func LoadFileWithAuth ¶
LoadFileWithAuth loads a file with optional authentication. Called by the merger when a source declares an auth block.
func MetaField ¶ added in v0.1.9
MetaField extracts a string field from objMap["metadata"]. Returns "" when the field is absent or not a string.
func RawToMap ¶ added in v0.1.9
RawToMap converts a raw informer cache object to map[string]interface{}. Works for *unstructured.Unstructured, any typed runtime.Object, and any JSON-serializable value. No type assertion required.
Fast path: *unstructured.Unstructured already has the map — returned directly with zero allocation. General path: JSON round-trip.
func RequireStrParams ¶
func Retry ¶
func Retry(fn func() error, opts RetryOptions) error
func RetryBackoff ¶
func RetryBackoff(fn func() error, opts RetryOptions) error
func SetGroupVersionKindObj ¶
func SetGroupVersionKindObj(gvk schema.GroupVersionKind) string
func StrictUnmarshal ¶
func WaitForCRD ¶
Wait for CRD creation
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, status int, data interface{})
func WriteJSONPruned ¶
func WriteJSONPruned(w http.ResponseWriter, status int, v interface{})
WriteJSONPruned writes a JSON response with null/empty values removed
Types ¶
type FileAuth ¶
type FileAuth struct {
// Type — authentication scheme.
// Supported: "bearer", "github", "basic"
Type string
// BearerToken — used when Type is "bearer" or "github".
// Resolved from the environment variable named in the source declaration.
BearerToken string
// Username and Password — used when Type is "basic".
// Each resolved from its own environment variable.
Username string
Password string
}
FileAuth holds optional authentication for a remote file source. Constructed from the Katalog source declaration and resolved from environment variables at load time — credentials never appear in YAML.
type GroupVersionKind ¶
type GroupVersionKind string
Consistent Keys
func SetGroupVersionKind ¶
func SetGroupVersionKind(group, version, kind string) GroupVersionKind
Mimicks runtime.Object.GetObjectKind().GroupVersionKind() https://pkg.go.dev/k8s.io/apimachinery@v0.35.2/pkg/runtime/schema#ObjectKind.GroupVersionKind
func (GroupVersionKind) String ¶
func (g GroupVersionKind) String() string
type RetryOptions ¶
type Status ¶
type Status string
const ( // Status StatusReady Status = "ready" StatusRunning Status = "running" StatusHealthy Status = "healthy" StatusOnline Status = "online" StatusNotReady Status = "not ready" StatusNotRunning Status = "not running" StatusNotHealthy Status = "not healthy" StatusOffline Status = "offline" // HTTP ContentType = "Content-Type" JSONContentType = "application/json" )