diff --git a/cmd/flux/bootstrap.go b/cmd/flux/bootstrap.go index 05139ab46270f826c8c653b6e642ca0c5f49cc8f..1c1dc1c259ae5392e468f8f1e2c8e7d7115238c5 100644 --- a/cmd/flux/bootstrap.go +++ b/cmd/flux/bootstrap.go @@ -39,8 +39,9 @@ type bootstrapFlags struct { arch flags.Arch logLevel flags.LogLevel - branch string - manifestsPath string + branch string + recurseSubmodules bool + manifestsPath string defaultComponents []string extraComponents []string @@ -89,8 +90,10 @@ func init() { bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.imagePullSecret, "image-pull-secret", "", "Kubernetes secret name used for pulling the toolkit images from a private registry") - bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.branch, "branch", bootstrapDefaultBranch, - "default branch (for GitHub this must match the default branch setting for the organization)") + bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.branch, "branch", bootstrapDefaultBranch, "Git branch") + bootstrapCmd.PersistentFlags().BoolVar(&bootstrapArgs.recurseSubmodules, "recurse-submodules", false, + "when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces") + bootstrapCmd.PersistentFlags().StringVar(&bootstrapArgs.manifestsPath, "manifests", "", "path to the manifest directory") bootstrapCmd.PersistentFlags().BoolVar(&bootstrapArgs.watchAllNamespaces, "watch-all-namespaces", true, diff --git a/cmd/flux/bootstrap_git.go b/cmd/flux/bootstrap_git.go index fa8eb5846dbd37fd0248edca09158c964695a859..2f4c49d15267c52ad69197ccd2c70191e95fb4d7 100644 --- a/cmd/flux/bootstrap_git.go +++ b/cmd/flux/bootstrap_git.go @@ -189,6 +189,7 @@ func bootstrapGitCmdRun(cmd *cobra.Command, args []string) error { TargetPath: gitArgs.path.String(), ManifestFile: sync.MakeDefaultOptions().ManifestFile, GitImplementation: sourceGitArgs.gitImplementation.String(), + RecurseSubmodules: bootstrapArgs.recurseSubmodules, } // Bootstrap config diff --git a/cmd/flux/bootstrap_github.go b/cmd/flux/bootstrap_github.go index 8123833109ae74d7ac6afe75105bbf37e4f48d26..5f0f594dfeab745859c48fadac71c1c0c239fd75 100644 --- a/cmd/flux/bootstrap_github.go +++ b/cmd/flux/bootstrap_github.go @@ -211,6 +211,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error { TargetPath: githubArgs.path.String(), ManifestFile: sync.MakeDefaultOptions().ManifestFile, GitImplementation: sourceGitArgs.gitImplementation.String(), + RecurseSubmodules: bootstrapArgs.recurseSubmodules, } // Bootstrap config diff --git a/cmd/flux/bootstrap_gitlab.go b/cmd/flux/bootstrap_gitlab.go index a57b9aa552952486eb6da089b4e9d41dc51acb49..d66003cfd87facfbc5fc411904ba477f0ffe0316 100644 --- a/cmd/flux/bootstrap_gitlab.go +++ b/cmd/flux/bootstrap_gitlab.go @@ -227,6 +227,7 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error { TargetPath: gitlabArgs.path.String(), ManifestFile: sync.MakeDefaultOptions().ManifestFile, GitImplementation: sourceGitArgs.gitImplementation.String(), + RecurseSubmodules: bootstrapArgs.recurseSubmodules, } // Bootstrap config diff --git a/cmd/flux/create_source_git.go b/cmd/flux/create_source_git.go index eaee699a14ef6eeab24be5ca019a880528a98da7..c4b2fb18bb73a8867856722e93fdaea401d15e8c 100644 --- a/cmd/flux/create_source_git.go +++ b/cmd/flux/create_source_git.go @@ -125,7 +125,8 @@ func init() { createSourceGitCmd.Flags().Var(&sourceGitArgs.gitImplementation, "git-implementation", sourceGitArgs.gitImplementation.Description()) createSourceGitCmd.Flags().StringVar(&sourceGitArgs.caFile, "ca-file", "", "path to TLS CA file used for validating self-signed certificates") createSourceGitCmd.Flags().StringVar(&sourceGitArgs.privateKeyFile, "private-key-file", "", "path to a passwordless private key file used for authenticating to the Git SSH server") - createSourceGitCmd.Flags().BoolVar(&sourceGitArgs.recurseSubmodules, "recurse-submodules", false, "when enabled, after the clone is created, initializes all Git submodules within") + createSourceGitCmd.Flags().BoolVar(&sourceGitArgs.recurseSubmodules, "recurse-submodules", false, + "when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces") createSourceCmd.AddCommand(createSourceGitCmd) } diff --git a/docs/cmd/flux_bootstrap.md b/docs/cmd/flux_bootstrap.md index 7d944dbdb48d4adb15042796361a573d81d4a8cf..9f1adb8b5eac700a9b6c2a184e3e10db4a3d0550 100644 --- a/docs/cmd/flux_bootstrap.md +++ b/docs/cmd/flux_bootstrap.md @@ -14,7 +14,7 @@ The bootstrap sub-commands bootstrap the toolkit components on the targeted Git ``` --author-email string author email for Git commits --author-name string author name for Git commits (default "Flux") - --branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main") + --branch string Git branch (default "main") --ca-file string path to TLS CA file used for validating self-signed certificates --cluster-domain string internal cluster domain (default "cluster.local") --commit-message-appendix string string to add to the commit messages, e.g. '[ci skip]' @@ -25,6 +25,7 @@ The bootstrap sub-commands bootstrap the toolkit components on the targeted Git --log-level logLevel log level, available options are: (debug, info, error) (default info) --network-policy deny ingress access to the toolkit controllers from other namespaces using network policies (default true) --private-key-file string path to a private key file used for authenticating to the Git SSH server + --recurse-submodules when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces --registry string container registry where the toolkit images are published (default "ghcr.io/fluxcd") --secret-name string name of the secret the sync credentials can be found in or stored to (default "flux-system") --ssh-ecdsa-curve ecdsaCurve SSH ECDSA public key curve (p256, p384, p521) (default p384) diff --git a/docs/cmd/flux_bootstrap_git.md b/docs/cmd/flux_bootstrap_git.md index 0587e5363ba5c0d289ebf1f5117668fe67534c75..0ba7ebf99469313c2e374be97c90a06538b8cb54 100644 --- a/docs/cmd/flux_bootstrap_git.md +++ b/docs/cmd/flux_bootstrap_git.md @@ -46,7 +46,7 @@ flux bootstrap git [flags] ``` --author-email string author email for Git commits --author-name string author name for Git commits (default "Flux") - --branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main") + --branch string Git branch (default "main") --ca-file string path to TLS CA file used for validating self-signed certificates --cluster-domain string internal cluster domain (default "cluster.local") --commit-message-appendix string string to add to the commit messages, e.g. '[ci skip]' @@ -59,6 +59,7 @@ flux bootstrap git [flags] -n, --namespace string the namespace scope for this operation (default "flux-system") --network-policy deny ingress access to the toolkit controllers from other namespaces using network policies (default true) --private-key-file string path to a private key file used for authenticating to the Git SSH server + --recurse-submodules when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces --registry string container registry where the toolkit images are published (default "ghcr.io/fluxcd") --secret-name string name of the secret the sync credentials can be found in or stored to (default "flux-system") --ssh-ecdsa-curve ecdsaCurve SSH ECDSA public key curve (p256, p384, p521) (default p384) diff --git a/docs/cmd/flux_bootstrap_github.md b/docs/cmd/flux_bootstrap_github.md index 05dbe90eb01c0d8476235cae85b6eb6bb794cda2..d99ba6913290639e6f0c0d8e2dbec7563afddd18 100644 --- a/docs/cmd/flux_bootstrap_github.md +++ b/docs/cmd/flux_bootstrap_github.md @@ -65,7 +65,7 @@ flux bootstrap github [flags] ``` --author-email string author email for Git commits --author-name string author name for Git commits (default "Flux") - --branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main") + --branch string Git branch (default "main") --ca-file string path to TLS CA file used for validating self-signed certificates --cluster-domain string internal cluster domain (default "cluster.local") --commit-message-appendix string string to add to the commit messages, e.g. '[ci skip]' @@ -78,6 +78,7 @@ flux bootstrap github [flags] -n, --namespace string the namespace scope for this operation (default "flux-system") --network-policy deny ingress access to the toolkit controllers from other namespaces using network policies (default true) --private-key-file string path to a private key file used for authenticating to the Git SSH server + --recurse-submodules when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces --registry string container registry where the toolkit images are published (default "ghcr.io/fluxcd") --secret-name string name of the secret the sync credentials can be found in or stored to (default "flux-system") --ssh-ecdsa-curve ecdsaCurve SSH ECDSA public key curve (p256, p384, p521) (default p384) diff --git a/docs/cmd/flux_bootstrap_gitlab.md b/docs/cmd/flux_bootstrap_gitlab.md index a3a6823fe33d7b2e5949dcec268954a8e9d48805..fbf17666a46b2cc9f240950eaa6cfc752ad63e2e 100644 --- a/docs/cmd/flux_bootstrap_gitlab.md +++ b/docs/cmd/flux_bootstrap_gitlab.md @@ -62,7 +62,7 @@ flux bootstrap gitlab [flags] ``` --author-email string author email for Git commits --author-name string author name for Git commits (default "Flux") - --branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main") + --branch string Git branch (default "main") --ca-file string path to TLS CA file used for validating self-signed certificates --cluster-domain string internal cluster domain (default "cluster.local") --commit-message-appendix string string to add to the commit messages, e.g. '[ci skip]' @@ -75,6 +75,7 @@ flux bootstrap gitlab [flags] -n, --namespace string the namespace scope for this operation (default "flux-system") --network-policy deny ingress access to the toolkit controllers from other namespaces using network policies (default true) --private-key-file string path to a private key file used for authenticating to the Git SSH server + --recurse-submodules when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces --registry string container registry where the toolkit images are published (default "ghcr.io/fluxcd") --secret-name string name of the secret the sync credentials can be found in or stored to (default "flux-system") --ssh-ecdsa-curve ecdsaCurve SSH ECDSA public key curve (p256, p384, p521) (default p384) diff --git a/docs/cmd/flux_create_source_git.md b/docs/cmd/flux_create_source_git.md index faab2f92fa9daec8bd28fe198de2e7f31c94f0c5..6d6daf2332630db267f1d000fc8ed809fdd1ac93 100644 --- a/docs/cmd/flux_create_source_git.md +++ b/docs/cmd/flux_create_source_git.md @@ -70,7 +70,7 @@ flux create source git [name] [flags] -h, --help help for git -p, --password string basic authentication password --private-key-file string path to a passwordless private key file used for authenticating to the Git SSH server - --recurse-submodules when enabled, after the clone is created, initializes all Git submodules within + --recurse-submodules when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces --secret-ref string the name of an existing secret containing SSH or basic credentials --ssh-ecdsa-curve ecdsaCurve SSH ECDSA public key curve (p256, p384, p521) (default p384) --ssh-key-algorithm publicKeyAlgorithm SSH public key algorithm (rsa, ecdsa, ed25519) (default rsa) diff --git a/pkg/manifestgen/sync/options.go b/pkg/manifestgen/sync/options.go index d406435cd65b900c246b4f8dd3d6059a10750b04..71da1e47e0abb48a79c3655d4644a4c66c28336c 100644 --- a/pkg/manifestgen/sync/options.go +++ b/pkg/manifestgen/sync/options.go @@ -30,6 +30,7 @@ type Options struct { TargetPath string ManifestFile string GitImplementation string + RecurseSubmodules bool } func MakeDefaultOptions() Options { diff --git a/pkg/manifestgen/sync/sync.go b/pkg/manifestgen/sync/sync.go index 37f70f9075aeecc2ddfb9290ea16aa0b970aba09..b2557208164778380f5587d450372cf5932a346c 100644 --- a/pkg/manifestgen/sync/sync.go +++ b/pkg/manifestgen/sync/sync.go @@ -56,6 +56,7 @@ func Generate(options Options) (*manifestgen.Manifest, error) { Name: options.Secret, }, GitImplementation: options.GitImplementation, + RecurseSubmodules: options.RecurseSubmodules, }, }