mirror of
https://github.com/fluxcd/flux2.git
synced 2025-10-30 07:47:09 +08:00
Add git implementation to generate sync options
Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
@ -164,13 +164,14 @@ func applyInstallManifests(ctx context.Context, manifestPath string, components
|
|||||||
|
|
||||||
func generateSyncManifests(url, branch, name, namespace, targetPath, tmpDir string, interval time.Duration) (string, error) {
|
func generateSyncManifests(url, branch, name, namespace, targetPath, tmpDir string, interval time.Duration) (string, error) {
|
||||||
opts := sync.Options{
|
opts := sync.Options{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
URL: url,
|
URL: url,
|
||||||
Branch: branch,
|
Branch: branch,
|
||||||
Interval: interval,
|
Interval: interval,
|
||||||
TargetPath: targetPath,
|
TargetPath: targetPath,
|
||||||
ManifestFile: sync.MakeDefaultOptions().ManifestFile,
|
ManifestFile: sync.MakeDefaultOptions().ManifestFile,
|
||||||
|
GitImplementation: sync.MakeDefaultOptions().GitImplementation,
|
||||||
}
|
}
|
||||||
|
|
||||||
manifest, err := sync.Generate(opts)
|
manifest, err := sync.Generate(opts)
|
||||||
|
|||||||
@ -19,23 +19,25 @@ package sync
|
|||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
URL string
|
URL string
|
||||||
Name string
|
Name string
|
||||||
Namespace string
|
Namespace string
|
||||||
Branch string
|
Branch string
|
||||||
TargetPath string
|
TargetPath string
|
||||||
ManifestFile string
|
ManifestFile string
|
||||||
|
GitImplementation string
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeDefaultOptions() Options {
|
func MakeDefaultOptions() Options {
|
||||||
return Options{
|
return Options{
|
||||||
Interval: 1 * time.Minute,
|
Interval: 1 * time.Minute,
|
||||||
URL: "",
|
URL: "",
|
||||||
Name: "flux-system",
|
Name: "flux-system",
|
||||||
Namespace: "flux-system",
|
Namespace: "flux-system",
|
||||||
Branch: "main",
|
Branch: "main",
|
||||||
ManifestFile: "gotk-sync.yaml",
|
ManifestFile: "gotk-sync.yaml",
|
||||||
TargetPath: "",
|
TargetPath: "",
|
||||||
|
GitImplementation: "go-git",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,7 @@ func Generate(options Options) (*manifestgen.Manifest, error) {
|
|||||||
SecretRef: &corev1.LocalObjectReference{
|
SecretRef: &corev1.LocalObjectReference{
|
||||||
Name: options.Name,
|
Name: options.Name,
|
||||||
},
|
},
|
||||||
|
GitImplementation: options.GitImplementation,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user