Merge pull request #702 from fluxcd/feature/git-implementation

Add git implementation to generate sync options
pull/708/head
Stefan Prodan 4 years ago committed by GitHub
commit 884e3c678c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

@ -57,7 +57,7 @@ the bootstrap command will perform an upgrade if needed.`,
flux bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster flux bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
# Run bootstrap for a public repository on a personal account # Run bootstrap for a public repository on a personal account
flux bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true flux bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
# Run bootstrap for a private repo hosted on GitHub Enterprise using SSH auth # Run bootstrap for a private repo hosted on GitHub Enterprise using SSH auth
flux bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain> --ssh-hostname=<domain> flux bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain> --ssh-hostname=<domain>

@ -48,7 +48,7 @@ the bootstrap command will perform an upgrade if needed.`,
Example: ` # Create a GitLab API token and export it as an env var Example: ` # Create a GitLab API token and export it as an env var
export GITLAB_TOKEN=<my-token> export GITLAB_TOKEN=<my-token>
# Run bootstrap for a private repo using HTTPS token authentication # Run bootstrap for a private repo using HTTPS token authentication
flux bootstrap gitlab --owner=<group> --repository=<repo name> --token-auth flux bootstrap gitlab --owner=<group> --repository=<repo name> --token-auth
# Run bootstrap for a private repo using SSH authentication # Run bootstrap for a private repo using SSH authentication
@ -60,7 +60,7 @@ the bootstrap command will perform an upgrade if needed.`,
# Run bootstrap for a public repository on a personal account # Run bootstrap for a public repository on a personal account
flux bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal --token-auth flux bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal --token-auth
# Run bootstrap for a private repo hosted on a GitLab server # Run bootstrap for a private repo hosted on a GitLab server
flux bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain> --token-auth flux bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain> --token-auth
# Run bootstrap for a an existing repository with a branch named main # Run bootstrap for a an existing repository with a branch named main

@ -30,7 +30,7 @@ flux bootstrap github [flags]
flux bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster flux bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
# Run bootstrap for a public repository on a personal account # Run bootstrap for a public repository on a personal account
flux bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true flux bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
# Run bootstrap for a private repo hosted on GitHub Enterprise using SSH auth # Run bootstrap for a private repo hosted on GitHub Enterprise using SSH auth
flux bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain> --ssh-hostname=<domain> flux bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain> --ssh-hostname=<domain>

@ -20,7 +20,7 @@ flux bootstrap gitlab [flags]
# Create a GitLab API token and export it as an env var # Create a GitLab API token and export it as an env var
export GITLAB_TOKEN=<my-token> export GITLAB_TOKEN=<my-token>
# Run bootstrap for a private repo using HTTPS token authentication # Run bootstrap for a private repo using HTTPS token authentication
flux bootstrap gitlab --owner=<group> --repository=<repo name> --token-auth flux bootstrap gitlab --owner=<group> --repository=<repo name> --token-auth
# Run bootstrap for a private repo using SSH authentication # Run bootstrap for a private repo using SSH authentication
@ -32,7 +32,7 @@ flux bootstrap gitlab [flags]
# Run bootstrap for a public repository on a personal account # Run bootstrap for a public repository on a personal account
flux bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal --token-auth flux bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal --token-auth
# Run bootstrap for a private repo hosted on a GitLab server # Run bootstrap for a private repo hosted on a GitLab server
flux bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain> --token-auth flux bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain> --token-auth
# Run bootstrap for a an existing repository with a branch named main # Run bootstrap for a an existing repository with a branch named main

@ -16,26 +16,32 @@ limitations under the License.
package sync package sync
import "time" import (
"time"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
)
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: sourcev1.GoGitImplementation,
} }
} }

@ -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,
}, },
} }

Loading…
Cancel
Save