application

package
v0.0.0-...-ab50414 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const LastUpdatedLabel = "argocd-agent.argoproj.io/last-updated"

LastUpdatedLabel is a label put on applications which contains the time when an update was last received for this Application

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationManager

type ApplicationManager struct {
	AllowUpsert bool
	Application backend.Application
	Metrics     *metrics.ApplicationClientMetrics
	Role        manager.ManagerRole
	Mode        manager.ManagerMode
	Namespace   string
	// contains filtered or unexported fields
}

ApplicationManager manages Argo CD application resources on a given backend.

It provides primitives to create, update, upsert and delete applications.

func NewApplicationManager

func NewApplicationManager(be backend.Application, namespace string, opts ...ApplicationManagerOption) *ApplicationManager

NewApplicationManager initializes and returns a new Manager with the given backend and options.

func (*ApplicationManager) ClearIgnored

func (m *ApplicationManager) ClearIgnored()

func (*ApplicationManager) ClearManaged

func (m *ApplicationManager) ClearManaged()

ClearManaged clears the managed apps

func (*ApplicationManager) Create

Create creates the application app using the Manager's application backend.

func (*ApplicationManager) IgnoreChange

func (m *ApplicationManager) IgnoreChange(appName string, version string) error

IgnoreChange adds a particular version for the application named appName to list of changes to ignore.

func (*ApplicationManager) IsChangeIgnored

func (m *ApplicationManager) IsChangeIgnored(appName string, version string) bool

IsChangeIgnored returns true if the version for appName is already being ignored.

func (*ApplicationManager) IsManaged

func (m *ApplicationManager) IsManaged(appName string) bool

IsManaged returns whether the app appName is currently managed by this agent

func (*ApplicationManager) Manage

func (m *ApplicationManager) Manage(appName string) error

Manage marks the app appName as being managed by this agent

func (*ApplicationManager) UnignoreChange

func (m *ApplicationManager) UnignoreChange(appName string) error

func (*ApplicationManager) Unmanage

func (m *ApplicationManager) Unmanage(appName string) error

Unmanage marks the app appName as not being managed by this agent

func (*ApplicationManager) UpdateAutonomousApp

func (m *ApplicationManager) UpdateAutonomousApp(ctx context.Context, namespace string, incoming *v1alpha1.Application) (*v1alpha1.Application, error)

UpdateAutonomousApp updates the Application resource on the control plane side when the agent is in autonomous mode. It will update changes to .spec and .status fields along with syncing labels and annotations.

Additionally, it will remove any .operation field from the incoming resource before the resource is being updated on the control plane.

This method is usually only executed by the control plane for updates that are received by agents in autonomous mode.

func (*ApplicationManager) UpdateManagedApp

func (m *ApplicationManager) UpdateManagedApp(ctx context.Context, incoming *v1alpha1.Application) (*v1alpha1.Application, error)

UpdateManagedApp updates the Application resource on the agent when it is in managed mode.

The app on the agent will inherit labels and annotations as well as the spec and any operation field of the incoming application. A possibly existing refresh annotation on the agent's app will be retained, because it will be removed by the agent's application controller.

func (*ApplicationManager) UpdateOperation

func (m *ApplicationManager) UpdateOperation(ctx context.Context, incoming *v1alpha1.Application) (*v1alpha1.Application, error)

UpdateOperation is used to update the .operation field of the application resource to initiate a sync. Additionally, any labels and annotations that are used to trigger an action (such as, refresh) will be set on the target resource.

This method is usually executed only by an agent in autonomous mode, because it has the leading version of the resource and we are not supposed to change its Application manifests.

func (*ApplicationManager) UpdateStatus

func (m *ApplicationManager) UpdateStatus(ctx context.Context, namespace string, incoming *v1alpha1.Application) (*v1alpha1.Application, error)

UpdateStatus updates the application on the server for updates sent by an agent that operates in managed mode.

The app on the server will inherit the status field of the incoming app. Additionally, if a refresh annotation exists on the app on the app of the server, but not in the incoming app, the annotation will be removed. Any operation field on the existing resource will be removed as well.

type ApplicationManagerOption

type ApplicationManagerOption func(*ApplicationManager)

ApplicationManagerOption is a callback function to set an option to the Application manager

func WithAllowUpsert

func WithAllowUpsert(upsert bool) ApplicationManagerOption

WithAllowUpsert sets the upsert operations allowed flag

func WithMetrics

WithMetrics sets the metrics provider for the Manager

func WithMode

WithMode sets the mode of the Application manager

func WithRole

WithRole sets the role of the Application manager

Jump to

Keyboard shortcuts

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