controller

package
v1.8.9 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 90 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvClusterInfoTimeout = "CD_UPDATE_CLUSTER_INFO_TIMEOUT"
)
View Source
const (
	// EnvVarSyncWaveDelay is an environment variable which controls the delay in seconds between
	// each sync-wave
	EnvVarSyncWaveDelay = "CD_SYNC_WAVE_DELAY"
)

Variables

View Source
var ErrCompareStateRepo = errors.New("failed to get repo objects")

Functions

func FilterObjectsForDeletion added in v1.8.8

func FilterObjectsForDeletion(objs []*unstructured.Unstructured) []*unstructured.Unstructured

func NewClusterInfoUpdater added in v1.8.8

func NewClusterInfoUpdater(
	infoSource metrics.HasClustersInfo,
	db db.DB,
	appLister v1alpha1.ApplicationNamespaceLister,
	cache *appstatecache.Cache,
	clusterFilter func(cluster *appv1.Cluster) bool,
	projGetter func(app *appv1.Application) (*appv1.AppProject, error),
	namespace string,
) *clusterInfoUpdater

func NewOperationState added in v1.8.8

func NewOperationState(operation v1alpha1.Operation) *v1alpha1.OperationState

func NormalizeTargetObjects added in v1.8.8

func NormalizeTargetObjects(namespace string, objs []*unstructured.Unstructured, infoProvider kubeutil.ResourceInfoProvider, setAppInstance func(*unstructured.Unstructured) error) ([]*unstructured.Unstructured, []v1alpha1.ApplicationCondition, error)

Types

type AppStateManager added in v0.4.0

type AppStateManager interface {
	CompareAppState(ctx context.Context, app *v1alpha1.Application, project *v1alpha1.AppProject, revisions []string, sources []v1alpha1.ApplicationSource, noCache bool, noRevisionCache bool, localObjects []string, hasMultipleSources bool) (*comparisonResult, error)
	SyncAppState(ctx context.Context, app *v1alpha1.Application, project *v1alpha1.AppProject, state *v1alpha1.OperationState)
	EvaluateAppRevisionsChanges(ctx context.Context, app *v1alpha1.Application, sources []v1alpha1.ApplicationSource, revisions []string, proj *v1alpha1.AppProject, sendRuntimeState bool, noRevisionCache bool) (bool, []string, error)
	GetRepoObjs(ctx context.Context, app *v1alpha1.Application, sources []v1alpha1.ApplicationSource, appLabelKey string, revisions []string, noCache, noRevisionCache bool, sourceIntegrity *v1alpha1.SourceIntegrity, proj *v1alpha1.AppProject, sendRuntimeState bool) ([]*unstructured.Unstructured, []*apiclient.ManifestResponse, bool, error)
}

AppStateManager defines methods which allow to compare application spec and actual application state.

func NewAppStateManager added in v0.4.0

func NewAppStateManager(
	db db.DB,
	appclientset appclientset.Interface,
	repoClientset apiclient.Clientset,
	namespace string,
	kubectl kubeutil.Kubectl,
	onKubectlRun kubeutil.OnKubectlRunFunc,
	settingsMgr *settings.SettingsManager,
	liveStateCache statecache.LiveStateCache,
	metricsServer *metrics.MetricsServer,
	cache *appstatecache.Cache,
	statusRefreshTimeout time.Duration,
	resourceTracking cd.ResourceTracking,
	persistResourceHealth bool,
	repoErrorGracePeriod time.Duration,
	serverSideDiff bool,
	ignoreNormalizerOpts normalizers.IgnoreNormalizerOpts,
) AppStateManager

NewAppStateManager creates new instance of AppStateManager

type ApplicationController

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

ApplicationController is the controller for application resources.

func NewApplicationController

func NewApplicationController(
	namespace string,
	settingsMgr *settings_util.SettingsManager,
	kubeClientset kubernetes.Interface,
	applicationClientset appclientset.Interface,
	repoClientset apiclient.Clientset,
	commitClientset commitclient.Clientset,
	appStateCache *appstatecache.Cache,
	kubectl kube.Kubectl,
	appResyncPeriod time.Duration,
	appHardResyncPeriod time.Duration,
	appResyncJitter time.Duration,
	selfHealTimeout time.Duration,
	selfHealBackoff *wait.Backoff,
	syncTimeout time.Duration,
	repoErrorGracePeriod time.Duration,
	metricsPort int,
	metricsCacheExpiration time.Duration,
	metricsApplicationLabels []string,
	metricsApplicationConditions []string,
	metricsClusterLabels []string,
	kubectlParallelismLimit int64,
	persistResourceHealth bool,
	clusterSharding sharding.ClusterShardingCache,
	applicationNamespaces []string,
	rateLimiterConfig *ratelimiter.AppControllerRateLimiterConfig,
	serverSideDiff bool,
	dynamicClusterDistributionEnabled bool,
	ignoreNormalizerOpts normalizers.IgnoreNormalizerOpts,
	enableK8sEvent []string,
	hydratorEnabled bool,
) (*ApplicationController, error)

