cluster

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package cluster implements various functions for working with Argo CD cluster configuration.

Its main component is the cluster manager Manager, which essentially manages Argo CD cluster secrets and maps them to agents.

Index

Constants

View Source
const LabelKeyClusterAgentMapping = "argocd-agent.argoproj-labs.io/agent-name"
View Source
const LabelValueManagerName = "argocd-agent"

Variables

View Source
var ErrAlreadyMapped = errors.New("agent already mapped")

ErrAlreadyMapped indicates that an agent has a cluster mapped to it already

View Source
var ErrNotMapped = errors.New("agent not mapped")

ErrNotMapped indicates that an agent has no cluster mapped to it

Functions

func ClusterToSecret

func ClusterToSecret(c *v1alpha1.Cluster, secret *v1.Secret) error

ClusterToSecret converts a cluster object to string data for serialization to a secret

Types

type Manager

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

Manager manages Argo CD cluster secrets on the principal

func NewManager

func NewManager(ctx context.Context, namespace, redisAddress string, redisCompressionType cacheutil.RedisCompressionType, kubeclient kubernetes.Interface) (*Manager, error)

NewManager instantiates and initializes a new Manager.

func (*Manager) HasMapping

func (m *Manager) HasMapping(agent string) bool

HasMapping returns true when the manager has a cluster mapping for an agent with the given name.

func (*Manager) MapCluster

func (m *Manager) MapCluster(agent string, cluster *v1alpha1.Cluster) error

MapCluster maps the given cluster to the agent with the given name. It may return an error if the agent has a cluster mapped to it already.

func (*Manager) Mapping

func (m *Manager) Mapping(agent string) *v1alpha1.Cluster

Mapping returns the cluster mapping for an agent with the given name. If the agent has no cluster mapped to it, Mapping returns nil.

func (*Manager) Start

func (m *Manager) Start() error

Start starts the manager m and its informer. Start waits for the informer to be synced before returning. If the informer could not sync before the timeout expires, Start will return an error.

func (*Manager) Stop

func (m *Manager) Stop() error

func (*Manager) UnmapCluster

func (m *Manager) UnmapCluster(agent string) error

UnmapCluster removes the mapping for an agent with the given name. If there is no mapping for the agent, UnmapCluster will return an error.

func (*Manager) UpdateClusterConnectionInfo

func (m *Manager) UpdateClusterConnectionInfo(agentName, status string, t time.Time)

UpdateClusterConnectionInfo updates cluster info with connection state and time in mapped cluster

Jump to

Keyboard shortcuts

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