Documentation
¶
Overview ¶
pkg/inspect/client.go
pkg/inspect/discovery.go
pkg/inspect/printer.go
pkg/inspect/reconcile_trigger.go
Index ¶
- Constants
- func Bold(s string) string
- func Cyan(s string) string
- func ExtractStatus(obj *unstructured.Unstructured) string
- func FormatDuration(d time.Duration) string
- func HealthIcon(status string) string
- func HumanAge(t metav1.Time) 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 TriggerReconcile(ctx context.Context, client dynamic.Interface, gvr schema.GroupVersionResource, ...) error
- type CRDInfo
- type Clients
- type TableWriter
- type TriggerResult
Constants ¶
const ReconcileAnnotation = "orkestra.konductor.io/reconcile-at"
ReconcileAnnotation is the annotation key written to trigger reconciliation. Orkestra's informer detects the metadata update and re-queues the object. The value is an RFC3339 timestamp — unique per trigger, readable in kubectl describe.
Variables ¶
This section is empty.
Functions ¶
func ExtractStatus ¶
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 FormatDuration ¶
FormatDuration formats a duration in human-readable short form. Exported so CLI commands and tests can use it directly.
func HealthIcon ¶
HealthIcon returns a coloured status icon based on a status string.
func HumanAge ¶
HumanAge returns a human-readable age string from a Kubernetes timestamp. Format matches kubectl: 5s, 2m, 3h, 4d, 2w
func PrintField ¶
func PrintField(label, value string)
PrintField prints a label: value line used in describe output.
func PrintNestedMap ¶
PrintNestedMap prints a nested map as indented key: value lines. Used by describe to print spec and status sections.
func PrintSection ¶
func PrintSection(title string)
PrintSection prints a bold section header with a separator.
func PrintTable ¶
PrintTable prints a header + rows to stdout, flushed and aligned.
func TriggerReconcile ¶
func TriggerReconcile( ctx context.Context, client dynamic.Interface, gvr schema.GroupVersionResource, namespace string, name string, ) error
TriggerReconcile patches the reconcile annotation on a single CR. The informer detects the metadata change and re-queues the object into the workqueue, causing Orkestra to reconcile it on the next loop.
This is non-destructive — it only touches the annotation, never the spec.
Types ¶
type CRDInfo ¶
type CRDInfo struct {
// Name — CRD name e.g. "website"
Name string
// Group — API group e.g. "demo.orkestra.io"
Group string
// Version — API version e.g. "v1alpha1"
Version string
// Kind — singular Kind e.g. "Website"
Kind string
// Plural — plural resource name e.g. "websites"
Plural string
// Namespaced — true if the CRD is namespace-scoped
Namespaced bool
// GVR — the GroupVersionResource used by the dynamic client
GVR schema.GroupVersionResource
}
CRDInfo holds the resolved GVR and display metadata for one CRD. Discovered from the cluster via the API server resource list.
func DiscoverCRD ¶
func DiscoverCRD(disc discovery.DiscoveryInterface, name string) (*CRDInfo, error)
DiscoverCRD finds a CRD by name in the cluster.
The input may be any of:
- plural resource name: "websites"
- singular resource name: "website"
- Kind (case-insensitive): "Website" or "website"
Returns an error if zero or more than one CRD matches. When multiple matches are found, all candidates are listed in the error so the user can be more specific.
func DiscoverOrkestraCRDs ¶
func DiscoverOrkestraCRDs(disc discovery.DiscoveryInterface) ([]CRDInfo, error)
DiscoverOrkestraCRDs returns all CRDs in the cluster that carry the managed-by=orkestra label. Used by `ork reconcile all` when no --katalog is provided — discovers what Orkestra is already managing from the cluster rather than requiring a Katalog file.
type Clients ¶
type Clients struct {
// Dynamic — for reading any CRD as unstructured.Unstructured.
// Used by get, describe, and reconcile commands.
Dynamic dynamic.Interface
// Discovery — for listing CRDs and resolving GVR from a name.
// Used by all commands to discover what the user is referring to.
Discovery discovery.DiscoveryInterface
// Core — for reading Kubernetes events.
// Used by describe and events commands.
Core kubernetes.Interface
// RestConfig — raw REST config, kept for any future direct REST calls.
RestConfig *rest.Config
}
Clients holds the Kubernetes clients needed by all inspect commands. Built once, shared across all operations within a single command invocation.
func NewClients ¶
NewClients builds Kubernetes clients from the provided kubeconfig path.
Resolution order:
- Explicit kubeconfigPath argument (from --kubeconfig flag)
- KUBECONFIG environment variable
- ~/.kube/config (default kubeconfig location)
- In-cluster config (when running inside Kubernetes)
Returns a clear error if none of these paths produce a valid config.
type TableWriter ¶
type TableWriter struct {
// contains filtered or unexported fields
}
TableWriter wraps tabwriter for consistent aligned output.
func NewTableWriter ¶
func NewTableWriter() *TableWriter
NewTableWriter returns a TableWriter writing to stdout.
func (*TableWriter) Header ¶
func (t *TableWriter) Header(cols ...string)
Header prints a bold header row.
type TriggerResult ¶
type TriggerResult struct {
// Name — the CR name that was triggered
Name string
// Namespace — the CR namespace (empty for cluster-scoped)
Namespace string
// Error — non-nil if the trigger failed
Error error
}
TriggerResult holds the outcome of one reconcile trigger operation.
func TriggerReconcileAll ¶
func TriggerReconcileAll( ctx context.Context, client dynamic.Interface, gvr schema.GroupVersionResource, namespace string, ) ([]TriggerResult, error)
TriggerReconcileAll triggers reconciliation for every CR of a given CRD. Returns one TriggerResult per CR — failures are collected, not fatal. The caller decides how to handle partial failures.