Help us shape the future of Go! Take the 2026 Go Developer Survey

argocd

package
v0.0.0-...-0ebdf97 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 83 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationSetGitlabSCMTlsCertPath  = "/app/tls/scm/cert"
	ApplicationSetGitlabSCMTlsMountPath = "/app/tls/scm/"
)
View Source
const (
	DefaultImageUpdaterImage      = "quay.io/argoprojlabs/argocd-image-updater"
	DefaultImageUpdaterTag        = "v1.4.0"
	ArgocdImageUpdaterConfigCM    = "argocd-image-updater-config"
	ArgocdImageUpdaterSSHConfigCM = "argocd-image-updater-ssh-config"
	ArgocdImageUpdaterSecret      = "argocd-image-updater-secret" // #nosec G101

)
View Source
const (
	// RedisIngressNetworkPolicy is the name of the network policy which controls Redis Ingress traffic
	RedisNetworkPolicy = "redis-network-policy"
	// RedisHAIngressNetworkPolicy is the name of the network policy which controls Redis HA Ingress traffic
	RedisHANetworkPolicy = "redis-ha-network-policy"
	// ArgoCDServerNetworkPolicy is the name of the network policy which controls Argo CD Server traffic
	ArgoCDServerNetworkPolicy = "server-network-policy"
	// ArgoCDApplicationControllerNetworkPolicy is the name of the network policy which controls Argo CD Application Controller traffic
	ArgoCDApplicationControllerNetworkPolicy = "application-controller-network-policy"
	// ArgoCDRepoServerNetworkPolicy is the name of the network policy which controls Argo CD Repo Server traffic
	ArgoCDRepoServerNetworkPolicy = "repo-server-network-policy"
	// ArgoCDCommitServerNetworkPolicy is the name of the network policy which controls Argo CD Commit Server traffic
	ArgoCDCommitServerNetworkPolicy = "commit-server-network-policy"
	// ArgoCDNotificationsControllerNetworkPolicy is the name of the network policy which controls Argo CD Notifications Controller traffic
	ArgoCDNotificationsControllerNetworkPolicy = "notifications-controller-network-policy"
	// ArgoCDDexServerNetworkPolicy is the name of the network policy which controls Argo CD Dex Server traffic
	ArgoCDDexServerNetworkPolicy = "dex-server-network-policy"
	// ArgoCDApplicationSetControllerNetworkPolicy is the name of the network policy which controls Argo CD ApplicationSet Controller traffic
	ArgoCDApplicationSetControllerNetworkPolicy = "applicationset-controller-network-policy"
	// ImageUpdaterNetworkPolicy is the name of the network policy which controls Image Updater traffic
	ImageUpdaterNetworkPolicy = "image-updater-network-policy"
)
View Source
const (
	DefaultNotificationsConfigurationInstanceName = "default-notifications-configuration"
)

Variables

View Source
var (
	ActiveInstancesByPhase = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "active_argocd_instances_by_phase",
			Help: "Number of active argocd instances by phase",
		},
		[]string{"phase"},
	)

	ActiveInstancesTotal = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "active_argocd_instances_total",
			Help: "Total number of active argocd instances",
		},
	)

	ActiveInstanceReconciliationCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "active_argocd_instance_reconciliation_count",
			Help: "Number of reconciliations performed for a given instance",
		},
		[]string{"namespace"},
	)

	// ReconcileTime is a prometheus metric which keeps track of the duration
	// of reconciliations for a given instance
	ReconcileTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "controller_runtime_reconcile_time_seconds_per_instance",
		Help:    "Length of time per reconciliation per instance",
		Buckets: []float64{0.05, 0.075, 0.1, 0.15, 0.2, 0.22, 0.24, 0.26, 0.28, 0.3, 0.32, 0.34, 0.37, 0.4, 0.42, 0.44, 0.48, 0.5, 0.55, 0.6, 0.75, 0.9, 1.00},
	}, []string{"namespace"})
)
View Source
var ActiveInstanceMap = make(map[string]string)

Map to keep track of running Argo CD instances using their namespaces as key and phase as value This map will be used for the performance metrics purposes Important note: This assumes that each instance only contains one Argo CD instance as, having multiple Argo CD instances in the same namespace is considered an anti-pattern

View Source
var DeprecationEventEmissionTracker = make(map[string]DeprecationEventEmissionStatus)

DeprecationEventEmissionTracker map stores the namespace containing ArgoCD instance as key and DeprecationEventEmissionStatus as value, where DeprecationEventEmissionStatus tracks the events that have been emitted for the instance in the particular namespace. This is temporary and can be removed in v0.0.6 when we remove the deprecated fields.

View Source
var (
	TCPProtocol = func() *corev1.Protocol {
		tcpProtocol := corev1.ProtocolTCP
		return &tcpProtocol
	}()
)

Functions

func AddSeccompProfileForOpenShift

func AddSeccompProfileForOpenShift(client client.Client, podspec *corev1.PodSpec)

func BuildRedisArgsFromClusterTLSProfile

func BuildRedisArgsFromClusterTLSProfile(centralTLSConfig tlsProfile.TLSConfigProfile) []string

