-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OptimizedGitClones decreases resource utilization for GitRepository reconciliations. It supports both go-git and libgit2 implementations when cloning repositories using branches or tags. GitManagedTransport enables the use of Managed Transport. This replaces the previous 'EXPERIMENTAL_GIT_TRANSPORT' environment variable that was used for the same result. This commit also enables it by default. Both are opt-out features, which can be disabled by starting the controller with the argument '--feature-gates=GitManagedTransport=false,OptimizedGitClones=false' Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
- Loading branch information
Paulo Gomes
committed
May 12, 2022
1 parent
4a64452
commit ba6deae
Showing
4 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
Copyright 2022 The Flux authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package features sets the feature gates that | ||
// source-controller supports, and their default | ||
// states. | ||
package features | ||
|
||
import feathelper "github.com/fluxcd/pkg/runtime/features" | ||
|
||
const ( | ||
// OptimizedGitClones decreases resource utilization for GitRepository | ||
// reconciliations. It supports both go-git and libgit2 implementations | ||
// when cloning repositories using branches or tags. | ||
// | ||
// 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" | ||
|
||
// GitManagedTransport implements a managed transport for GitRepository | ||
// objects that use the libgit2 implementation. | ||
// | ||
// When enabled, improves the reliability of libgit2 reconciliations, | ||
// by enforcing timeouts and ensuring libgit2 cannot hijack the process | ||
// and hang it indefinitely. | ||
GitManagedTransport = "GitManagedTransport" | ||
) | ||
|
||
var features = map[string]bool{ | ||
// OptimizedGitClones | ||
// opt-out from v0.23 | ||
OptimizedGitClones: true, | ||
|
||
// GitManagedTransport | ||
// opt-in from v0.21 (via environment variable) | ||
// opt-out from v0.23 | ||
GitManagedTransport: true, | ||
} | ||
|
||
// DefaultFeatureGates contains a list of all supported feature gates and | ||
// their default values. | ||
func FeatureGates() map[string]bool { | ||
return features | ||
} | ||
|
||
// Enabled verifies whether the feature is enabled or not. | ||
// | ||
// This is only a wrapper around the Enabled func in | ||
// pkg/runtime/features, so callers won't need to import | ||
// both packages for checking whether a feature is enabled. | ||
func Enabled(feature string) (bool, error) { | ||
return feathelper.Enabled(feature) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters