Documentation
¶
Overview ¶
pkg/utils/gvk.go
pkg/utils/loadfile.go
pkg/utils/printer.go
pkg/utils/rawmap.go
Index ¶
- Constants
- Variables
- func Blue(text string) string
- func Bold(text string) string
- func BoolPtr(b bool) *bool
- func BuildAnnotationPatch(key, value string) map[string]interface{}
- func Center(text string) string
- func Colorize(color, text string) string
- func Cyan(text string) string
- func Dim(text string) string
- func Exit(err error)
- func ExtractStatus(obj *unstructured.Unstructured) string
- func FailureMark() string
- func FailureMarkPlain() string
- func FormatDuration(d time.Duration) string
- func FormatYAMLError(err error, data []byte) string
- func FormatYAMLFile(path string) error
- func Gray(text string) string
- func Green(text string) string
- func HealthIcon(status string) string
- func HumanAge(t metav1.Time) string
- func InfoMark() string
- func InfoMarkPlain() string
- 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 Magenta(text string) string
- func Merge(target *string, incoming, sep string)
- func MetaField(objMap map[string]interface{}, field string) string
- func PrintError(msg string)
- func PrintField(label, value string)
- func PrintInfo(msg string)
- func PrintNestedMap(m map[string]interface{}, indent int)
- func PrintSection(title string)
- func PrintSuccess(msg string)
- func PrintTable(w io.Writer, header []string, rows [][]string)
- func PrintWarning(msg string)
- func RawToMap(raw interface{}) (map[string]interface{}, error)
- func Red(text string) string
- func RequireStrParams(required map[string]string) error
- func Reset(text string) string
- 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 SuccessMark() string
- func SuccessMarkPlain() string
- func Underline(text string) string
- func WaitForCRD(cfg *rest.Config, group, kind, version string) error
- func WarningMark() string
- func WarningMarkPlain() string
- func WriteFileAndFormat(path string, data []byte, perm os.FileMode) error
- func WriteJSON(w http.ResponseWriter, status int, data interface{})
- func WriteJSONPruned(w http.ResponseWriter, status int, v interface{})
- func Yellow(text string) string
- type FileAuth
- type GroupVersionKind
- type H
- type RetryOptions
- type Status
- type TableWriter
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" ColorGray = "\033[90m" )
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 ExtractStatus ¶ added in v0.2.0
func ExtractStatus(obj *unstructured.Unstructured) string
ExtractStatus extracts a status phase or condition from an unstructured object. Returns "Unknown" if no status is found.
func FailureMark ¶ added in v0.4.0
func FailureMark() string
FailureMark returns a red cross symbol for failed operations.
func FailureMarkPlain ¶ added in v0.4.9
func FailureMarkPlain() string
func FormatDuration ¶ added in v0.2.0
FormatDuration formats a duration in human-readable short form. Exported so CLI commands and tests can use it directly.
func FormatYAMLError ¶
func FormatYAMLFile ¶ added in v0.4.3
FormatYAMLFile reads path, parses into a yaml.Node and writes it back with consistent indentation and preserved comments/order.
func HealthIcon ¶ added in v0.2.0
HealthIcon returns a coloured status icon based on a status string.
func HumanAge ¶ added in v0.2.0
HumanAge returns a human-readable age string from a Kubernetes timestamp. Format matches kubectl: 5s, 2m, 3h, 4d, 2w
func InfoMark ¶ added in v0.4.0
func InfoMark() string
InfoMark returns a cyan arrow symbol for informational messages.
func InfoMarkPlain ¶ added in v0.4.9
func InfoMarkPlain() string
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 PrintField ¶ added in v0.2.0
func PrintField(label, value string)
PrintField prints a label: value line used in describe output.
func PrintInfo ¶ added in v0.2.0
func PrintInfo(msg string)
PrintInfo prints a dim informational line.
func PrintNestedMap ¶ added in v0.2.0
PrintNestedMap prints a nested map as indented key: value lines. Used by describe to print spec and status sections.
func PrintSection ¶ added in v0.2.0
func PrintSection(title string)
PrintSection prints a bold section header with a separator.
func PrintSuccess ¶ added in v0.2.0
func PrintSuccess(msg string)
PrintSuccess prints a green checkmark line.
func PrintTable ¶ added in v0.2.0
PrintTable prints a header + rows to stdout, flushed and aligned.
func PrintWarning ¶ added in v0.2.0
func PrintWarning(msg string)
PrintWarning prints a yellow warning line.
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 SuccessMark ¶ added in v0.4.0
func SuccessMark() string
SuccessMark returns a green checkmark symbol for successful operations.
func SuccessMarkPlain ¶ added in v0.4.9
func SuccessMarkPlain() string
func WaitForCRD ¶
Wait for CRD creation
func WarningMark ¶ added in v0.4.0
func WarningMark() string
WarningMark returns a yellow warning symbol for non-fatal issues.
func WarningMarkPlain ¶ added in v0.4.9
func WarningMarkPlain() string
func WriteFileAndFormat ¶ added in v0.4.3
WriteFileAndFormat writes data to path and then formats the YAML file. It preserves a simple, consistent workflow: write -> format -> return error if any.
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
GroupVersionKind is a consistent string key for GVK-keyed maps and logs.
func SetGroupVersionKind ¶
func SetGroupVersionKind(group, version, kind string) GroupVersionKind
SetGroupVersionKind formats a GVK as the canonical string used internally. Mirrors runtime.Object.GetObjectKind().GroupVersionKind().String() output.
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" )
type TableWriter ¶ added in v0.2.0
type TableWriter struct {
// contains filtered or unexported fields
}
TableWriter wraps tabwriter for consistent aligned output.
func NewTableWriter ¶ added in v0.2.0
func NewTableWriter() *TableWriter
NewTableWriter returns a TableWriter writing to stdout.
func (*TableWriter) Flush ¶ added in v0.2.0
func (t *TableWriter) Flush()
Flush flushes the tabwriter buffer.
func (*TableWriter) Header ¶ added in v0.2.0
func (t *TableWriter) Header(cols ...string)
Header prints a bold header row.
func (*TableWriter) Row ¶ added in v0.2.0
func (t *TableWriter) Row(cols ...string)
Row prints one data row.