BuildRedisArgsFromClusterTLSProfile builds arguments for redis deployment based on central tls config.

func BuildTLSArgsFromClusterTLSProfile

func BuildTLSArgsFromClusterTLSProfile(centralTLSConfig tlsProfile.TLSConfigProfile) []string

BuildTLSArgsFromClusterTLSProfile builds the command line arguments for the ArgoCD components based on the cluster's TLS profile configuration.

func GenerateRandomBytes

func GenerateRandomBytes(n int) []byte

GenerateRandomBytes returns a securely generated random bytes.

func GenerateRandomString

func GenerateRandomString(s int) string

GenerateRandomString returns a securely generated random string.

func GenerateUniqueResourceName

func GenerateUniqueResourceName(argoComponentName string, cr *argoproj.ArgoCD) string

GenerateUniqueResourceName generates unique names for cluster scoped resources

func GetImageAndTag

func GetImageAndTag(envVar, containerSpecImage, containerSpecVersion, commonSpecImage, commonSpecVersion string) (string, string)

GetImageAndTag determines the image and tag for an ArgoCD component, considering container-level and common-level overrides. Priority order: containerSpec > commonSpec > environment variable > defaults Returns: image, tag

func InspectCluster

func InspectCluster() error

InspectCluster will verify the availability of extra features available to the cluster, such as Prometheus and OpenShift Routes.

func IsClusterTrustBundleAPIFound

func IsClusterTrustBundleAPIFound() bool

func IsExternalAuthenticationEnabledOnCluster

func IsExternalAuthenticationEnabledOnCluster(ctx context.Context, c client.Client) bool

func IsImageUpdaterAPIAvailable

func IsImageUpdaterAPIAvailable() bool

IsImageUpdaterAPIAvailable returns true if the image updater api is present

func IsOpenShiftCluster

func IsOpenShiftCluster() bool

func IsPrometheusAPIAvailable

func IsPrometheusAPIAvailable() bool

IsPrometheusAPIAvailable returns true if the Prometheus API is present.

func IsVersionAPIAvailable

func IsVersionAPIAvailable() bool

IsVersionAPIAvailable returns true if the version api is present

func Register

func Register(h ...Hook)

Register adds a modifier for updating resources during reconciliation.

func UseApplicationController

func UseApplicationController(name string, cr *argoproj.ArgoCD) bool

UseApplicationController determines whether Application Controller resources should be created and configured or not

func UseCommitServer

func UseCommitServer(cr *argoproj.ArgoCD) bool

UseCommitServer automagially decides if the commit server should be deployed based on acual use-cases using it. Currently, it is only used by the Source Hydrator.

func UseDex

func UseDex(cr *argoproj.ArgoCD) bool

UseDex determines whether Dex resources should be created and configured or not

func UseRedis

func UseRedis(name string, cr *argoproj.ArgoCD) bool

UseRedis determines whether Redis resources should be created and configured or not

func UseServer

func UseServer(name string, cr *argoproj.ArgoCD) bool

UseServer determines whether ArgoCD Server resources should be created and configured or not

func ZapLogger

func ZapLogger(development bool) logr.Logger

Types

type BuilderHook

type BuilderHook struct {
	client.Client
	*builder.Builder
}

BuilderHook can be used to modify the controller-runtime builder.

type DeprecationEventEmissionStatus

type DeprecationEventEmissionStatus struct {
	SSOSpecDeprecationWarningEmitted    bool
	DexSpecDeprecationWarningEmitted    bool
	DisableDexDeprecationWarningEmitted bool
	TLSInsecureWarningEmitted           bool
}

DeprecationEventEmissionStatus is meant to track which deprecation events have been emitted already. This is temporary and can be removed in v0.0.6 once we have provided enough deprecation notice

type DexConnector

type DexConnector struct {
	Config map[string]any `yaml:"config,omitempty"`
	ID     string         `yaml:"id"`
	Name   string         `yaml:"name"`
	Type   string         `yaml:"type"`
}

DexConnector represents an authentication connector for Dex.

type Hook

type Hook func(*argoproj.ArgoCD, any, string) error

Hook changes resources as they are created or updated by the reconciler.

type LocalUsersInfo

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

func NewLocalUsersInfo

func NewLocalUsersInfo() *LocalUsersInfo

type ReconcileArgoCD

type ReconcileArgoCD struct {
	client.Client
	Scheme            *runtime.Scheme
	ManagedNamespaces *corev1.NamespaceList
	// Stores a list of ApplicationSourceNamespaces as keys
	ManagedSourceNamespaces map[string]string

	// Stores a list of ApplicationSetSourceNamespaces as keys (value is not used)
	// - list of namespaces that currently have the 'common.ArgoCDApplicationSetManagedByClusterArgoCDLabel' label
	// - items in the list that are NOT mentioned in .spec.applicationset.sourceNamespaces will be cleaned up
	// - (or if ALL resources in the list will be cleaned up if ArgoCD instance in namespace-scoped)
	ManagedApplicationSetSourceNamespaces map[string]string

	// Stores a list of NotificationsSourceNamespaces as keys
	ManagedNotificationsSourceNamespaces map[string]string

	// Stores label selector used to reconcile a subset of ArgoCD
	LabelSelector string

	K8sClient  kubernetes.Interface
	LocalUsers *LocalUsersInfo
	// FipsConfigChecker checks if the deployment needs FIPS specific environment variables set.
	FipsConfigChecker argoutil.FipsConfigChecker

	// CentralTLSConfigProfile specifies the TLS configuration profile in the cluster.
	CentralTLSConfigProfile tlsProfile.TLSConfigProfile
	// contains filtered or unexported fields
}

