Documentation ¶
Index ¶
- func ConstructClusterResourceTree(ctx context.Context, defaultClient client.Client, ...) (*ClusterResourceNode, *HTTPError)
- func ConstructInClusterKubeconfig(ctx context.Context, restConfig *rest.Config, namespace string) (*clientcmdapi.Config, error)
- func ConstructMultiClusterTree(ctx context.Context, ctrlClient ctrlclient.Client, k8sConfigClient *api.Config) (*MultiClusterTreeNode, *HTTPError)
- func GetKubeadmClusterName(restConfig *rest.Config, namespace string, name string) (string, error)
- func GetNestedValue(data map[string]any, path []string) (result string, found bool)
- func GetPodLogsForResource(ctx context.Context, c client.Client, restConfig *rest.Config, kind string, ...) ([]string, error)
- func OwnerRefToObjectRef(ownerRef metav1.OwnerReference, namespace string) *corev1.ObjectReference
- func RemoveTransitiveOwners(start types.UID, ownershipGraph *OwnershipGraph)
- func WriteKubeconfigToFile(ctx context.Context, filePath string, clientConfig clientcmdapi.Config) error
- type ClusterResourceNode
- type ClusterResourceTreeOptions
- type HTTPError
- type LogEntry
- type MultiClusterTreeNode
- type OwnershipGraph
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConstructClusterResourceTree ¶
func ConstructClusterResourceTree(ctx context.Context, defaultClient client.Client, runtimeClient ctrlclient.Client, dcOptions client.DescribeClusterOptions) (*ClusterResourceNode, *HTTPError)
ConstructClusterResourceTree returns a tree with nodes representing the Cluster API resources in the Cluster. Note: ObjectReferenceObjects do not have the virtual annotation so we can assume that all virtual objects are collapsible
func ConstructMultiClusterTree ¶
func ConstructMultiClusterTree(ctx context.Context, ctrlClient ctrlclient.Client, k8sConfigClient *api.Config) (*MultiClusterTreeNode, *HTTPError)
ConstructMultiClusterTree returns a tree representing the workload cluster discovered in the management cluster.
func GetKubeadmClusterName ¶
func GetNestedValue ¶ added in v1.3.0
GetNestedValue returns the value of a nested key in a map.
func GetPodLogsForResource ¶ added in v1.3.0
func GetPodLogsForResource(ctx context.Context, c client.Client, restConfig *rest.Config, kind string, namespace string, name string) ([]string, error)
GetPodLogsForResource returns logs for a given resource from the CAPI controllers containing the provider name label.
func OwnerRefToObjectRef ¶ added in v1.3.0
func OwnerRefToObjectRef(ownerRef metav1.OwnerReference, namespace string) *corev1.ObjectReference
OwnerRefToObjectRef returns an object reference to the ownerRef of an object.
func RemoveTransitiveOwners ¶ added in v1.3.0
func RemoveTransitiveOwners(start types.UID, ownershipGraph *OwnershipGraph)
RemoveTransitiveOwners removes transitive owners from the graph, i.e. if I is owned by J and K, and J is also owned by K, then K is removed as an owner of I as it is implicitly owned by K through J.
func WriteKubeconfigToFile ¶
Types ¶
type ClusterResourceNode ¶
type ClusterResourceNode struct { Name string `json:"name"` Namespace string `json:"namespace"` DisplayName string `json:"displayName"` Kind string `json:"kind"` Group string `json:"group"` Version string `json:"version"` Provider string `json:"provider"` UID string `json:"uid"` CollapseWithTab bool `json:"collapseWithTab"` CollapseOnClick bool `json:"collapseOnClick"` Collapsible bool `json:"collapsible"` Collapsed bool `json:"collapsed"` Ready bool `json:"ready"` Severity string `json:"severity"` HasReady bool `json:"hasReady"` Children []*ClusterResourceNode `json:"children"` }
ClusterResourceNode represents a node in the Cluster API resource tree and is used to configure the frontend with additional options like collapsibility and provider.
type HTTPError ¶
func GetCustomResource ¶
func GetCustomResource(ctx context.Context, runtimeClient ctrlclient.Client, kind string, apiVersion string, namespace string, name string) (*unstructured.Unstructured, *HTTPError)
func NewInternalError ¶
type MultiClusterTreeNode ¶
type MultiClusterTreeNode struct { Name string `json:"name"` Namespace string `json:"namespace"` InfrastructureProvider string `json:"infrastructureProvider"` IsManagement bool `json:"isManagement"` Phase string `json:"phase"` Ready bool `json:"ready"` Children []*MultiClusterTreeNode `json:"children"` }
type OwnershipGraph ¶ added in v1.3.0
type OwnershipGraph struct { // Objects is a map of objects indexed by their UID. They indicate nodes in the graph. Objects map[types.UID]ctrlclient.Object // OwnerRefs is a map of objects to a set of their ownerRefs. They indicate directed edges in the graph, such that an edge from // node I to J means that I is owned by J. // The set is implemented as a `map[types.UID]struct{}` (meaning a map with empty structs as values) for fast lookup. OwnerRefs map[types.UID]map[types.UID]struct{} }
OwnershipGraph is a graph of objects and their ownerRefs.
func NewOwnershipGraph ¶ added in v1.3.0
func NewOwnershipGraph(ctx context.Context, c ctrlclient.Client, object ctrlclient.Object) *OwnershipGraph
NewOwnershipGraph returns a new OwnershipGraph by recursively traversing the ownerRefs of the given object.