k8s

package
v0.0.0-...-5f1bfd3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 16 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 {
	client.Client
	kubernetes.Interface
	Config    *rest.Config
	Context   string
	Cluster   string
	Namespace string
}

Client wraps Kubernetes client functionality for FluxCD resources

func NewClient

func NewClient(kubeconfig, context, namespace string) (*Client, error)

NewClient creates a new Kubernetes client

func (*Client) GetClusterInfo

func (c *Client) GetClusterInfo(ctx context.Context) (*ClusterInfo, error)

GetClusterInfo returns basic cluster information

func (*Client) GetCurrentContext

func (c *Client) GetCurrentContext() string

GetCurrentContext returns the current Kubernetes context

func (*Client) GetEvents

func (c *Client) GetEvents(ctx context.Context, namespace string) ([]corev1.Event, error)

GetEvents returns Kubernetes events related to FluxCD resources

func (*Client) ListGitRepositories

func (c *Client) ListGitRepositories(ctx context.Context, namespace string) ([]Resource, error)

ListGitRepositories lists all GitRepository resources

func (*Client) ListHelmReleases

func (c *Client) ListHelmReleases(ctx context.Context, namespace string) ([]Resource, error)

ListHelmReleases lists all HelmRelease resources

func (*Client) ListHelmRepositories

func (c *Client) ListHelmRepositories(ctx context.Context, namespace string) ([]Resource, error)

ListHelmRepositories lists all HelmRepository resources

func (*Client) ListKustomizations

func (c *Client) ListKustomizations(ctx context.Context, namespace string) ([]Resource, error)

ListKustomizations lists all Kustomization resources

func (*Client) ReconcileResource

func (c *Client) ReconcileResource(ctx context.Context, resourceType ResourceType, name, namespace string) error

ReconcileResource triggers reconciliation of a FluxCD resource

func (*Client) ResumeResource

func (c *Client) ResumeResource(ctx context.Context, resourceType ResourceType, name, namespace string) error

ResumeResource resumes a FluxCD resource

func (*Client) SuspendResource

func (c *Client) SuspendResource(ctx context.Context, resourceType ResourceType, name, namespace string) error

SuspendResource suspends a FluxCD resource

func (*Client) TestConnection

func (c *Client) TestConnection(ctx context.Context) error

TestConnection tests the connection to the Kubernetes cluster

type ClusterInfo

type ClusterInfo struct {
	Version   string
	NodeCount int
	Context   string
}

ClusterInfo contains basic cluster information

type Condition

type Condition struct {
	Type               string    `json:"type"`
	Status             string    `json:"status"`
	Reason             string    `json:"reason"`
	Message            string    `json:"message"`
	LastTransitionTime time.Time `json:"lastTransitionTime"`
}

Condition represents a status condition

type Resource

type Resource struct {
	Type       ResourceType  `json:"type"`
	Name       string        `json:"name"`
	Namespace  string        `json:"namespace"`
	Ready      bool          `json:"ready"`
	Status     string        `json:"status"`
	Message    string        `json:"message"`
	Age        time.Duration `json:"age"`
	LastUpdate time.Time     `json:"last_update"`
	Conditions []Condition   `json:"conditions"`
	Suspended  bool          `json:"suspended"`
	Source     string        `json:"source,omitempty"`
	Path       string        `json:"path,omitempty"`
	Revision   string        `json:"revision,omitempty"`
	URL        string        `json:"url,omitempty"`
	Chart      string        `json:"chart,omitempty"`
	Version    string        `json:"version,omitempty"`
}

Resource represents a generic FluxCD resource

type ResourceType

type ResourceType string

ResourceType represents the type of FluxCD resource

const (
	ResourceTypeGitRepository  ResourceType = "GitRepository"
	ResourceTypeHelmRepository ResourceType = "HelmRepository"
	ResourceTypeKustomization  ResourceType = "Kustomization"
	ResourceTypeHelmRelease    ResourceType = "HelmRelease"
)

Jump to

Keyboard shortcuts

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