mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-09 09:17:27 +00:00
Add linux/amd64 node selector to controllers
Set nodeSelector to linux/amd64 for clusters with mixed nodes (linux, windows, amd64, arm).
This commit is contained in:
parent
10cc6d7e08
commit
aebad92426
1 changed files with 24 additions and 0 deletions
|
|
@ -188,8 +188,10 @@ var kustomizationTmpl = `---
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: {{.Namespace}}
|
||||
|
||||
transformers:
|
||||
- labels.yaml
|
||||
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- policies.yaml
|
||||
|
|
@ -198,6 +200,11 @@ resources:
|
|||
- {{.}}.yaml
|
||||
{{- end }}
|
||||
|
||||
patches:
|
||||
- path: node-selector.yaml
|
||||
target:
|
||||
kind: Deployment
|
||||
|
||||
patchesJson6902:
|
||||
{{- range $i, $v := .Components }}
|
||||
{{- if ne $v "notification-controller" }}
|
||||
|
|
@ -222,6 +229,19 @@ resources:
|
|||
nameSuffix: -{{.Namespace}}
|
||||
`
|
||||
|
||||
var nodeSelectorTmpl = `---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: all
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
kubernetes.io/os: linux
|
||||
`
|
||||
|
||||
func downloadManifests(version string, tmpDir string) error {
|
||||
ghURL := "https://github.com/fluxcd/toolkit/releases/latest/download/manifests.tar.gz"
|
||||
if strings.HasPrefix(version, "v") {
|
||||
|
|
@ -286,6 +306,10 @@ func genInstallManifests(version string, namespace string, components []string,
|
|||
return fmt.Errorf("generate labels failed: %w", err)
|
||||
}
|
||||
|
||||
if err := utils.execTemplate(model, nodeSelectorTmpl, path.Join(tmpDir, "node-selector.yaml")); err != nil {
|
||||
return fmt.Errorf("generate node selector failed: %w", err)
|
||||
}
|
||||
|
||||
if err := utils.execTemplate(model, kustomizationTmpl, path.Join(tmpDir, "kustomization.yaml")); err != nil {
|
||||
return fmt.Errorf("generate kustomization failed: %w", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue