mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-09 09:17:27 +00:00
Add cluster-domain option for bootstrap command
Signed-off-by: Léopold Jacquot <leopold.jacquot@infomaniak.com>
This commit is contained in:
parent
b6c63a1aa4
commit
4d7df52dbe
8 changed files with 31 additions and 0 deletions
|
|
@ -59,6 +59,7 @@ var (
|
|||
bootstrapLogLevel = flags.LogLevel(defaults.LogLevel)
|
||||
bootstrapRequiredComponents = []string{"source-controller", "kustomize-controller"}
|
||||
bootstrapTokenAuth bool
|
||||
bootstrapClusterDomain string
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -87,6 +88,7 @@ func init() {
|
|||
"when enabled, the personal access token will be used instead of SSH deploy key")
|
||||
bootstrapCmd.PersistentFlags().Var(&bootstrapLogLevel, "log-level", bootstrapLogLevel.Description())
|
||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapManifestsPath, "manifests", "", "path to the manifest directory")
|
||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapClusterDomain, "cluster-domain", "cluster.local", "internal cluster domain")
|
||||
bootstrapCmd.PersistentFlags().MarkHidden("manifests")
|
||||
rootCmd.AddCommand(bootstrapCmd)
|
||||
}
|
||||
|
|
@ -121,6 +123,7 @@ func generateInstallManifests(targetPath, namespace, tmpDir string, localManifes
|
|||
ManifestFile: defaults.ManifestFile,
|
||||
Timeout: timeout,
|
||||
TargetPath: targetPath,
|
||||
ClusterDomain: bootstrapClusterDomain,
|
||||
}
|
||||
|
||||
if localManifests == "" {
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ var (
|
|||
installNetworkPolicy bool
|
||||
installArch = flags.Arch(defaults.Arch)
|
||||
installLogLevel = flags.LogLevel(defaults.LogLevel)
|
||||
installClusterDomain string
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
@ -89,6 +90,7 @@ func init() {
|
|||
installCmd.Flags().Var(&installLogLevel, "log-level", installLogLevel.Description())
|
||||
installCmd.Flags().BoolVar(&installNetworkPolicy, "network-policy", defaults.NetworkPolicy,
|
||||
"deny ingress access to the toolkit controllers from other namespaces using network policies")
|
||||
installCmd.Flags().StringVar(&installClusterDomain, "cluster-domain", defaults.ClusterDomain, "internal cluster domain")
|
||||
rootCmd.AddCommand(installCmd)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ The bootstrap sub-commands bootstrap the toolkit components on the targeted Git
|
|||
```
|
||||
--arch arch cluster architecture, available options are: (amd64, arm, arm64) (default amd64)
|
||||
--branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main")
|
||||
--cluster-domain string internal cluster domain (default "cluster.local")
|
||||
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
|
||||
--components-extra strings list of components in addition to those supplied or defaulted, accepts comma-separated values
|
||||
-h, --help help for bootstrap
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ flux bootstrap github [flags]
|
|||
```
|
||||
--arch arch cluster architecture, available options are: (amd64, arm, arm64) (default amd64)
|
||||
--branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main")
|
||||
--cluster-domain string internal cluster domain (default "cluster.local")
|
||||
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
|
||||
--components-extra strings list of components in addition to those supplied or defaulted, accepts comma-separated values
|
||||
--context string kubernetes context to use
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ flux bootstrap gitlab [flags]
|
|||
```
|
||||
--arch arch cluster architecture, available options are: (amd64, arm, arm64) (default amd64)
|
||||
--branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main")
|
||||
--cluster-domain string internal cluster domain (default "cluster.local")
|
||||
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
|
||||
--components-extra strings list of components in addition to those supplied or defaulted, accepts comma-separated values
|
||||
--context string kubernetes context to use
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ flux install [flags]
|
|||
|
||||
```
|
||||
--arch arch cluster architecture, available options are: (amd64, arm, arm64) (default amd64)
|
||||
--cluster-domain string internal cluster domain (default "cluster.local")
|
||||
--components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller])
|
||||
--components-extra strings list of components in addition to those supplied or defaulted, accepts comma-separated values
|
||||
--dry-run only print the object that would be applied
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ type Options struct {
|
|||
ManifestFile string
|
||||
Timeout time.Duration
|
||||
TargetPath string
|
||||
ClusterDomain string
|
||||
}
|
||||
|
||||
func MakeDefaultOptions() Options {
|
||||
|
|
@ -53,6 +54,7 @@ func MakeDefaultOptions() Options {
|
|||
ManifestFile: "gotk-components.yaml",
|
||||
Timeout: time.Minute,
|
||||
TargetPath: "",
|
||||
ClusterDomain: "cluster.local",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ var kustomizationTmpl = `---
|
|||
{{- $registry := .Registry }}
|
||||
{{- $arch := .Arch }}
|
||||
{{- $logLevel := .LogLevel }}
|
||||
{{- $clusterDomain := .ClusterDomain }}
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: {{.Namespace}}
|
||||
|
|
@ -67,6 +68,25 @@ patchesJson6902:
|
|||
- op: replace
|
||||
path: /spec/template/spec/containers/0/args/1
|
||||
value: --log-level={{$logLevel}}
|
||||
{{- else if eq $component "source-controller" }}
|
||||
- target:
|
||||
group: apps
|
||||
version: v1
|
||||
kind: Deployment
|
||||
name: {{$component}}
|
||||
patch: |-
|
||||
- op: replace
|
||||
path: /spec/template/spec/containers/0/args/0
|
||||
value: --events-addr={{$eventsAddr}}
|
||||
- op: replace
|
||||
path: /spec/template/spec/containers/0/args/1
|
||||
value: --watch-all-namespaces={{$watchAllNamespaces}}
|
||||
- op: replace
|
||||
path: /spec/template/spec/containers/0/args/2
|
||||
value: --log-level={{$logLevel}}
|
||||
- op: replace
|
||||
path: /spec/template/spec/containers/0/args/6
|
||||
value: --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.{{$clusterDomain}}.
|
||||
{{- else }}
|
||||
- target:
|
||||
group: apps
|
||||
|
|
|
|||
Loading…
Reference in a new issue