diff --git a/docs/spec/v1/gitrepositories.md b/docs/spec/v1/gitrepositories.md index 5a634b7f..4e755973 100644 --- a/docs/spec/v1/gitrepositories.md +++ b/docs/spec/v1/gitrepositories.md @@ -433,24 +433,6 @@ GitRepository, and changes to the resource or in the Git repository will not result in a new Artifact. When the field is set to `false` or removed, it will resume. -#### Optimized Git clones - -Optimized Git clones decreases resource utilization for GitRepository -reconciliations. - -When enabled, it avoids full Git clone operations by first checking whether -the revision of the last stored artifact is still the head of the remote -repository and none of the other factors that contribute to a change in the -artifact, like ignore rules and included repositories, have changed. If that is -so, the reconciliation is skipped. Else, a full reconciliation is performed as -usual. - -This feature is enabled by default. It can be disabled by starting the -controller with the argument `--feature-gates=OptimizedGitClones=false`. - -NB: GitRepository objects configured for SemVer or Commit clones are -not affected by this functionality. - #### Proxy support When a proxy is configured in the source-controller Pod through the appropriate diff --git a/internal/controller/gitrepository_controller.go b/internal/controller/gitrepository_controller.go index 622b540c..a1196b2d 100644 --- a/internal/controller/gitrepository_controller.go +++ b/internal/controller/gitrepository_controller.go @@ -536,12 +536,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch // Persist the ArtifactSet. *includes = *artifacts - var optimizedClone bool - if val, ok := r.features[features.OptimizedGitClones]; ok && val { - optimizedClone = true - } - - c, err := r.gitCheckout(ctx, obj, authOpts, dir, optimizedClone) + c, err := r.gitCheckout(ctx, obj, authOpts, dir) if err != nil { return sreconcile.ResultEmpty, err } @@ -583,7 +578,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch // If we can't skip the reconciliation, checkout again without any // optimization. - c, err := r.gitCheckout(ctx, obj, authOpts, dir, false) + c, err := r.gitCheckout(ctx, obj, authOpts, dir) if err != nil { return sreconcile.ResultEmpty, err } @@ -782,8 +777,7 @@ func (r *GitRepositoryReconciler) reconcileInclude(ctx context.Context, sp *patc // gitCheckout builds checkout options with the given configurations and // performs a git checkout. func (r *GitRepositoryReconciler) gitCheckout(ctx context.Context, - obj *sourcev1.GitRepository, authOpts *git.AuthOptions, dir string, - optimized bool) (*git.Commit, error) { + obj *sourcev1.GitRepository, authOpts *git.AuthOptions, dir string) (*git.Commit, error) { // Configure checkout strategy. cloneOpts := repository.CloneConfig{ RecurseSubmodules: obj.Spec.RecurseSubmodules, @@ -800,7 +794,7 @@ func (r *GitRepositoryReconciler) gitCheckout(ctx context.Context, // Only if the object has an existing artifact in storage, attempt to // short-circuit clone operation. reconcileStorage has already verified // that the artifact exists. - if optimized && conditions.IsTrue(obj, sourcev1.ArtifactInStorageCondition) { + if conditions.IsTrue(obj, sourcev1.ArtifactInStorageCondition) { if artifact := obj.GetArtifact(); artifact != nil { cloneOpts.LastObservedCommit = artifact.Revision } diff --git a/internal/controller/gitrepository_controller_test.go b/internal/controller/gitrepository_controller_test.go index a19f0b22..bd7cddfc 100644 --- a/internal/controller/gitrepository_controller_test.go +++ b/internal/controller/gitrepository_controller_test.go @@ -562,10 +562,7 @@ func TestGitRepositoryReconciler_reconcileSource_authStrategy(t *testing.T) { Client: clientBuilder.Build(), EventRecorder: record.NewFakeRecorder(32), Storage: testStorage, - features: map[string]bool{ - features.OptimizedGitClones: true, - }, - patchOptions: getPatchOptions(gitRepositoryReadyCondition.Owned, "sc"), + patchOptions: getPatchOptions(gitRepositoryReadyCondition.Owned, "sc"), } tmpDir := t.TempDir() @@ -792,10 +789,7 @@ func TestGitRepositoryReconciler_reconcileSource_checkoutStrategy(t *testing.T) Build(), EventRecorder: record.NewFakeRecorder(32), Storage: testStorage, - features: map[string]bool{ - features.OptimizedGitClones: true, - }, - patchOptions: getPatchOptions(gitRepositoryReadyCondition.Owned, "sc"), + patchOptions: getPatchOptions(gitRepositoryReadyCondition.Owned, "sc"), } for _, tt := range tests { diff --git a/internal/controller/suite_test.go b/internal/controller/suite_test.go index 28d126a3..2602e554 100644 --- a/internal/controller/suite_test.go +++ b/internal/controller/suite_test.go @@ -50,7 +50,6 @@ import ( sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/source-controller/internal/cache" - "github.com/fluxcd/source-controller/internal/features" "github.com/fluxcd/source-controller/internal/helm/registry" // +kubebuilder:scaffold:imports ) @@ -241,9 +240,6 @@ func TestMain(m *testing.M) { EventRecorder: record.NewFakeRecorder(32), Metrics: testMetricsH, Storage: testStorage, - features: map[string]bool{ - features.OptimizedGitClones: true, - }, }).SetupWithManagerAndOptions(testEnv, GitRepositoryReconcilerOptions{ RateLimiter: controller.GetDefaultRateLimiter(), }); err != nil { diff --git a/internal/features/features.go b/internal/features/features.go index 044b54c1..c2622ce3 100644 --- a/internal/features/features.go +++ b/internal/features/features.go @@ -22,13 +22,6 @@ package features import feathelper "github.com/fluxcd/pkg/runtime/features" const ( - // OptimizedGitClones decreases resource utilization for GitRepository - // reconciliations. - // - // When enabled, avoids full clone operations by first checking whether - // the last revision is still the same at the target repository, - // and if that is so, skips the reconciliation. - OptimizedGitClones = "OptimizedGitClones" // CacheSecretsAndConfigMaps controls whether secrets and configmaps should be cached. // // When enabled, it will cache both object types, resulting in increased memory usage @@ -37,9 +30,6 @@ const ( ) var features = map[string]bool{ - // OptimizedGitClones - // opt-out from v0.25 - OptimizedGitClones: true, // CacheSecretsAndConfigMaps // opt-in from v0.34 CacheSecretsAndConfigMaps: false,