Documentation
¶
Index ¶
- Constants
- func ApplicationsToString(apps []ArgoResource) string
- func ConvertAppSetsToAppsInBothBranches(argocd *argocd.ArgoCDInstallation, baseApps []ArgoResource, ...) ([]ArgoResource, []ArgoResource, error)
- func GetApplicationsForBranches(argocdNamespace string, baseBranch *types.Branch, targetBranch *types.Branch, ...) ([]ArgoResource, []ArgoResource, error)
- func WriteApplications(apps []ArgoResource, branch *types.Branch, folder string) error
- type ApplicationKind
- type ArgoResource
- func ConvertAppSetsToApps(argocd *argocd.ArgoCDInstallation, appSets []ArgoResource, ...) ([]ArgoResource, error)
- func FromK8sResource(resource *types.K8sResource) *ArgoResource
- func FromResourceToApplication(k8sResources []types.K8sResource, selector []types.Selector, ...) []ArgoResource
- func GetApplications(argocdNamespace string, branch *types.Branch, fileRegex *string, ...) ([]ArgoResource, error)
- func PatchApplication(argocdNamespace string, application ArgoResource, branch *types.Branch, ...) (*ArgoResource, error)
- func PatchApplications(argocdNamespace string, applications []ArgoResource, branch *types.Branch, ...) ([]ArgoResource, error)
- func UniqueNames(apps []ArgoResource, branch *types.Branch) []ArgoResource
- func (a *ArgoResource) AsString() (string, error)
- func (a *ArgoResource) Filter(selectors []types.Selector, filesChanged []string, ...) *ArgoResource
- func (a *ArgoResource) PointDestinationToInCluster() error
- func (a *ArgoResource) RedirectGenerators(repo, branch string, redirectRevisions []string) error
- func (a *ArgoResource) RedirectSources(repo, branch string, redirectRevisions []string) error
- func (a *ArgoResource) RemoveSyncPolicy() error
- func (a *ArgoResource) SetNamespace(namespace string) error
- func (a *ArgoResource) SetProjectToDefault() error
Constants ¶
const ( AnnotationWatchPattern = "argocd-diff-preview/watch-pattern" AnnotationIgnore = "argocd-diff-preview/ignore" )
Variables ¶
This section is empty.
Functions ¶
func ApplicationsToString ¶
func ApplicationsToString(apps []ArgoResource) string
ApplicationsToString converts a slice of ArgoResource to a YAML string
func ConvertAppSetsToAppsInBothBranches ¶
func ConvertAppSetsToAppsInBothBranches( argocd *argocd.ArgoCDInstallation, baseApps []ArgoResource, targetApps []ArgoResource, baseBranch *types.Branch, targetBranch *types.Branch, repo string, tempFolder string, redirectRevisions []string, debug bool, ) ([]ArgoResource, []ArgoResource, error)
func GetApplicationsForBranches ¶
func GetApplicationsForBranches( argocdNamespace string, baseBranch *types.Branch, targetBranch *types.Branch, fileRegex *string, selector []types.Selector, filesChanged []string, repo string, ignoreInvalidWatchPattern bool, redirectRevisions []string, ) ([]ArgoResource, []ArgoResource, error)
GetApplicationsForBranches gets applications for both base and target branches
func WriteApplications ¶
func WriteApplications( apps []ArgoResource, branch *types.Branch, folder string, ) error
WriteApplications writes applications to YAML files in the specified folder
Types ¶
type ApplicationKind ¶
type ApplicationKind int
ApplicationKind represents the type of Argo CD application
const ( Application ApplicationKind = iota ApplicationSet )
func (ApplicationKind) String ¶
func (k ApplicationKind) String() string
String returns the string representation of ApplicationKind
type ArgoResource ¶
type ArgoResource struct {
Yaml *yaml.Node
Kind ApplicationKind
Name string
FileName string
}
ArgoResource represents an Argo CD Application or ApplicationSet
func ConvertAppSetsToApps ¶
func ConvertAppSetsToApps( argocd *argocd.ArgoCDInstallation, appSets []ArgoResource, branch *types.Branch, repo string, tempFolder string, redirectRevisions []string, debug bool, ) ([]ArgoResource, error)
func FromK8sResource ¶
func FromK8sResource(resource *types.K8sResource) *ArgoResource
FromK8sResource creates an ArgoResource from a K8sResource
func FromResourceToApplication ¶
func FromResourceToApplication( k8sResources []types.K8sResource, selector []types.Selector, filesChanged []string, ignoreInvalidWatchPattern bool, branch *types.Branch, ) []ArgoResource
FromResourceToApplication converts K8sResources to ArgoResources with filtering
func GetApplications ¶
func GetApplications( argocdNamespace string, branch *types.Branch, fileRegex *string, selector []types.Selector, filesChanged []string, repo string, ignoreInvalidWatchPattern bool, redirectRevisions []string, ) ([]ArgoResource, error)
GetApplications gets applications for a single branch
func PatchApplication ¶
func PatchApplication( argocdNamespace string, application ArgoResource, branch *types.Branch, repo string, redirectRevisions []string, ) (*ArgoResource, error)
PatchApplication patches a single ArgoResource
func PatchApplications ¶
func PatchApplications( argocdNamespace string, applications []ArgoResource, branch *types.Branch, repo string, redirectRevisions []string, ) ([]ArgoResource, error)
PatchApplications patches a slice of ArgoResources
func UniqueNames ¶
func UniqueNames(apps []ArgoResource, branch *types.Branch) []ArgoResource
UniqueNames ensures that each application has a unique name by appending the branch name if necessary. It returns a new slice with unique names. UniqueNames ensures all applications have unique names by adding suffixes to duplicates
func (*ArgoResource) AsString ¶
func (a *ArgoResource) AsString() (string, error)
AsString returns the YAML representation of the resource
func (*ArgoResource) Filter ¶
func (a *ArgoResource) Filter( selectors []types.Selector, filesChanged []string, ignoreInvalidWatchPattern bool, ) *ArgoResource
Filter checks if the application matches the given selectors and watches the given files
func (*ArgoResource) PointDestinationToInCluster ¶
func (a *ArgoResource) PointDestinationToInCluster() error
PointDestinationToInCluster updates the destination to point to the in-cluster service
func (*ArgoResource) RedirectGenerators ¶
func (a *ArgoResource) RedirectGenerators(repo, branch string, redirectRevisions []string) error
RedirectGenerators updates the git generator targetRevision to point to the specified branch
func (*ArgoResource) RedirectSources ¶
func (a *ArgoResource) RedirectSources(repo, branch string, redirectRevisions []string) error
RedirectSources updates the source/sources targetRevision to point to the specified branch
func (*ArgoResource) RemoveSyncPolicy ¶
func (a *ArgoResource) RemoveSyncPolicy() error
RemoveSyncPolicy removes the syncPolicy from the resource
func (*ArgoResource) SetNamespace ¶
func (a *ArgoResource) SetNamespace(namespace string) error
SetNamespace sets the namespace of the resource
func (*ArgoResource) SetProjectToDefault ¶
func (a *ArgoResource) SetProjectToDefault() error
SetProjectToDefault sets the project to "default"