ArgoCDReconciler reconciles a ArgoCD object TODO(upgrade): rename to ArgoCDRecoonciler

func (*ReconcileArgoCD) Reconcile

func (r *ReconcileArgoCD) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. the ArgoCD object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.9.2/pkg/reconcile

func (*ReconcileArgoCD) ReconcileApplicationSetControllerNetworkPolicy

func (r *ReconcileArgoCD) ReconcileApplicationSetControllerNetworkPolicy(cr *argoproj.ArgoCD) error

ReconcileApplicationSetControllerNetworkPolicy creates and reconciles network policy for ApplicationSet Controller This network policy allows ingress traffic to the applicationset controller from any namespace. Referenced from https://github.com/argoproj/argo-cd/blob/master/manifests/base/applicationset-controller/argocd-applicationset-controller-network-policy.yaml

func (*ReconcileArgoCD) ReconcileArgoCDApplicationControllerNetworkPolicy

func (r *ReconcileArgoCD) ReconcileArgoCDApplicationControllerNetworkPolicy(cr *argoproj.ArgoCD) error

ReconcileArgoCDApplicationControllerNetworkPolicy creates and reconciles network policy for Argo CD Application Controller This network policy allows ingress traffic to the application controller from any namespace. Referenced from https://github.com/argoproj/argo-cd/blob/master/manifests/base/application-controller/argocd-application-controller-network-policy.yaml

func (*ReconcileArgoCD) ReconcileArgoCDRepoServerNetworkPolicy

func (r *ReconcileArgoCD) ReconcileArgoCDRepoServerNetworkPolicy(cr *argoproj.ArgoCD) error

ReconcileArgoCDRepoServerNetworkPolicy creates and reconciles network policy for Argo CD Repo Server This network policy allows ingress traffic to the repo server from the application controller, server, notifications controller, applicationset controller, and any namespace. Referenced from https://github.com/argoproj/argo-cd/blob/master/manifests/base/repo-server/argocd-repo-server-network-policy.yaml

func (*ReconcileArgoCD) ReconcileArgoCDServerNetworkPolicy

func (r *ReconcileArgoCD) ReconcileArgoCDServerNetworkPolicy(cr *argoproj.ArgoCD) error

ReconcileArgoCDServerNetworkPolicy creates and reconciles network policy for Argo CD Server This network policy allows ingress traffic to the server from the application controller, repo server, notifications controller, applicationset controller, and any namespace. Referenced from https://github.com/argoproj/argo-cd/blob/master/manifests/base/server/argocd-server-network-policy.yaml

func (*ReconcileArgoCD) ReconcileDexServerNetworkPolicy

func (r *ReconcileArgoCD) ReconcileDexServerNetworkPolicy(cr *argoproj.ArgoCD) error

ReconcileDexServerNetworkPolicy creates and reconciles network policy for Dex Server This network policy allows ingress traffic to the dex server from the server and any namespace. Referenced from https://github.com/argoproj/argo-cd/blob/master/manifests/base/dex/argocd-dex-server-network-policy.yaml

func (*ReconcileArgoCD) ReconcileNetworkPolicies

func (r *ReconcileArgoCD) ReconcileNetworkPolicies(cr *argoproj.ArgoCD) error

func (*ReconcileArgoCD) ReconcileNotificationsControllerNetworkPolicy

func (r *ReconcileArgoCD) ReconcileNotificationsControllerNetworkPolicy(cr *argoproj.ArgoCD) error

ReconcileNotificationsControllerNetworkPolicy creates and reconciles network policy for Notifications Controller This network policy allows ingress traffic to the notifications controller from any namespace. Referenced from https://github.com/argoproj/argo-cd/blob/master/manifests/base/notifications-controller/argocd-notifications-controller-network-policy.yaml

func (*ReconcileArgoCD) ReconcileRedisHANetworkPolicy

func (r *ReconcileArgoCD) ReconcileRedisHANetworkPolicy(cr *argoproj.ArgoCD) error

ReconcileRedisHANetworkPolicy creates and reconciles network policy for Redis HA

func (*ReconcileArgoCD) ReconcileRedisNetworkPolicy

func (r *ReconcileArgoCD) ReconcileRedisNetworkPolicy(cr *argoproj.ArgoCD) error

ReconcileRedisNetworkPolicy creates and reconciles network policy for Redis

func (*ReconcileArgoCD) SetupWithManager

func (r *ReconcileArgoCD) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type SchemeOpt

type SchemeOpt func(*runtime.Scheme) error

Jump to

Keyboard shortcuts

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