Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Refine ApplicationSet SyncPolicy API to be less like ArgoCD. (#55)
Browse files Browse the repository at this point in the history
The ArgoCD core Application.Spec.SyncPolicy is available as part of the
embedded ApplicationSet.Spec.Template.

However we inherited some of this API within the ApplicationSet.Spec
where it does not make sense.

This PR drops the "automated" sub-struct, as automated is really the
only sync policy for an ApplicationSet. We do not support the concept of
a manual Sync from a UI or CLI tool as we would in ArgoCD itself, and as
far as I know this is not desirable.

This PR also drops the "initialSync" field, as I do not believe this
concept makes sense for an ApplicationSet. Applications are always
synced for their ApplicationSet.

ApplicationSet.Spec.SyncPolicy.Automated.Prune then moves up to
ApplicationSet.Spec.SyncPolicy.Prune.
  • Loading branch information
dgoodwin committed Nov 11, 2020
1 parent 717fc3c commit b72b26e
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 179 deletions.
23 changes: 8 additions & 15 deletions api/v1alpha1/applicationset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,11 @@ type ApplicationSetSpec struct {
SyncPolicy *ApplicationSetSyncPolicy `json:"syncPolicy,omitempty"`
}

// ApplicationSetSyncPolicy will provide a syncPolicy similar to Applications
// ApplicationSetSyncPolicy configures how generated Applications will relate to their
// ApplicationSet.
type ApplicationSetSyncPolicy struct {
// Automated will keep an application synced to the target revision
Automated *SyncPolicyAutomated `json:"automated,omitempty"`
}

// SyncPolicyAutomated
type SyncPolicyAutomated struct {
// Prune will prune resources automatically as part of automated sync (default: false)
Prune bool `json:"prune,omitempty"`
// Initial will perform an initial sync for any newly created Applications which do not have automated sync turned on.
Initial bool `json:"initial,omitempty"`
// SkipPrune will disable the default behavior which will delete Applications that are no longer being generated for the ApplicationSet which created them, or the ApplicationSet itself is deleted. If SkipPrune is set to true, these Applications will be orphaned but continue to exist.
SkipPrune bool `json:"skipPrune,omitempty"`
}

// ApplicationSetTemplate represents argocd ApplicationSpec
Expand Down Expand Up @@ -70,10 +63,10 @@ type ClusterGenerator struct {
}

type GitGenerator struct {
RepoURL string `json:"repoURL"`
Directories []GitDirectoryGeneratorItem `json:"directories,omitempty"`
Revision string `json:"revision"`
RequeueAfterSeconds int64 `json:"requeueAfterSeconds,omitempty"`
RepoURL string `json:"repoURL"`
Directories []GitDirectoryGeneratorItem `json:"directories,omitempty"`
Revision string `json:"revision"`
RequeueAfterSeconds int64 `json:"requeueAfterSeconds,omitempty"`
}

type GitDirectoryGeneratorItem struct {
Expand Down
22 changes: 1 addition & 21 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b72b26e

Please sign in to comment.