Skip to content

Commit

Permalink
fix: fix some upgrades to make it work with kfddistribution, fix upgr…
Browse files Browse the repository at this point in the history
…ades path
  • Loading branch information
alessiodionisi authored and omissis committed Jan 4, 2024
1 parent be0fefc commit de5af15
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ terraformbin="{{ .paths.terraform }}"

{{ $hasVpnEnabled := (
and
(index .spec.infrastructure "vpn")
(and (index .spec "infrastructure") (index .spec.infrastructure "vpn"))
(
or
(not (index .spec.infrastructure.vpn "instances"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

{{- if index .spec "kubernetes" }}

## master upgrades - only one at a time
{{- range $h := .spec.kubernetes.masters.hosts }}
ansible-playbook 55.upgrade-control-plane.yml --limit "{{ $h.name }}" --become
Expand All @@ -12,3 +14,5 @@ ansible-playbook 55.upgrade-control-plane.yml --limit "{{ $h.name }}" --become
ansible-playbook 56.upgrade-worker-nodes.yml --limit "{{ $h.name }}"
{{- end }}
{{- end }}

{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

{{- if index .spec "kubernetes" }}

## master upgrades - only one at a time
{{- range $h := .spec.kubernetes.masters.hosts }}
ansible-playbook 55.upgrade-control-plane.yml --limit "{{ $h.name }}" --become
Expand All @@ -12,3 +14,5 @@ ansible-playbook 55.upgrade-control-plane.yml --limit "{{ $h.name }}" --become
ansible-playbook 56.upgrade-worker-nodes.yml --limit "{{ $h.name }}"
{{- end }}
{{- end }}

{{- end }}
6 changes: 4 additions & 2 deletions internal/apis/kfd/v1alpha2/common/create/preupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (p *PreUpgrade) Exec() error {
return fmt.Errorf("error writing config file: %w", err)
}

upgradesPath := p.externalUpgradesPath
var upgradesPath string

if p.externalUpgradesPath == "" {
subFS, err := fs.Sub(configs.Tpl, path.Join("upgrades", strings.ToLower(p.kind)))
Expand All @@ -146,11 +146,13 @@ func (p *PreUpgrade) Exec() error {
defer os.RemoveAll(tmpUpgradesFolder)

upgradesPath = tmpUpgradesFolder
} else {
upgradesPath = path.Join(p.externalUpgradesPath, strings.ToLower(p.kind))
}

templateModel, err := template.NewTemplateModel(
upgradesPath,
path.Join(p.Path),
p.Path,
confPath,
outDirPath1,
p.furyctlConfPath,
Expand Down

0 comments on commit de5af15

Please sign in to comment.