Add cluster-domain option for bootstrap command
Signed-off-by: Léopold Jacquot <leopold.jacquot@infomaniak.com>
This commit is contained in:
@@ -59,6 +59,7 @@ var (
|
|||||||
bootstrapLogLevel = flags.LogLevel(defaults.LogLevel)
|
bootstrapLogLevel = flags.LogLevel(defaults.LogLevel)
|
||||||
bootstrapRequiredComponents = []string{"source-controller", "kustomize-controller"}
|
bootstrapRequiredComponents = []string{"source-controller", "kustomize-controller"}
|
||||||
bootstrapTokenAuth bool
|
bootstrapTokenAuth bool
|
||||||
|
bootstrapClusterDomain string
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -87,6 +88,7 @@ func init() {
|
|||||||
"when enabled, the personal access token will be used instead of SSH deploy key")
|
"when enabled, the personal access token will be used instead of SSH deploy key")
|
||||||
bootstrapCmd.PersistentFlags().Var(&bootstrapLogLevel, "log-level", bootstrapLogLevel.Description())
|
bootstrapCmd.PersistentFlags().Var(&bootstrapLogLevel, "log-level", bootstrapLogLevel.Description())
|
||||||
bootstrapCmd.PersistentFlags().StringVar(&bootstrapManifestsPath, "manifests", "", "path to the manifest directory")
|
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")
|
bootstrapCmd.PersistentFlags().MarkHidden("manifests")
|
||||||
rootCmd.AddCommand(bootstrapCmd)
|
rootCmd.AddCommand(bootstrapCmd)
|
||||||
}
|
}
|
||||||
@@ -121,6 +123,7 @@ func generateInstallManifests(targetPath, namespace, tmpDir string, localManifes
|
|||||||
ManifestFile: defaults.ManifestFile,
|
ManifestFile: defaults.ManifestFile,
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
TargetPath: targetPath,
|
TargetPath: targetPath,
|
||||||
|
ClusterDomain: bootstrapClusterDomain,
|
||||||
}
|
}
|
||||||
|
|
||||||
if localManifests == "" {
|
if localManifests == "" {
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ var (
|
|||||||
installNetworkPolicy bool
|
installNetworkPolicy bool
|
||||||
installArch = flags.Arch(defaults.Arch)
|
installArch = flags.Arch(defaults.Arch)
|
||||||
installLogLevel = flags.LogLevel(defaults.LogLevel)
|
installLogLevel = flags.LogLevel(defaults.LogLevel)
|
||||||
|
installClusterDomain string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -89,6 +90,7 @@ func init() {
|
|||||||
installCmd.Flags().Var(&installLogLevel, "log-level", installLogLevel.Description())
|
installCmd.Flags().Var(&installLogLevel, "log-level", installLogLevel.Description())
|
||||||
installCmd.Flags().BoolVar(&installNetworkPolicy, "network-policy", defaults.NetworkPolicy,
|
installCmd.Flags().BoolVar(&installNetworkPolicy, "network-policy", defaults.NetworkPolicy,
|
||||||
"deny ingress access to the toolkit controllers from other namespaces using network policies")
|
"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)
|
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)
|
--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")
|
--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 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
|
--components-extra strings list of components in addition to those supplied or defaulted, accepts comma-separated values
|
||||||
-h, --help help for bootstrap
|
-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)
|
--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")
|
--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 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
|
--components-extra strings list of components in addition to those supplied or defaulted, accepts comma-separated values
|
||||||
--context string kubernetes context to use
|
--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)
|
--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")
|
--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 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
|
--components-extra strings list of components in addition to those supplied or defaulted, accepts comma-separated values
|
||||||
--context string kubernetes context to use
|
--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)
|
--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 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
|
--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
|
--dry-run only print the object that would be applied
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ type Options struct {
|
|||||||
ManifestFile string
|
ManifestFile string
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
TargetPath string
|
TargetPath string
|
||||||
|
ClusterDomain string
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeDefaultOptions() Options {
|
func MakeDefaultOptions() Options {
|
||||||
@@ -53,6 +54,7 @@ func MakeDefaultOptions() Options {
|
|||||||
ManifestFile: "gotk-components.yaml",
|
ManifestFile: "gotk-components.yaml",
|
||||||
Timeout: time.Minute,
|
Timeout: time.Minute,
|
||||||
TargetPath: "",
|
TargetPath: "",
|
||||||
|
ClusterDomain: "cluster.local",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ var kustomizationTmpl = `---
|
|||||||
{{- $registry := .Registry }}
|
{{- $registry := .Registry }}
|
||||||
{{- $arch := .Arch }}
|
{{- $arch := .Arch }}
|
||||||
{{- $logLevel := .LogLevel }}
|
{{- $logLevel := .LogLevel }}
|
||||||
|
{{- $clusterDomain := .ClusterDomain }}
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
namespace: {{.Namespace}}
|
namespace: {{.Namespace}}
|
||||||
@@ -67,6 +68,25 @@ patchesJson6902:
|
|||||||
- op: replace
|
- op: replace
|
||||||
path: /spec/template/spec/containers/0/args/1
|
path: /spec/template/spec/containers/0/args/1
|
||||||
value: --log-level={{$logLevel}}
|
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 }}
|
{{- else }}
|
||||||
- target:
|
- target:
|
||||||
group: apps
|
group: apps
|
||||||
|
|||||||
Reference in New Issue
Block a user