Documentation
¶
Overview ¶
Package k8s provides Kubernetes client helpers for Deployah resources.
It wraps label selectors, pod queries, and component discovery for projects deployed through Deployah.
Index ¶
- Constants
- func BuildComponentSelector(project, component string) (string, error)
- func BuildLabelSelector(project, environment string) (labels.Selector, error)
- func BuildProjectSelector(project string) (string, error)
- func BuildSelector(project, component, environment string) (string, error)
- type Client
- func (c *Client) GetAvailableComponents(ctx context.Context, projectName string) ([]string, error)
- func (c *Client) GetAvailableEnvironments(ctx context.Context, projectName, componentName string) ([]string, error)
- func (c *Client) GetComponentInfo(ctx context.Context, projectName, componentName string) (*ComponentInfo, error)
- func (c *Client) GetKubernetesClient() runtime.KubernetesClient
- func (c *Client) GetNamespace() string
- func (c *Client) GetPodInfo(ctx context.Context, podName string) (*PodInfo, error)
- func (c *Client) GetPodStatus(ctx context.Context, releaseName string) (int, int, string, error)
- func (c *Client) GetProjectComponents(ctx context.Context, projectName string) ([]ComponentInfo, error)
- func (c *Client) GetRunningPods(ctx context.Context, project, component, environment string) ([]PodInfo, error)
- func (c *Client) ValidateComponentExists(ctx context.Context, projectName, componentName string) error
- func (c *Client) ValidatePodExists(ctx context.Context, podName string) error
- type ComponentInfo
- type PodInfo
- type ProjectInfo
- type SelectorBuilder
Constants ¶
const ( ProjectLabel = "deployah.dev/project" ComponentLabel = "deployah.dev/component" EnvironmentLabel = "deployah.dev/environment" )
Label constants for Deployah resources
Variables ¶
This section is empty.
Functions ¶
func BuildComponentSelector ¶
BuildComponentSelector builds a selector for a specific project and component
func BuildLabelSelector ¶
BuildLabelSelector returns a labels.Selector for project and/or environment filters.
func BuildProjectSelector ¶
BuildProjectSelector builds a selector for a specific project
func BuildSelector ¶
BuildSelector builds a label selector from project, component, and environment.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps Kubernetes operations for Deployah resources
func NewClient ¶
func NewClient(k8sClient runtime.KubernetesClient, namespace string) *Client
NewClient creates a new Kubernetes client for Deployah operations
func NewClientFromRuntime ¶
NewClientFromRuntime creates a new client from a runtime instance
func (*Client) GetAvailableComponents ¶
GetAvailableComponents lists component names from running pods for a project.
func (*Client) GetAvailableEnvironments ¶
func (c *Client) GetAvailableEnvironments(ctx context.Context, projectName, componentName string) ([]string, error)
GetAvailableEnvironments lists environment names from running pods for a project and component.
func (*Client) GetComponentInfo ¶
func (c *Client) GetComponentInfo(ctx context.Context, projectName, componentName string) (*ComponentInfo, error)
GetComponentInfo gets detailed information about a specific component
func (*Client) GetKubernetesClient ¶
func (c *Client) GetKubernetesClient() runtime.KubernetesClient
GetKubernetesClient returns the underlying Kubernetes client
func (*Client) GetNamespace ¶
GetNamespace returns the namespace this client operates in
func (*Client) GetPodInfo ¶
GetPodInfo retrieves detailed information about a specific pod
func (*Client) GetPodStatus ¶
GetPodStatus retrieves pod status information for a release
func (*Client) GetProjectComponents ¶
func (c *Client) GetProjectComponents(ctx context.Context, projectName string) ([]ComponentInfo, error)
GetProjectComponents gets all components for a project with their information
func (*Client) GetRunningPods ¶
func (c *Client) GetRunningPods(ctx context.Context, project, component, environment string) ([]PodInfo, error)
GetRunningPods lists running pods for a project, component, and environment.
type ComponentInfo ¶
ComponentInfo contains information about a component
type ProjectInfo ¶
type ProjectInfo struct {
Name string
Environment string
Components []string
PodCount int
ReadyPods int
}
ProjectInfo contains information about a project
type SelectorBuilder ¶
type SelectorBuilder struct {
// contains filtered or unexported fields
}
SelectorBuilder helps build Kubernetes label selectors for Deployah resources
func NewSelectorBuilder ¶
func NewSelectorBuilder() *SelectorBuilder
NewSelectorBuilder creates a new selector builder
func (*SelectorBuilder) Build ¶
func (sb *SelectorBuilder) Build() string
Build returns the final label selector string
func (*SelectorBuilder) WithComponent ¶
func (sb *SelectorBuilder) WithComponent(component string) (*SelectorBuilder, error)
WithComponent adds a component label requirement to the selector
func (*SelectorBuilder) WithEnvironment ¶
func (sb *SelectorBuilder) WithEnvironment(environment string) (*SelectorBuilder, error)
WithEnvironment adds an environment label requirement to the selector
func (*SelectorBuilder) WithProject ¶
func (sb *SelectorBuilder) WithProject(project string) (*SelectorBuilder, error)
WithProject adds a project label requirement to the selector