NewApplicationController creates new instance of ApplicationController.

func (*ApplicationController) AddHydrationQueueItem added in v1.8.8

func (ctrl *ApplicationController) AddHydrationQueueItem(key types.HydrationQueueKey)

func (*ApplicationController) EvaluateAppRevisionsChanges added in v1.8.8

func (ctrl *ApplicationController) EvaluateAppRevisionsChanges(ctx context.Context, app *appv1.Application, source appv1.ApplicationSource, revision string, project *appv1.AppProject, noRevisionCache bool) (bool, string, error)

func (*ApplicationController) GetCommitAuthorEmail added in v1.8.8

func (ctrl *ApplicationController) GetCommitAuthorEmail() (string, error)

func (*ApplicationController) GetCommitAuthorName added in v1.8.8

func (ctrl *ApplicationController) GetCommitAuthorName() (string, error)

func (*ApplicationController) GetHydratorCommitMessageTemplate added in v1.8.8

func (ctrl *ApplicationController) GetHydratorCommitMessageTemplate() (string, error)

func (*ApplicationController) GetHydratorReadmeMessageTemplate added in v1.8.8

func (ctrl *ApplicationController) GetHydratorReadmeMessageTemplate() (string, error)

func (*ApplicationController) GetMetricsServer added in v1.5.3

func (ctrl *ApplicationController) GetMetricsServer() *metrics.MetricsServer

func (*ApplicationController) GetProcessableAppProj added in v1.8.8

func (ctrl *ApplicationController) GetProcessableAppProj(app *appv1.Application) (*appv1.AppProject, error)

func (*ApplicationController) GetProcessableApps added in v1.8.8

func (ctrl *ApplicationController) GetProcessableApps() (*appv1.ApplicationList, error)

GetProcessableApps returns a list of applications that are processable by the controller.

func (*ApplicationController) GetRepoObjs added in v1.8.8

func (*ApplicationController) GetWriteCredentials added in v1.8.8

func (ctrl *ApplicationController) GetWriteCredentials(ctx context.Context, repoURL string, project string) (*appv1.Repository, error)

func (*ApplicationController) InvalidateProjectsCache added in v1.8.8

func (ctrl *ApplicationController) InvalidateProjectsCache(names ...string)

func (*ApplicationController) PatchAppWithWriteBack added in v1.8.8

func (ctrl *ApplicationController) PatchAppWithWriteBack(ctx context.Context, name, ns string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appv1.Application, err error)

PatchAppWithWriteBack patches an application and writes it back to the informer cache

func (*ApplicationController) PersistHydrationStatus added in v1.8.8

func (ctrl *ApplicationController) PersistHydrationStatus(orig *appv1.Application, newStatus *appv1.SourceHydratorStatus)

func (*ApplicationController) RegisterClusterSecretUpdater added in v1.8.8

func (ctrl *ApplicationController) RegisterClusterSecretUpdater(ctx context.Context)

func (*ApplicationController) RequestAppRefresh added in v1.8.8

func (ctrl *ApplicationController) RequestAppRefresh(appName string, appNamespace string) error

func (*ApplicationController) Run

func (ctrl *ApplicationController) Run(ctx context.Context, statusProcessors int, operationProcessors int, hydrationProcessors int)

type ClusterFilterFunction added in v1.8.8

type ClusterFilterFunction func(c *appv1.Cluster, distributionFunction sharding.DistributionFunction) bool

type CompareWith added in v1.1.0

type CompareWith int
const (
	// Compare live application state against state defined in latest git revision with no resolved revision caching.
	CompareWithLatestForceResolve CompareWith = 3
	// Compare live application state against state defined in latest git revision.
	CompareWithLatest CompareWith = 2
	// Compare live application state against state defined using revision of most recent comparison.
	CompareWithRecent CompareWith = 1
	// Skip comparison and only refresh application resources tree
	ComparisonWithNothing CompareWith = 0
)

func (CompareWith) Max added in v1.1.0

func (CompareWith) Pointer added in v1.4.0

func (a CompareWith) Pointer() *CompareWith

type HookType added in v1.8.8

type HookType string
const (
	PreDeleteHookType  HookType = "PreDelete"
	PostDeleteHookType HookType = "PostDelete"
)

Directories

Path Synopsis
consistent
An implementation of Consistent Hashing and Consistent Hashing With Bounded Loads.
An implementation of Consistent Hashing and Consistent Hashing With Bounded Loads.

Jump to

Keyboard shortcuts

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