Documentation ¶
Index ¶
- Constants
- Variables
- func APIResourcesToStrings(resources []kube.APIResourceInfo, includeKinds bool) []string
- func AppInstanceName(appName, appNs, defaultNs string) string
- func AppInstanceNameFromQualified(name string, defaultNs string) string
- func AugmentSyncMsg(res common.ResourceSyncResult, ...) (string, error)
- func ContainsSyncResource(name string, namespace string, gvk schema.GroupVersionKind, ...) bool
- func ErrProjectNotPermitted(appName, appNamespace, projName string) error
- func FilterAppSetsByProjects(appsets []argoappv1.ApplicationSet, projects []string) []argoappv1.ApplicationSet
- func FilterByCluster(apps []argoappv1.Application, cluster string) []argoappv1.Application
- func FilterByName(apps []argoappv1.Application, name string) ([]argoappv1.Application, error)
- func FilterByNameP(apps []*argoappv1.Application, name string) []*argoappv1.Application
- func FilterByProjects(apps []argoappv1.Application, projects []string) []argoappv1.Application
- func FilterByProjectsP(apps []*argoappv1.Application, projects []string) []*argoappv1.Application
- func FilterByRepo(apps []argoappv1.Application, repo string) []argoappv1.Application
- func FilterByRepoP(apps []*argoappv1.Application, repo string) []*argoappv1.Application
- func FormatAppConditions(conditions []argoappv1.ApplicationCondition) string
- func GenerateSpecIsDifferentErrorMessage(entity string, a, b interface{}) string
- func GetAppProject(app *argoappv1.Application, projLister applicationsv1.AppProjectLister, ...) (*argoappv1.AppProject, error)
- func GetAppProjectByName(name string, projLister applicationsv1.AppProjectLister, ns string, ...) (*argoappv1.AppProject, error)
- func GetAppProjectWithScopedResources(name string, projLister applicationsv1.AppProjectLister, ns string, ...) (*argoappv1.AppProject, argoappv1.Repositories, []*argoappv1.Cluster, error)
- func GetAppVirtualProject(proj *argoappv1.AppProject, projLister applicationsv1.AppProjectLister, ...) (*argoappv1.AppProject, error)
- func GetDifferentPathsBetweenStructs(a, b interface{}) ([]string, error)
- func GetGlobalProjects(proj *argoappv1.AppProject, projLister applicationsv1.AppProjectLister, ...) []*argoappv1.AppProject
- func GetPermittedRepos(proj *argoappv1.AppProject, repos []*argoappv1.Repository) ([]*argoappv1.Repository, error)
- func GetPermittedReposCredentials(proj *argoappv1.AppProject, repoCreds []*argoappv1.RepoCreds) ([]*argoappv1.RepoCreds, error)
- func GetRefSources(ctx context.Context, spec argoappv1.ApplicationSpec, db db.ArgoDB) (argoappv1.RefTargetRevisionMapping, error)
- func GetTrackingMethod(settingsMgr *settings.SettingsManager) v1alpha1.TrackingMethod
- func IncludeResource(resourceName string, resourceNamespace string, gvk schema.GroupVersionKind, ...) bool
- func IsOldTrackingMethod(trackingMethod string) bool
- func IsValidAppName(name string) bool
- func IsValidContainerName(name string) bool
- func IsValidNamespaceName(name string) bool
- func IsValidPodName(name string) bool
- func IsValidProjectName(name string) bool
- func NormalizeApplicationSpec(spec *argoappv1.ApplicationSpec) *argoappv1.ApplicationSpec
- func NormalizeSource(source *argoappv1.ApplicationSource) *argoappv1.ApplicationSource
- func ParseAppInstanceName(appName string, defaultNs string) (string, string)
- func ParseAppQualifiedName(appName string, defaultNs string) (string, string)
- func RefreshApp(appIf v1alpha1.ApplicationInterface, name string, ...) (*argoappv1.Application, error)
- func SetAppOperation(appIf v1alpha1.ApplicationInterface, appName string, op *argoappv1.Operation) (*argoappv1.Application, error)
- func TestRepoWithKnownType(ctx context.Context, repoClient apiclient.RepoServerServiceClient, ...) error
- func ValidateDestination(ctx context.Context, dest *argoappv1.ApplicationDestination, db db.ArgoDB) error
- func ValidatePermissions(ctx context.Context, spec *argoappv1.ApplicationSpec, ...) ([]argoappv1.ApplicationCondition, error)
- func ValidateRepo(ctx context.Context, app *argoappv1.Application, ...) ([]argoappv1.ApplicationCondition, error)
- type AppInstanceValue
- type AuditLogger
- func (l *AuditLogger) LogAppEvent(app *v1alpha1.Application, info EventInfo, message, user string)
- func (l *AuditLogger) LogAppProjEvent(proj *v1alpha1.AppProject, info EventInfo, message, user string)
- func (l *AuditLogger) LogAppSetEvent(app *v1alpha1.ApplicationSet, info EventInfo, message, user string)
- func (l *AuditLogger) LogResourceEvent(res *v1alpha1.ResourceNode, info EventInfo, message, user string)
- type EventInfo
- type ObjectRef
- type ResourceTracking
Constants ¶
const ( EventReasonStatusRefreshed = "StatusRefreshed" EventReasonResourceCreated = "ResourceCreated" EventReasonResourceUpdated = "ResourceUpdated" EventReasonResourceDeleted = "ResourceDeleted" EventReasonResourceActionRan = "ResourceActionRan" EventReasonOperationStarted = "OperationStarted" EventReasonOperationCompleted = "OperationCompleted" )
const ( TrackingMethodAnnotation v1alpha1.TrackingMethod = "annotation" TrackingMethodLabel v1alpha1.TrackingMethod = "label" TrackingMethodAnnotationAndLabel v1alpha1.TrackingMethod = "annotation+label" )
Variables ¶
var LabelMaxLength = 63
var WrongResourceTrackingFormat = fmt.Errorf("wrong resource tracking format, should be <application-name>:<group>/<kind>:<namespace>/<name>")
Functions ¶
func APIResourcesToStrings ¶ added in v2.2.0
func APIResourcesToStrings(resources []kube.APIResourceInfo, includeKinds bool) []string
APIResourcesToStrings converts list of API Resources list into string list
func AppInstanceName ¶ added in v2.5.0
AppInstanceName returns the value to be used for app instance labels from the combination of appName, appNs and defaultNs.
func AppInstanceNameFromQualified ¶ added in v2.5.0
AppInstanceNameFromQualified returns the value to be used for app
func AugmentSyncMsg ¶ added in v2.7.0
func AugmentSyncMsg(res common.ResourceSyncResult, apiResourceInfoGetter func() ([]kube.APIResourceInfo, error)) (string, error)
AugmentSyncMsg enrich the K8s message with user-relevant information
func ContainsSyncResource ¶
func ContainsSyncResource(name string, namespace string, gvk schema.GroupVersionKind, rr []argoappv1.SyncOperationResource) bool
ContainsSyncResource determines if the given resource exists in the provided slice of sync operation resources.
func ErrProjectNotPermitted ¶ added in v2.5.0
ErrProjectNotPermitted returns an error to indicate that an application identified by appName and appNamespace is not allowed to use the project identified by projName.
func FilterAppSetsByProjects ¶ added in v2.5.0
func FilterAppSetsByProjects(appsets []argoappv1.ApplicationSet, projects []string) []argoappv1.ApplicationSet
FilterAppSetsByProjects returns applications which belongs to the specified project
func FilterByCluster ¶ added in v2.5.0
func FilterByCluster(apps []argoappv1.Application, cluster string) []argoappv1.Application
FilterByCluster returns an application
func FilterByName ¶
func FilterByName(apps []argoappv1.Application, name string) ([]argoappv1.Application, error)
FilterByName returns an application
func FilterByNameP ¶ added in v2.7.0
func FilterByNameP(apps []*argoappv1.Application, name string) []*argoappv1.Application
FilterByNameP returns pointer applications This function is for the changes in #12985.
func FilterByProjects ¶
func FilterByProjects(apps []argoappv1.Application, projects []string) []argoappv1.Application
FilterByProjects returns applications which belongs to the specified project
func FilterByProjectsP ¶ added in v2.7.0
func FilterByProjectsP(apps []*argoappv1.Application, projects []string) []*argoappv1.Application
FilterByProjectsP returns application pointers which belongs to the specified project
func FilterByRepo ¶
func FilterByRepo(apps []argoappv1.Application, repo string) []argoappv1.Application
FilterByRepo returns an application
func FilterByRepoP ¶ added in v2.7.0
func FilterByRepoP(apps []*argoappv1.Application, repo string) []*argoappv1.Application
FilterByRepoP returns application pointers
func FormatAppConditions ¶
func FormatAppConditions(conditions []argoappv1.ApplicationCondition) string
FormatAppConditions returns string representation of give app condition list
func GenerateSpecIsDifferentErrorMessage ¶ added in v2.2.0
func GetAppProject ¶
func GetAppProject(app *argoappv1.Application, projLister applicationsv1.AppProjectLister, ns string, settingsManager *settings.SettingsManager, db db.ArgoDB, ctx context.Context) (*argoappv1.AppProject, error)
GetAppProject returns a project from an application. It will also ensure that the application is allowed to use the project.
func GetAppProjectByName ¶ added in v2.2.0
func GetAppProjectByName(name string, projLister applicationsv1.AppProjectLister, ns string, settingsManager *settings.SettingsManager, db db.ArgoDB, ctx context.Context) (*argoappv1.AppProject, error)
GetAppProjectByName returns a project from an application based on name
func GetAppProjectWithScopedResources ¶ added in v2.2.0
func GetAppProjectWithScopedResources(name string, projLister applicationsv1.AppProjectLister, ns string, settingsManager *settings.SettingsManager, db db.ArgoDB, ctx context.Context) (*argoappv1.AppProject, argoappv1.Repositories, []*argoappv1.Cluster, error)
GetAppProjectWithScopedResources returns a project from an application with scoped resources
func GetAppVirtualProject ¶
func GetAppVirtualProject(proj *argoappv1.AppProject, projLister applicationsv1.AppProjectLister, settingsManager *settings.SettingsManager) (*argoappv1.AppProject, error)
func GetDifferentPathsBetweenStructs ¶ added in v2.2.0
func GetGlobalProjects ¶
func GetGlobalProjects(proj *argoappv1.AppProject, projLister applicationsv1.AppProjectLister, settingsManager *settings.SettingsManager) []*argoappv1.AppProject
func GetPermittedRepos ¶ added in v2.1.0
func GetPermittedRepos(proj *argoappv1.AppProject, repos []*argoappv1.Repository) ([]*argoappv1.Repository, error)
func GetPermittedReposCredentials ¶ added in v2.1.0
func GetRefSources ¶ added in v2.6.0
func GetRefSources(ctx context.Context, spec argoappv1.ApplicationSpec, db db.ArgoDB) (argoappv1.RefTargetRevisionMapping, error)
GetRefSources creates a map of ref keys (from the sources' 'ref' fields) to information about the referenced source. This function also validates the references use allowed characters and does not define the same ref key more than once (which would lead to ambiguous references).
func GetTrackingMethod ¶ added in v2.2.0
func GetTrackingMethod(settingsMgr *settings.SettingsManager) v1alpha1.TrackingMethod
GetTrackingMethod retrieve tracking method from settings
func IncludeResource ¶ added in v2.7.0
func IncludeResource(resourceName string, resourceNamespace string, gvk schema.GroupVersionKind, syncOperationResources []*argoappv1.SyncOperationResource) bool
IncludeResource checks if an app resource matches atleast one of the filters, then it returns true.
func IsOldTrackingMethod ¶ added in v2.2.0
func IsValidAppName ¶ added in v2.7.0
IsValidAppName checks if the name can be used as application name
func IsValidContainerName ¶ added in v2.7.0
IsValidContainerName checks that a containerName is valid
func IsValidNamespaceName ¶ added in v2.7.0
IsValidNamespaceName checks that a namespace name is valid
func IsValidPodName ¶ added in v2.7.0
IsValidPodName checks that a podName is valid
func IsValidProjectName ¶ added in v2.7.0
IsValidProjectName checks if the name can be used as project name
func NormalizeApplicationSpec ¶
func NormalizeApplicationSpec(spec *argoappv1.ApplicationSpec) *argoappv1.ApplicationSpec
NormalizeApplicationSpec will normalize an application spec to a preferred state. This is used for migrating application objects which are using deprecated legacy fields into the new fields, and defaulting fields in the spec (e.g. spec.project)
func NormalizeSource ¶ added in v2.6.0
func NormalizeSource(source *argoappv1.ApplicationSource) *argoappv1.ApplicationSource
func ParseAppInstanceName ¶ added in v2.5.0
ParseAppInstanceName parses a namespaced name in the format namespace_name and returns the components. If name wasn't namespaced, defaultNs will be returned as namespace component.
func ParseAppQualifiedName ¶ added in v2.5.0
ParseAppNamespacedName parses a namespaced name in the format namespace/name and returns the components. If name wasn't namespaced, defaultNs will be returned as namespace component.
func RefreshApp ¶
func RefreshApp(appIf v1alpha1.ApplicationInterface, name string, refreshType argoappv1.RefreshType) (*argoappv1.Application, error)
RefreshApp updates the refresh annotation of an application to coerce the controller to process it
func SetAppOperation ¶
func SetAppOperation(appIf v1alpha1.ApplicationInterface, appName string, op *argoappv1.Operation) (*argoappv1.Application, error)
SetAppOperation updates an application with the specified operation, retrying conflict errors
func TestRepoWithKnownType ¶
func TestRepoWithKnownType(ctx context.Context, repoClient apiclient.RepoServerServiceClient, repo *argoappv1.Repository, isHelm bool, isHelmOci bool) error
func ValidateDestination ¶
func ValidateDestination(ctx context.Context, dest *argoappv1.ApplicationDestination, db db.ArgoDB) error
ValidateDestination sets the 'Server' value of the ApplicationDestination, if it is not set. NOTE: this function WILL write to the object pointed to by the 'dest' parameter.
If an ApplicationDestination has a Name field, but has an empty Server (URL) field, ValidationDestination will look up the cluster by name (to get the server URL), and set the corresponding Server field value.
It also checks: - If we used both name and server then we return an invalid spec error
func ValidatePermissions ¶
func ValidatePermissions(ctx context.Context, spec *argoappv1.ApplicationSpec, proj *argoappv1.AppProject, db db.ArgoDB) ([]argoappv1.ApplicationCondition, error)
ValidatePermissions ensures that the referenced cluster has been added to Argo CD and the app source repo and destination namespace/cluster are permitted in app project
func ValidateRepo ¶
func ValidateRepo( ctx context.Context, app *argoappv1.Application, repoClientset apiclient.Clientset, db db.ArgoDB, plugins []*argoappv1.ConfigManagementPlugin, kubectl kube.Kubectl, proj *argoappv1.AppProject, settingsMgr *settings.SettingsManager, ) ([]argoappv1.ApplicationCondition, error)
ValidateRepo validates the repository specified in application spec. Following is checked: * the repository is accessible * the path contains valid manifests * there are parameters of only one app source type
Types ¶
type AppInstanceValue ¶ added in v2.2.0
type AppInstanceValue struct { ApplicationName string Group string Kind string Namespace string Name string }
AppInstanceValue store information about resource tracking info
func UnstructuredToAppInstanceValue ¶ added in v2.4.17
func UnstructuredToAppInstanceValue(un *unstructured.Unstructured, appName, namespace string) AppInstanceValue
UnstructuredToAppInstanceValue will build the AppInstanceValue based on the provided unstructured. The given namespace works as a default value if the resource's namespace is not defined. It should be the Application's target destination namespace.
type AuditLogger ¶
type AuditLogger struct {
// contains filtered or unexported fields
}
func NewAuditLogger ¶
func NewAuditLogger(ns string, kIf kubernetes.Interface, component string) *AuditLogger
func (*AuditLogger) LogAppEvent ¶
func (l *AuditLogger) LogAppEvent(app *v1alpha1.Application, info EventInfo, message, user string)
func (*AuditLogger) LogAppProjEvent ¶
func (l *AuditLogger) LogAppProjEvent(proj *v1alpha1.AppProject, info EventInfo, message, user string)
func (*AuditLogger) LogAppSetEvent ¶ added in v2.5.0
func (l *AuditLogger) LogAppSetEvent(app *v1alpha1.ApplicationSet, info EventInfo, message, user string)
func (*AuditLogger) LogResourceEvent ¶
func (l *AuditLogger) LogResourceEvent(res *v1alpha1.ResourceNode, info EventInfo, message, user string)
type ResourceTracking ¶ added in v2.2.0
type ResourceTracking interface { GetAppName(un *unstructured.Unstructured, key string, trackingMethod v1alpha1.TrackingMethod) string GetAppInstance(un *unstructured.Unstructured, key string, trackingMethod v1alpha1.TrackingMethod) *AppInstanceValue SetAppInstance(un *unstructured.Unstructured, key, val, namespace string, trackingMethod v1alpha1.TrackingMethod) error BuildAppInstanceValue(value AppInstanceValue) string ParseAppInstanceValue(value string) (*AppInstanceValue, error) Normalize(config, live *unstructured.Unstructured, labelKey, trackingMethod string) error }
ResourceTracking defines methods which allow setup and retrieve tracking information to resource
func NewResourceTracking ¶ added in v2.2.0
func NewResourceTracking() ResourceTracking
Directories ¶
Path | Synopsis |
---|---|
Code generated by github.com/argoproj/argo-cd/hack/known_types.
|
Code generated by github.com/argoproj/argo-cd/hack/known_types. |