Documentation
¶
Index ¶
- Constants
- Variables
- func CacheControlMiddleware(next http.Handler) http.Handler
- func GzipMiddleware(next http.Handler) http.Handler
- func LoggingMiddleware(logger logr.Logger, next http.Handler) http.Handler
- func MaxBodySizeMiddleware(maxBytes int64) func(http.Handler) http.Handler
- func NewHandler(ctx context.Context, conf *fluxcdv1.WebConfigSpec, spaHandler http.Handler, ...) (http.Handler, <-chan struct{})
- func RunServer(ctx context.Context, c cluster.Cluster, ...) error
- func SecurityHeadersMiddleware(next http.Handler) http.Handler
- type ActionRequest
- type ActionResponse
- type Event
- type FavoriteItem
- type FavoritesRequest
- type FileSystem
- type Handler
- func (h *Handler) ActionHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) DownloadHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) EventsHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) FavoritesHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) GetCachedResources(ctx context.Context, kind, name, namespace, status string, limit int) []reporter.ResourceStatus
- func (h *Handler) GetCachedWorkloads(ctx context.Context, kind, name, namespace string, limit int) []reporter.WorkloadRef
- func (h *Handler) GetEvents(ctx context.Context, kind, name, namespace, excludeReason, eventType string) ([]Event, error)
- func (h *Handler) GetFavoritesStatus(ctx context.Context, favorites []FavoriteItem) []reporter.ResourceStatus
- func (h *Handler) GetInventoryObjects(ctx context.Context, items []InventoryObjectItem, statusOnly bool) []InventoryObjectResult
- func (h *Handler) GetLiveResources(ctx context.Context, kind, name, namespace, status string, matchLimit int) ([]reporter.ResourceStatus, error)
- func (h *Handler) GetMetrics(ctx context.Context, pod, namespace, labelSelector string, limit int, ...) (*unstructured.Unstructured, error)
- func (h *Handler) GetReport(ctx context.Context) (*unstructured.Unstructured, error)
- func (h *Handler) GetResource(ctx context.Context, kind, name, namespace string) (*unstructured.Unstructured, error)
- func (h *Handler) GetWorkloadDetails(ctx context.Context, kind, name, namespace string) (*unstructured.Unstructured, error)
- func (h *Handler) GetWorkloadPods(ctx context.Context, obj *unstructured.Unstructured, detailed bool) ([]WorkloadPodStatus, error)
- func (h *Handler) GetWorkloadStatus(ctx context.Context, kind, name, namespace string, detailed bool) (*WorkloadStatus, error)
- func (h *Handler) GetWorkloadsStatus(ctx context.Context, workloads []WorkloadItem) []WorkloadStatus
- func (h *Handler) InventoryObjectsHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) ReportHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) ResourceHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) ResourcesHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) SearchHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) WorkloadActionHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) WorkloadHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) WorkloadLogsHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) WorkloadsHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) WorkloadsListHandler(w http.ResponseWriter, req *http.Request)
- func (h *Handler) WorkloadsSearchHandler(w http.ResponseWriter, req *http.Request)
- type InventoryEntry
- type InventoryObjectItem
- type InventoryObjectResult
- type InventoryObjectsRequest
- type ReconcilerSource
- type SearchIndex
- type SortableEvents
- type WorkloadActionRequest
- type WorkloadActionResponse
- type WorkloadIndex
- type WorkloadItem
- type WorkloadLogsResponse
- type WorkloadPodStatus
- type WorkloadStatus
- type WorkloadsRequest
Constants ¶
const JobOwnerCronJobField = ".metadata.ownerReferences.cronJob"
JobOwnerCronJobField is the field index key for querying Jobs by their CronJob owner. This index must be set up when creating the controller-runtime manager.
Variables ¶
var DownloadableKinds = []string{ fluxcdv1.FluxBucketKind, fluxcdv1.FluxGitRepositoryKind, fluxcdv1.FluxOCIRepositoryKind, fluxcdv1.FluxHelmChartKind, fluxcdv1.FluxExternalArtifactKind, }
DownloadableKinds lists the Flux source kinds that have downloadable artifacts.
Functions ¶
func CacheControlMiddleware ¶
CacheControlMiddleware sets appropriate cache headers for static assets. It ensures index.html is never cached while hashed assets are cached forever.
func GzipMiddleware ¶
GzipMiddleware adds gzip compression to responses.
func LoggingMiddleware ¶
LoggingMiddleware logs HTTP requests and responses.
func MaxBodySizeMiddleware ¶ added in v0.44.0
MaxBodySizeMiddleware limits the size of request bodies to prevent abuse. Only applies to requests that may carry a body (POST, PUT, PATCH).
func NewHandler ¶ added in v0.39.0
func NewHandler(ctx context.Context, conf *fluxcdv1.WebConfigSpec, spaHandler http.Handler, kubeClient *kubeclient.Client, version, statusManager, namespace string, reportInterval time.Duration, eventRecorder record.EventRecorder, authMiddleware func(http.Handler) http.Handler, l logr.Logger) (http.Handler, <-chan struct{})
NewHandler creates a new handler for the web server. It also fires off goroutines to perform background tasks required for handling requests, such as caching the report periodically. They run until the context is canceled. The returned channel is closed when all the goroutines have stopped.
func RunServer ¶ added in v0.39.0
func RunServer(ctx context.Context, c cluster.Cluster, confChannel <-chan *fluxcdv1.WebConfigSpec, version, statusManager, namespace string, gracefulShutdownTimeout time.Duration, port int) error
RunServer starts the web server and blocks until the provided context is canceled. Whenever a new configuration is received on the confChannel, it updates the server settings accordingly without downtime. The error returned is either from http.Server.Shutdown() or graceful shutdown deadline exceeded.
Types ¶
type ActionRequest ¶ added in v0.39.0
type ActionRequest struct {
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Action string `json:"action"`
}
ActionRequest represents the request body for POST /api/v1/resource/action.
type ActionResponse ¶ added in v0.39.0
ActionResponse represents the response body for POST /api/v1/resource/action.
type Event ¶
type Event struct {
LastTimestamp metav1.Time `json:"lastTimestamp"`
Type string `json:"type"`
Message string `json:"message"`
InvolvedObject string `json:"involvedObject"`
Namespace string `json:"namespace"`
}
Event is a lighter representation of a Kubernetes event.
type FavoriteItem ¶
type FavoriteItem struct {
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
}
FavoriteItem represents a single favorite resource request.
type FavoritesRequest ¶
type FavoritesRequest struct {
Favorites []FavoriteItem `json:"favorites"`
}
FavoritesRequest represents the request body for POST /api/v1/favorites.
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
FileSystem wraps an embedded filesystem to handle SPA routing. It serves index.html for all non-existent file requests (404s).
func NewFileSystem ¶
func NewFileSystem(efs fs.FS) *FileSystem
NewFileSystem creates a new filesystem handler for SPA routing.
type Handler ¶ added in v0.39.0
type Handler struct {
// contains filtered or unexported fields
}
Handler provides HTTP handlers for the API endpoints and SPA static files.
func (*Handler) ActionHandler ¶ added in v0.39.0
func (h *Handler) ActionHandler(w http.ResponseWriter, req *http.Request)
ActionHandler handles POST /api/v1/resource/action requests to perform actions on Flux resources.
func (*Handler) DownloadHandler ¶ added in v0.41.0
func (h *Handler) DownloadHandler(w http.ResponseWriter, req *http.Request)
DownloadHandler handles GET /api/v1/artifact/download requests to download artifacts from Flux sources.
func (*Handler) EventsHandler ¶ added in v0.39.0
func (h *Handler) EventsHandler(w http.ResponseWriter, req *http.Request)
EventsHandler handles GET /api/v1/events requests and returns Kubernetes events for Flux resources. Supports optional query parameters: kind, name, namespace, type Example: /api/v1/events?kind=FluxInstance&name=flux&namespace=flux-system&type=Warning
func (*Handler) FavoritesHandler ¶ added in v0.39.0
func (h *Handler) FavoritesHandler(w http.ResponseWriter, req *http.Request)
FavoritesHandler handles POST /api/v1/favorites requests and returns the status of the specified favorite resources.
func (*Handler) GetCachedResources ¶ added in v0.42.0
func (h *Handler) GetCachedResources(ctx context.Context, kind, name, namespace, status string, limit int) []reporter.ResourceStatus
GetCachedResources returns resources from the cached search index filtered by the given criteria. If name and namespace filters are empty, it will return resources across all namespaces (subject to RBAC).
func (*Handler) GetCachedWorkloads ¶ added in v0.53.0
func (h *Handler) GetCachedWorkloads(ctx context.Context, kind, name, namespace string, limit int) []reporter.WorkloadRef
GetCachedWorkloads returns workloads from the cached workload index filtered by the given criteria and the user's namespace access. If name and namespace filters are empty, it returns workloads across all namespaces the user can access (subject to RBAC on the parent reconcilers via ListUserNamespaces).
func (*Handler) GetEvents ¶ added in v0.39.0
func (h *Handler) GetEvents(ctx context.Context, kind, name, namespace, excludeReason, eventType string) ([]Event, error)
GetEvents retrieves events for the specified resource kinds. Returns at most 500 events per kind (100 if multiple kinds are specified), sorted by timestamp descending. Filters by eventType (Normal, Warning) if provided.
func (*Handler) GetFavoritesStatus ¶ added in v0.39.0
func (h *Handler) GetFavoritesStatus(ctx context.Context, favorites []FavoriteItem) []reporter.ResourceStatus
GetFavoritesStatus fetches the status for the specified favorite resources. Resources are queried in parallel with a concurrency limit of 4.
func (*Handler) GetInventoryObjects ¶ added in v0.53.0
func (h *Handler) GetInventoryObjects(ctx context.Context, items []InventoryObjectItem, statusOnly bool) []InventoryObjectResult
GetInventoryObjects fetches the status and sanitized manifest for each object, scoped to the caller's RBAC. Objects are queried by a fixed pool of inventoryObjectsWorkers, so the number of goroutines stays constant regardless of the request size. A per-object failure is reported in its Error field instead of failing the whole batch. When statusOnly is true, the sanitized manifest is omitted and only the status and message are returned.
func (*Handler) GetLiveResources ¶ added in v0.42.0
func (h *Handler) GetLiveResources(ctx context.Context, kind, name, namespace, status string, matchLimit int) ([]reporter.ResourceStatus, error)
GetLiveResources returns a list of ResourceStatus for the specified filters by querying the cluster directly. If name and namespace filters are empty, it will return resources across all namespaces (subject to RBAC).
func (*Handler) GetMetrics ¶ added in v0.39.0
func (h *Handler) GetMetrics(ctx context.Context, pod, namespace, labelSelector string, limit int, opts ...kubeclient.Option) (*unstructured.Unstructured, error)
GetMetrics retrieves the CPU and Memory metrics for a list of pods in the given namespace.
func (*Handler) GetReport ¶ added in v0.39.0
func (h *Handler) GetReport(ctx context.Context) (*unstructured.Unstructured, error)
GetReport returns the cached FluxReport. If the cache is empty, it falls back to building a fresh report (this should only happen during initial startup).
func (*Handler) GetResource ¶ added in v0.39.0
func (h *Handler) GetResource(ctx context.Context, kind, name, namespace string) (*unstructured.Unstructured, error)
GetResource fetches a single Flux resource by kind, name and namespace, and injects the inventory into the .status.inventory field before returning it.
func (*Handler) GetWorkloadDetails ¶ added in v0.53.0
func (h *Handler) GetWorkloadDetails(ctx context.Context, kind, name, namespace string) (*unstructured.Unstructured, error)
GetWorkloadDetails fetches a Kubernetes workload and enriches it with workloadInfo containing the computed WorkloadStatus fields and the parent Flux reconciler data. Only Flux-managed workloads are supported — returns an error if the reconciler cannot be determined.
func (*Handler) GetWorkloadPods ¶ added in v0.39.0
func (h *Handler) GetWorkloadPods(ctx context.Context, obj *unstructured.Unstructured, detailed bool) ([]WorkloadPodStatus, error)
GetWorkloadPods returns the pods managed by a workload (Deployment, StatefulSet, DaemonSet, or CronJob). For apps/v1 workloads, it uses the selector labels to find pods. For CronJobs, it delegates to getCronJobPods which traverses the CronJob -> Job -> Pod ownership chain. When detailed is true, the full Kubernetes PodStatus is included for each pod.
func (*Handler) GetWorkloadStatus ¶ added in v0.39.0
func (h *Handler) GetWorkloadStatus(ctx context.Context, kind, name, namespace string, detailed bool) (*WorkloadStatus, error)
GetWorkloadStatus returns the WorkloadStatus for the given workload. When detailed is true, the managed pods (with their full Kubernetes PodStatus) and the user-permitted actions are included.
func (*Handler) GetWorkloadsStatus ¶ added in v0.39.0
func (h *Handler) GetWorkloadsStatus(ctx context.Context, workloads []WorkloadItem) []WorkloadStatus
GetWorkloadsStatus fetches the status for the specified workloads. Workloads are queried in parallel with a concurrency limit of 4.
func (*Handler) InventoryObjectsHandler ¶ added in v0.53.0
func (h *Handler) InventoryObjectsHandler(w http.ResponseWriter, req *http.Request)
InventoryObjectsHandler handles POST /api/v1/inventory/objects requests and returns the status and sanitized manifest of each requested object.
func (*Handler) ReportHandler ¶ added in v0.39.0
func (h *Handler) ReportHandler(w http.ResponseWriter, req *http.Request)
ReportHandler handles GET /api/v1/report requests and returns the FluxReport from the cluster.
func (*Handler) ResourceHandler ¶ added in v0.39.0
func (h *Handler) ResourceHandler(w http.ResponseWriter, req *http.Request)
ResourceHandler handles GET /api/v1/resource requests and returns a single Flux resource by kind, name and namespace. Query parameters: kind, name, namespace (all required) Example: /api/v1/resource?kind=FluxInstance&name=flux&namespace=flux-system
func (*Handler) ResourcesHandler ¶ added in v0.39.0
func (h *Handler) ResourcesHandler(w http.ResponseWriter, req *http.Request)
ResourcesHandler handles GET /api/v1/resources requests and returns the status of Flux resources. Supports optional query parameters: kind, name, namespace, status Example: /api/v1/resources?kind=FluxInstance&name=flux&namespace=flux-system&status=Ready
func (*Handler) SearchHandler ¶ added in v0.39.0
func (h *Handler) SearchHandler(w http.ResponseWriter, req *http.Request)
SearchHandler handles GET /api/v1/search requests and returns the status of Flux resources from the cached search index. Results are filtered by name with wildcard support. Example: /api/v1/search?name=flux
func (*Handler) WorkloadActionHandler ¶ added in v0.41.0
func (h *Handler) WorkloadActionHandler(w http.ResponseWriter, req *http.Request)
WorkloadActionHandler handles POST /api/v1/workload/action requests to perform actions on workloads.
func (*Handler) WorkloadHandler ¶ added in v0.39.0
func (h *Handler) WorkloadHandler(w http.ResponseWriter, req *http.Request)
WorkloadHandler handles GET /api/v1/workload requests and returns a Kubernetes workload enriched with workloadInfo (status, pods, images, user actions, and parent Flux reconciler). Query parameters: kind, name, namespace (all required). Supported workload kinds: CronJob, DaemonSet, Deployment, StatefulSet. Only Flux-managed workloads are supported — returns an error if the reconciler cannot be determined. Example: /api/v1/workload?kind=Deployment&name=flux-operator&namespace=flux-system
func (*Handler) WorkloadLogsHandler ¶ added in v0.53.0
func (h *Handler) WorkloadLogsHandler(w http.ResponseWriter, req *http.Request)
WorkloadLogsHandler handles GET /api/v1/workload/logs requests and returns the logs of a pod container managed by a Flux workload.
Logs are read using the impersonated user's identity, so Kubernetes enforces the native "get" verb on the "pods/log" subresource: a user can only view the logs of pods they are explicitly granted access to. This is a read-only endpoint and is therefore not gated by UserActionsEnabled; access is governed entirely by RBAC.
By default the last tailLines entries are returned. When the sinceTime query parameter is set (an RFC3339 timestamp), only entries newer than that time are returned instead, so a following client can incrementally append new lines rather than re-fetching and replacing the whole tail window on every poll.
The container query parameter may be repeated for the "All containers" view and the pod query parameter (in addition to the required name) for the "All pods" view: every (pod, container) target is streamed and interleaved chronologically into a single payload (the previous-instance option is not offered there). When more than one pod is requested, each timestamped line is prefixed with its pod of origin ("<pod> <timestamp> <message>") and the response sets tagged=true plus the total/streamed/partial/forbidden coverage fields. The frontend supplies the pod and container names, so no pod read is required and access stays governed solely by the pods/log RBAC, enforced per pod; a user who cannot read some pods simply gets a partial result.
Following uses sinceTime for the single-stream path and a repeated since parameter ("<pod>=<rfc3339>") for the all-pods path, so each pod advances its own cursor independently of clock skew between nodes.
Example: /api/v1/workload/logs?namespace=flux-system&name=source-controller-xx-yy&container=manager
func (*Handler) WorkloadsHandler ¶ added in v0.39.0
func (h *Handler) WorkloadsHandler(w http.ResponseWriter, req *http.Request)
WorkloadsHandler handles POST /api/v1/workloads requests and returns the status of the specified workloads.
func (*Handler) WorkloadsListHandler ¶ added in v0.53.0
func (h *Handler) WorkloadsListHandler(w http.ResponseWriter, req *http.Request)
WorkloadsListHandler handles GET /api/v1/workloads requests and returns the Flux-managed workloads (Deployment, StatefulSet, DaemonSet, CronJob) from the cached, inventory-derived workload index, filtered by the user's namespace access. Supports optional query parameters: kind, name, namespace. Example: /api/v1/workloads?kind=Deployment&namespace=flux-system
func (*Handler) WorkloadsSearchHandler ¶ added in v0.53.0
func (h *Handler) WorkloadsSearchHandler(w http.ResponseWriter, req *http.Request)
WorkloadsSearchHandler handles GET /api/v1/workloads/search requests and returns Flux-managed workloads from the cached workload index for the global quick-search. Results are filtered by name with wildcard support and capped at a small limit. Supports optional query parameters: kind, name, namespace. Example: /api/v1/workloads/search?name=podinfo
type InventoryEntry ¶
type InventoryEntry struct {
Name string `json:"name"`
Namespace string `json:"namespace,omitempty"`
Kind string `json:"kind"`
APIVersion string `json:"apiVersion"`
}
InventoryEntry represents a Kubernetes object entry in the Flux inventory.
type InventoryObjectItem ¶ added in v0.53.0
type InventoryObjectItem struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
}
InventoryObjectItem identifies a managed object to fetch.
type InventoryObjectResult ¶ added in v0.53.0
type InventoryObjectResult struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
Status string `json:"status,omitempty"`
StatusMessage string `json:"statusMessage,omitempty"`
Error string `json:"error,omitempty"`
Object map[string]any `json:"object,omitempty"`
}
InventoryObjectResult holds the status and sanitized manifest of one object, or an Error when it could not be fetched.
type InventoryObjectsRequest ¶ added in v0.53.0
type InventoryObjectsRequest struct {
Objects []InventoryObjectItem `json:"objects"`
// StatusOnly, when true, makes the handler return each object's status and
// message only, omitting the sanitized manifest. Callers that render status
// without the object body (e.g. the Graph tab) use this to avoid the manifest
// fetch overhead and payload.
StatusOnly bool `json:"statusOnly,omitempty"`
}
InventoryObjectsRequest is the request body for POST /api/v1/inventory/objects.
type ReconcilerSource ¶
type ReconcilerSource struct {
Kind string `json:"kind"`
Name string `json:"name"`
Namespace string `json:"namespace"`
URL string `json:"url"`
OriginURL string `json:"originURL"`
OriginRevision string `json:"originRevision"`
Status string `json:"status"`
Message string `json:"message"`
}
ReconcilerSource holds the Flux source info of a managed object. It includes the upstream URL, origin URL, and origin revision.
type SearchIndex ¶ added in v0.42.0
type SearchIndex struct {
// contains filtered or unexported fields
}
SearchIndex holds cached search data built from the reporter's Compute() results.
func (*SearchIndex) Kinds ¶ added in v0.53.0
func (idx *SearchIndex) Kinds() []string
Kinds returns the distinct resource kinds present in the index, sorted alphabetically.
func (*SearchIndex) SearchResources ¶ added in v0.42.0
func (idx *SearchIndex) SearchResources(allowedNamespaces []string, kind, name, namespace, status string, limit int) []reporter.ResourceStatus
SearchResources filters indexed resources by the given criteria. allowedNamespaces restricts results to RBAC-visible namespaces: nil means no RBAC filtering (cluster-wide access), non-nil (including empty) means only return resources in those namespaces. kind filters by exact match (empty means all kinds). name filters by wildcard match using matchesWildcard() (empty means all names). namespace filters by exact match (empty means all namespaces). status filters by exact match (empty means all statuses). limit caps the number of returned results (0 means unlimited). Results are sorted by LastReconciled (newest first).
func (*SearchIndex) Update ¶ added in v0.42.0
func (idx *SearchIndex) Update(resources []reporter.ResourceStatus)
Update sorts and stores the given resources in the index, replacing any existing data.
type SortableEvents ¶
SortableEvents implements sort.Interface for []api.Event by time
func (SortableEvents) Len ¶
func (list SortableEvents) Len() int
func (SortableEvents) Less ¶
func (list SortableEvents) Less(i, j int) bool
func (SortableEvents) Swap ¶
func (list SortableEvents) Swap(i, j int)
type WorkloadActionRequest ¶ added in v0.41.0
type WorkloadActionRequest struct {
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Action string `json:"action"`
}
WorkloadActionRequest represents the request body for POST /api/v1/workload/action.
type WorkloadActionResponse ¶ added in v0.41.0
type WorkloadActionResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
}
WorkloadActionResponse represents the response body for POST /api/v1/workload/action.
type WorkloadIndex ¶ added in v0.53.0
type WorkloadIndex struct {
// contains filtered or unexported fields
}
WorkloadIndex holds cached workload data built from the reporter's Compute() results. Workloads are extracted from Flux applier inventories and carry the owning reconciler's reference and status (badge only).
func (*WorkloadIndex) SearchWorkloads ¶ added in v0.53.0
func (idx *WorkloadIndex) SearchWorkloads(allowedNamespaces []string, kind, name, namespace string, limit int) []reporter.WorkloadRef
SearchWorkloads filters indexed workloads by the given criteria. allowedNamespaces restricts results to RBAC-visible namespaces: nil means no RBAC filtering (cluster-wide access), non-nil (including empty) means only return workloads in those namespaces. kind filters by exact match (empty means all kinds). name filters by wildcard match using matchesWildcard() (empty means all names). namespace filters by exact match (empty means all namespaces). limit caps the number of returned results (0 means unlimited). Results are sorted by LastReconciled (newest first), with a (namespace, name, kind) tiebreaker since all workloads under one applier share the applier timestamp.
func (*WorkloadIndex) Update ¶ added in v0.53.0
func (idx *WorkloadIndex) Update(workloads []reporter.WorkloadRef)
Update sorts and stores the given workloads in the index, replacing any existing data.
type WorkloadItem ¶
type WorkloadItem struct {
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
}
WorkloadItem represents a single workload request.
type WorkloadLogsResponse ¶ added in v0.53.0
type WorkloadLogsResponse struct {
// Pod is the name of the pod the logs belong to (or a comma-joined list of
// pods for the all-pods view).
Pod string `json:"pod"`
// Container is the name of the container the logs belong to (or a comma-joined
// list for the all-containers view).
Container string `json:"container"`
// Logs is the plain-text log output.
Logs string `json:"logs"`
// Tagged reports whether each timestamped line in Logs is prefixed with its
// pod of origin ("<pod> <timestamp> <message>"). Set only for the all-pods
// view (more than one pod streamed); absent for single-pod responses.
Tagged bool `json:"tagged,omitempty"`
// ContainerTagged reports whether each timestamped line in Logs is prefixed
// with its container of origin, after the optional pod tag ("<pod> <container>
// <timestamp> <message>", or "<container> <timestamp> <message>" for a single
// pod). Set only for the all-containers view (more than one container
// streamed), so the client can scope multi-line folding per container.
ContainerTagged bool `json:"containerTagged,omitempty"`
// Total is the number of distinct pods the client requested. Set only for the
// multi-stream (all-pods/all-containers) path.
Total int `json:"total,omitempty"`
// Streamed is the number of those pods that produced logs. When it is less
// than Total some pods were skipped (forbidden, missing, or capped).
Streamed int `json:"streamed,omitempty"`
// Partial reports that the response does not cover every requested pod
// (Streamed < Total) or that the fan-out was truncated by a cap.
Partial bool `json:"partial,omitempty"`
// Forbidden is the number of pods skipped because the user is not allowed to
// read their logs, so the UI can explain a partial result.
Forbidden int `json:"forbidden,omitempty"`
}
WorkloadLogsResponse represents the response body for GET /api/v1/workload/logs.
type WorkloadPodStatus ¶
type WorkloadPodStatus struct {
// Name is the name of the pod.
Name string `json:"name"`
// Status is the Kubernetes pod phase.
// Values: "Pending", "Running", "Succeeded", "Failed", "Unknown"
Status string `json:"status"`
// StatusMessage is a human-readable message indicating details
// about the pod observed state.
StatusMessage string `json:"statusMessage,omitempty"`
// CreatedAt is the creation timestamp of the pod.
CreatedAt time.Time `json:"createdAt"`
// CreatedBy is the user who triggered the pod creation.
CreatedBy string `json:"createdBy,omitempty"`
// PodStatus is the full Kubernetes PodStatus.
// Only populated for the workload detail endpoint.
PodStatus *corev1.PodStatus `json:"podStatus,omitempty"`
}
WorkloadPodStatus represents the status of a pod managed by a workload.
type WorkloadStatus ¶
type WorkloadStatus struct {
// Kind is the kind of the workload.
Kind string `json:"kind"`
// Name is the name of the workload.
Name string `json:"name"`
// Namespace is the namespace of the workload.
Namespace string `json:"namespace"`
// Status is the readiness status of the workload.
// kstatus values: "InProgress", "Failed", "Current", "Terminating", "NotFound", "Unknown"
Status string `json:"status"`
// StatusMessage is a human-readable message indicating details
// about the workload observed state.
StatusMessage string `json:"statusMessage,omitempty"`
// CreatedAt is the creation timestamp of the workload.
CreatedAt time.Time `json:"createdAt"`
// RestartedAt is the timestamp of the last rollout restart.
// Extracted from the kubectl.kubernetes.io/restartedAt annotation.
RestartedAt string `json:"restartedAt,omitempty"`
// ContainerImages is the list of container images used by the workload.
ContainerImages []string `json:"containerImages,omitempty"`
// Pods is the list of pods managed by the workload.
Pods []WorkloadPodStatus `json:"pods,omitempty"`
// UserActions indicates which actions the user can perform on this workload.
UserActions []string `json:"userActions,omitempty"`
}
WorkloadStatus represents the rollout status of a Kubernetes workload.
type WorkloadsRequest ¶
type WorkloadsRequest struct {
Workloads []WorkloadItem `json:"workloads"`
}
WorkloadsRequest represents the request body for POST /api/v1/workloads.
Source Files
¶
- action_access.go
- artifact_download.go
- audit.go
- events.go
- favorites.go
- fs.go
- handler.go
- helm_values.go
- inventory.go
- inventory_objects.go
- middlewares.go
- report.go
- resource.go
- resource_action.go
- resources.go
- sanitize.go
- search.go
- search_index.go
- server.go
- source.go
- workload.go
- workload_action.go
- workload_index.go
- workload_logs.go
- workloads.go