Skip to content

Commit

Permalink
added flux2
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jan 25, 2022
1 parent 77d3323 commit 2660ded
Show file tree
Hide file tree
Showing 129 changed files with 2,425 additions and 0 deletions.
45 changes: 45 additions & 0 deletions completers/flux2_completer/cmd/bootstrap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var bootstrapCmd = &cobra.Command{
Use: "bootstrap",
Short: "Bootstrap toolkit components",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(bootstrapCmd).Standalone()
bootstrapCmd.PersistentFlags().String("arch", "", "cluster architecture, available options are: (amd64, arm, arm64)")
bootstrapCmd.PersistentFlags().String("author-email", "", "author email for Git commits")
bootstrapCmd.PersistentFlags().String("author-name", "Flux", "author name for Git commits")
bootstrapCmd.PersistentFlags().String("branch", "main", "Git branch")
bootstrapCmd.PersistentFlags().String("ca-file", "", "path to TLS CA file used for validating self-signed certificates")
bootstrapCmd.PersistentFlags().String("cluster-domain", "cluster.local", "internal cluster domain")
bootstrapCmd.PersistentFlags().String("commit-message-appendix", "", "string to add to the commit messages, e.g. '[ci skip]'")
bootstrapCmd.PersistentFlags().StringSlice("components", []string{"source-controller", "kustomize-controller", "helm-controller", "notification-controller"}, "list of components, accepts comma-separated values")
bootstrapCmd.PersistentFlags().StringSlice("components-extra", []string{}, "list of components in addition to those supplied or defaulted, accepts comma-separated values")
bootstrapCmd.PersistentFlags().String("gpg-key-id", "", "key id for selecting a particular key")
bootstrapCmd.PersistentFlags().String("gpg-key-ring", "", "path to GPG key ring for signing commits")
bootstrapCmd.PersistentFlags().String("gpg-passphrase", "", "passphrase for decrypting GPG private key")
bootstrapCmd.PersistentFlags().String("image-pull-secret", "", "Kubernetes secret name used for pulling the toolkit images from a private registry")
bootstrapCmd.PersistentFlags().String("log-level", "info", "log level, available options are: (debug, info, error)")
bootstrapCmd.PersistentFlags().String("manifests", "", "path to the manifest directory")
bootstrapCmd.PersistentFlags().Bool("network-policy", true, "deny ingress access to the toolkit controllers from other namespaces using network policies")
bootstrapCmd.PersistentFlags().String("private-key-file", "", "path to a private key file used for authenticating to the Git SSH server")
bootstrapCmd.PersistentFlags().Bool("recurse-submodules", false, "when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces")
bootstrapCmd.PersistentFlags().String("registry", "ghcr.io/fluxcd", "container registry where the toolkit images are published")
bootstrapCmd.PersistentFlags().String("secret-name", "flux-system", "name of the secret the sync credentials can be found in or stored to")
bootstrapCmd.PersistentFlags().String("ssh-ecdsa-curve", "", "SSH ECDSA public key curve (p256, p384, p521)")
bootstrapCmd.PersistentFlags().String("ssh-hostname", "", "SSH hostname, to be used when the SSH host differs from the HTTPS one")
bootstrapCmd.PersistentFlags().String("ssh-key-algorithm", "ecdsa", "SSH public key algorithm (rsa, ecdsa, ed25519)")
bootstrapCmd.PersistentFlags().String("ssh-rsa-bits", "2048", "SSH RSA public key bit size (multiplies of 8)")
bootstrapCmd.PersistentFlags().Bool("token-auth", false, "when enabled, the personal access token will be used instead of SSH deploy key")
bootstrapCmd.PersistentFlags().StringSlice("toleration-keys", []string{}, "list of toleration keys used to schedule the components pods onto nodes with matching taints")
bootstrapCmd.PersistentFlags().StringP("version", "v", "", "toolkit version, when specified the manifests are downloaded from https://github.com/fluxcd/flux2/releases")
bootstrapCmd.PersistentFlags().Bool("watch-all-namespaces", true, "watch for custom resources in all namespaces, if set to false it will only watch the namespace where the toolkit is installed")
rootCmd.AddCommand(bootstrapCmd)
}
28 changes: 28 additions & 0 deletions completers/flux2_completer/cmd/bootstrap_bitbucketServer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var bootstrap_bitbucketServerCmd = &cobra.Command{
Use: "bitbucket-server",
Short: "Bootstrap toolkit components in a Bitbucket Server repository",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(bootstrap_bitbucketServerCmd).Standalone()
bootstrap_bitbucketServerCmd.Flags().StringSlice("group", []string{}, "Bitbucket Server groups to be given write access (also accepts comma-separated values)")
bootstrap_bitbucketServerCmd.Flags().String("hostname", "", "Bitbucket Server hostname")
bootstrap_bitbucketServerCmd.Flags().String("interval", "", "sync interval")
bootstrap_bitbucketServerCmd.Flags().String("owner", "", "Bitbucket Server user or project name")
bootstrap_bitbucketServerCmd.Flags().String("path", "", "path relative to the repository root, when specified the cluster sync will be scoped to this path")
bootstrap_bitbucketServerCmd.Flags().Bool("personal", false, "if true, the owner is assumed to be a Bitbucket Server user; otherwise a group")
bootstrap_bitbucketServerCmd.Flags().Bool("private", true, "if true, the repository is setup or configured as private")
bootstrap_bitbucketServerCmd.Flags().Bool("read-write-key", false, "if true, the deploy key is configured with read/write permissions")
bootstrap_bitbucketServerCmd.Flags().Bool("reconcile", false, "if true, the configured options are also reconciled if the repository already exists")
bootstrap_bitbucketServerCmd.Flags().String("repository", "", "Bitbucket Server repository name")
bootstrap_bitbucketServerCmd.Flags().StringP("username", "u", "git", "authentication username")
bootstrapCmd.AddCommand(bootstrap_bitbucketServerCmd)
}
23 changes: 23 additions & 0 deletions completers/flux2_completer/cmd/bootstrap_git.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var bootstrap_gitCmd = &cobra.Command{
Use: "git",
Short: "Bootstrap toolkit components in a Git repository",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(bootstrap_gitCmd).Standalone()
bootstrap_gitCmd.Flags().String("interval", "", "sync interval")
bootstrap_gitCmd.Flags().StringP("password", "p", "", "basic authentication password")
bootstrap_gitCmd.Flags().String("path", "", "path relative to the repository root, when specified the cluster sync will be scoped to this path")
bootstrap_gitCmd.Flags().BoolP("silent", "s", false, "assumes the deploy key is already setup, skips confirmation")
bootstrap_gitCmd.Flags().String("url", "", "Git repository URL")
bootstrap_gitCmd.Flags().StringP("username", "u", "git", "basic authentication username")
bootstrapCmd.AddCommand(bootstrap_gitCmd)
}
27 changes: 27 additions & 0 deletions completers/flux2_completer/cmd/bootstrap_github.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var bootstrap_githubCmd = &cobra.Command{
Use: "github",
Short: "Bootstrap toolkit components in a GitHub repository",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(bootstrap_githubCmd).Standalone()
bootstrap_githubCmd.Flags().String("hostname", "github.com", "GitHub hostname")
bootstrap_githubCmd.Flags().String("interval", "", "sync interval")
bootstrap_githubCmd.Flags().String("owner", "", "GitHub user or organization name")
bootstrap_githubCmd.Flags().String("path", "", "path relative to the repository root, when specified the cluster sync will be scoped to this path")
bootstrap_githubCmd.Flags().Bool("personal", false, "if true, the owner is assumed to be a GitHub user; otherwise an org")
bootstrap_githubCmd.Flags().Bool("private", true, "if true, the repository is setup or configured as private")
bootstrap_githubCmd.Flags().Bool("read-write-key", false, "if true, the deploy key is configured with read/write permissions")
bootstrap_githubCmd.Flags().Bool("reconcile", false, "if true, the configured options are also reconciled if the repository already exists")
bootstrap_githubCmd.Flags().String("repository", "", "GitHub repository name")
bootstrap_githubCmd.Flags().StringSlice("team", []string{}, "GitHub team and the access to be given to it(team:maintain). Defaults to maintainer access if no access level is specified (also accepts comma-separated values)")
bootstrapCmd.AddCommand(bootstrap_githubCmd)
}
27 changes: 27 additions & 0 deletions completers/flux2_completer/cmd/bootstrap_gitlab.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var bootstrap_gitlabCmd = &cobra.Command{
Use: "gitlab",
Short: "Bootstrap toolkit components in a GitLab repository",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(bootstrap_gitlabCmd).Standalone()
bootstrap_gitlabCmd.Flags().String("hostname", "gitlab.com", "GitLab hostname")
bootstrap_gitlabCmd.Flags().String("interval", "", "sync interval")
bootstrap_gitlabCmd.Flags().String("owner", "", "GitLab user or group name")
bootstrap_gitlabCmd.Flags().String("path", "", "path relative to the repository root, when specified the cluster sync will be scoped to this path")
bootstrap_gitlabCmd.Flags().Bool("personal", false, "if true, the owner is assumed to be a GitLab user; otherwise a group")
bootstrap_gitlabCmd.Flags().Bool("private", true, "if true, the repository is setup or configured as private")
bootstrap_gitlabCmd.Flags().Bool("read-write-key", false, "if true, the deploy key is configured with read/write permissions")
bootstrap_gitlabCmd.Flags().Bool("reconcile", false, "if true, the configured options are also reconciled if the repository already exists")
bootstrap_gitlabCmd.Flags().String("repository", "", "GitLab repository name")
bootstrap_gitlabCmd.Flags().StringSlice("team", []string{}, "GitLab teams to be given maintainer access (also accepts comma-separated values)")
bootstrapCmd.AddCommand(bootstrap_gitlabCmd)
}
17 changes: 17 additions & 0 deletions completers/flux2_completer/cmd/build.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var buildCmd = &cobra.Command{
Use: "build",
Short: "Build a flux resource",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(buildCmd).Standalone()
rootCmd.AddCommand(buildCmd)
}
18 changes: 18 additions & 0 deletions completers/flux2_completer/cmd/build_kustomization.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var build_kustomizationCmd = &cobra.Command{
Use: "kustomization",
Short: "Build Kustomization",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(build_kustomizationCmd).Standalone()
build_kustomizationCmd.Flags().String("path", "", "Path to the manifests location.)")
buildCmd.AddCommand(build_kustomizationCmd)
}
21 changes: 21 additions & 0 deletions completers/flux2_completer/cmd/check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var checkCmd = &cobra.Command{
Use: "check",
Short: "Check requirements and installation",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(checkCmd).Standalone()
checkCmd.Flags().StringSlice("components", []string{"source-controller", "kustomize-controller", "helm-controller", "notification-controller"}, "list of components, accepts comma-separated values")
checkCmd.Flags().StringSlice("components-extra", []string{}, "list of components in addition to those supplied or defaulted, accepts comma-separated values")
checkCmd.Flags().String("poll-interval", "", "how often the health checker should poll the cluster for the latest state of the resources.")
checkCmd.Flags().Bool("pre", false, "only run pre-installation checks")
rootCmd.AddCommand(checkCmd)
}
17 changes: 17 additions & 0 deletions completers/flux2_completer/cmd/completion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completionCmd = &cobra.Command{
Use: "completion",
Short: "Generates completion scripts for various shells",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completionCmd).Standalone()
rootCmd.AddCommand(completionCmd)
}
17 changes: 17 additions & 0 deletions completers/flux2_completer/cmd/completion_bash.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_bashCmd = &cobra.Command{
Use: "bash",
Short: "Generates bash completion scripts",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_bashCmd).Standalone()
completionCmd.AddCommand(completion_bashCmd)
}
17 changes: 17 additions & 0 deletions completers/flux2_completer/cmd/completion_fish.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_fishCmd = &cobra.Command{
Use: "fish",
Short: "Generates fish completion scripts",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_fishCmd).Standalone()
completionCmd.AddCommand(completion_fishCmd)
}
17 changes: 17 additions & 0 deletions completers/flux2_completer/cmd/completion_powershell.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_powershellCmd = &cobra.Command{
Use: "powershell",
Short: "Generates powershell completion scripts",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_powershellCmd).Standalone()
completionCmd.AddCommand(completion_powershellCmd)
}
17 changes: 17 additions & 0 deletions completers/flux2_completer/cmd/completion_zsh.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var completion_zshCmd = &cobra.Command{
Use: "zsh",
Short: "Generates zsh completion scripts",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completion_zshCmd).Standalone()
completionCmd.AddCommand(completion_zshCmd)
}
20 changes: 20 additions & 0 deletions completers/flux2_completer/cmd/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var createCmd = &cobra.Command{
Use: "create",
Short: "Create or update sources and resources",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(createCmd).Standalone()
createCmd.PersistentFlags().Bool("export", false, "export in YAML format to stdout")
createCmd.PersistentFlags().String("interval", "", "source sync interval")
createCmd.PersistentFlags().StringSlice("label", []string{}, "set labels on the resource (can specify multiple labels with commas: label1=value1,label2=value2)")
rootCmd.AddCommand(createCmd)
}
20 changes: 20 additions & 0 deletions completers/flux2_completer/cmd/create_alert.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var create_alertCmd = &cobra.Command{
Use: "alert",
Short: "Create or update a Alert resource",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(create_alertCmd).Standalone()
create_alertCmd.Flags().String("event-severity", "", "severity of events to send alerts for")
create_alertCmd.Flags().StringSlice("event-source", []string{}, "sources that should generate alerts (<kind>/<name>), also accepts comma-separated values")
create_alertCmd.Flags().String("provider-ref", "", "reference to provider")
createCmd.AddCommand(create_alertCmd)
}
22 changes: 22 additions & 0 deletions completers/flux2_completer/cmd/create_alertProvider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var create_alertProviderCmd = &cobra.Command{
Use: "alert-provider",
Short: "Create or update a Provider resource",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(create_alertProviderCmd).Standalone()
create_alertProviderCmd.Flags().String("address", "", "path to either the git repository, chat provider or webhook")
create_alertProviderCmd.Flags().String("channel", "", "channel to send messages to in the case of a chat provider")
create_alertProviderCmd.Flags().String("secret-ref", "", "name of secret containing authentication token")
create_alertProviderCmd.Flags().String("type", "", "type of provider")
create_alertProviderCmd.Flags().String("username", "", "bot username used by the provider")
createCmd.AddCommand(create_alertProviderCmd)
}
28 changes: 28 additions & 0 deletions completers/flux2_completer/cmd/create_helmrelease.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var create_helmreleaseCmd = &cobra.Command{
Use: "helmrelease",
Short: "Create or update a HelmRelease resource",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(create_helmreleaseCmd).Standalone()
create_helmreleaseCmd.Flags().String("chart", "", "Helm chart name or path")
create_helmreleaseCmd.Flags().String("chart-version", "", "Helm chart version, accepts a semver range (ignored for charts from GitRepository sources)")
create_helmreleaseCmd.Flags().String("crds", "", "upgrade CRDs policy, available options are: (Skip, Create, CreateReplace)")
create_helmreleaseCmd.Flags().Bool("create-target-namespace", false, "create the target namespace if it does not exist")
create_helmreleaseCmd.Flags().StringSlice("depends-on", []string{}, "HelmReleases that must be ready before this release can be installed, supported formats '<name>' and '<namespace>/<name>'")
create_helmreleaseCmd.Flags().String("release-name", "", "name used for the Helm release, defaults to a composition of '[<target-namespace>-]<HelmRelease-name>'")
create_helmreleaseCmd.Flags().String("service-account", "", "the name of the service account to impersonate when reconciling this HelmRelease")
create_helmreleaseCmd.Flags().String("source", "", "source that contains the chart in the format '<kind>/<name>.<namespace>', where kind must be one of: (HelmRepository, GitRepository, Bucket)")
create_helmreleaseCmd.Flags().String("target-namespace", "", "namespace to install this release, defaults to the HelmRelease namespace")
create_helmreleaseCmd.Flags().StringSlice("values", []string{}, "local path to values.yaml files, also accepts comma-separated values")
create_helmreleaseCmd.Flags().String("values-from", "", "Kubernetes object reference that contains the values.yaml data key in the format '<kind>/<name>', where kind must be one of: (Secret, ConfigMap)")
createCmd.AddCommand(create_helmreleaseCmd)
}
Loading

0 comments on commit 2660ded

Please sign in to comment.