Merge pull request #127 from fluxcd/node-selector

Add linux/amd64 node selector to controllers
pull/128/head
Stefan Prodan 5 years ago committed by GitHub
commit efb39d6fc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -188,8 +188,10 @@ var kustomizationTmpl = `---
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
namespace: {{.Namespace}} namespace: {{.Namespace}}
transformers: transformers:
- labels.yaml - labels.yaml
resources: resources:
- namespace.yaml - namespace.yaml
- policies.yaml - policies.yaml
@ -198,6 +200,11 @@ resources:
- {{.}}.yaml - {{.}}.yaml
{{- end }} {{- end }}
patches:
- path: node-selector.yaml
target:
kind: Deployment
patchesJson6902: patchesJson6902:
{{- range $i, $v := .Components }} {{- range $i, $v := .Components }}
{{- if ne $v "notification-controller" }} {{- if ne $v "notification-controller" }}
@ -222,6 +229,19 @@ resources:
nameSuffix: -{{.Namespace}} 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 { func downloadManifests(version string, tmpDir string) error {
ghURL := "https://github.com/fluxcd/toolkit/releases/latest/download/manifests.tar.gz" ghURL := "https://github.com/fluxcd/toolkit/releases/latest/download/manifests.tar.gz"
if strings.HasPrefix(version, "v") { 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) 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 { if err := utils.execTemplate(model, kustomizationTmpl, path.Join(tmpDir, "kustomization.yaml")); err != nil {
return fmt.Errorf("generate kustomization failed: %w", err) return fmt.Errorf("generate kustomization failed: %w", err)
} }

Loading…
Cancel
Save