k8s

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps Kubernetes clients for CRD and core resource access

func NewClient

func NewClient(cmd *cobra.Command) (*Client, error)

NewClient creates a new Kubernetes client from command flags

func (*Client) ApprovePromotion

func (c *Client) ApprovePromotion(ctx context.Context, prNumber int) error

ApprovePromotion approves a promotion for a PR

func (*Client) GetClient

func (c *Client) GetClient() client.Client

GetClient returns the controller-runtime client

func (*Client) GetClientset

func (c *Client) GetClientset() *kubernetes.Clientset

GetClientset returns the standard Kubernetes clientset

func (*Client) GetConfig

func (c *Client) GetConfig() *rest.Config

GetConfig returns the REST config

func (*Client) GetDrift

func (c *Client) GetDrift(ctx context.Context, appName, cluster string) (*v1alpha1.DriftMonitor, error)

GetDrift gets a specific DriftMonitor by app name and optional cluster

func (*Client) GetEvents

func (c *Client) GetEvents(ctx context.Context, resource string, opts EventOptions) ([]string, error)

GetEvents retrieves Kubernetes events for a resource

func (*Client) GetMetrics

func (c *Client) GetMetrics(ctx context.Context, filter string) (string, error)

GetMetrics fetches Prometheus metrics from the operator

func (*Client) GetNamespace

func (c *Client) GetNamespace() string

GetNamespace returns the default namespace

func (*Client) GetOperatorConfig

func (c *Client) GetOperatorConfig(ctx context.Context) (*ConfigData, error)

GetOperatorConfig retrieves the operator configuration

func (*Client) GetOperatorLogs

func (c *Client) GetOperatorLogs(ctx context.Context, opts LogOptions) ([]string, error)

GetOperatorLogs retrieves operator pod logs

func (*Client) GetOperatorStatus

func (c *Client) GetOperatorStatus(ctx context.Context) (*OperatorStatus, error)

GetOperatorStatus fetches the operator's current status

func (*Client) GetPR

func (c *Client) GetPR(ctx context.Context, prNumber int, repo string) (*v1alpha1.PullRequestTracker, error)

GetPR gets a specific PullRequestTracker by PR number and optional repo

func (*Client) GetPRLogs

func (c *Client) GetPRLogs(ctx context.Context, prNumber int, opts LogOptions) ([]string, error)

GetPRLogs retrieves logs related to a specific PR

func (*Client) GetPromotion

func (c *Client) GetPromotion(ctx context.Context, prNumber int) (*v1alpha1.PullRequestTracker, error)

GetPromotion gets promotion details for a specific PR

func (*Client) GetPromotionLogs

func (c *Client) GetPromotionLogs(ctx context.Context, prNumber int, opts LogOptions) ([]string, error)

GetPromotionLogs retrieves logs related to promotions

func (*Client) ListClusters

func (c *Client) ListClusters(ctx context.Context, checkHealth bool) ([]ClusterInfo, error)

ListClusters lists all configured clusters

func (*Client) ListDrifts

func (c *Client) ListDrifts(ctx context.Context, filters DriftListFilters, allNamespaces bool) ([]v1alpha1.DriftMonitor, error)

ListDrifts lists all DriftMonitor resources with optional filtering

func (*Client) ListPRs

func (c *Client) ListPRs(ctx context.Context, filters PRListFilters, allNamespaces bool) ([]v1alpha1.PullRequestTracker, error)

ListPRs lists all PullRequestTracker resources with optional filtering

func (*Client) ListPromotions

func (c *Client) ListPromotions(ctx context.Context, filters PromotionListFilters, allNamespaces bool) ([]v1alpha1.PullRequestTracker, error)

ListPromotions lists PRs with pending promotions

func (*Client) ResolveDrift

func (c *Client) ResolveDrift(ctx context.Context, appName, cluster string) error

ResolveDrift marks drift as resolved

func (*Client) RetryPR

func (c *Client) RetryPR(ctx context.Context, prNumber int) error

RetryPR resets a failed PR to trigger reprocessing

func (*Client) ValidateConfig

func (c *Client) ValidateConfig(ctx context.Context) (*ValidationResult, error)

ValidateConfig validates the operator configuration

type ClusterInfo

type ClusterInfo struct {
	Name     string
	Endpoint string
	Mode     string
	Healthy  bool
}

ClusterInfo represents cluster configuration information

type ConfigData

type ConfigData struct {
	GitHubOrg   string
	GitHubRepos []string
	Clusters    []ClusterInfo
}

ConfigData represents operator configuration

type DriftListFilters

type DriftListFilters struct {
	Cluster      string
	UnsyncedOnly bool
}

DriftListFilters defines filters for listing drift monitors

type EventOptions

type EventOptions struct {
	Timestamps bool
	Tail       int
	Since      string
}

EventOptions defines options for fetching events

type LogOptions

type LogOptions struct {
	Follow    bool
	Tail      int
	Level     string
	Since     string
	Container string
}

LogOptions defines options for fetching logs

type OperatorStatus

type OperatorStatus struct {
	Healthy              bool
	PRPipelineRunning    bool
	DriftPipelineRunning bool
	GitHubHealthy        bool
	TrackedPRs           int
	ActiveDrifts         int
	RecentErrors         []string
}

OperatorStatus represents the operator's health and status

type PRListFilters

type PRListFilters struct {
	State       string
	Repo        string
	Environment string
}

PRListFilters defines filters for listing pull request trackers

type PromotionListFilters

type PromotionListFilters struct {
	Environment string
	Status      string
}

PromotionListFilters defines filters for listing promotions

type ValidationResult

type ValidationResult struct {
	Valid    bool
	Errors   []string
	Warnings []string
}

ValidationResult represents configuration validation results

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL