Skip to content

Commit

Permalink
feat: add sed as tool dependency and support 1.29.4 (#537)
Browse files Browse the repository at this point in the history
* feat: add support for custom registry

* feat: update docs and compatibility

* deps: use latest v1.29.4 RC

* fix(get-kubeconfig): retrieve absolute path to config file (#539)

Fixes an issue with path interpolations, where relative paths would not be converted to absolute paths

* deps: use v1.29.4 distribution

* feat: add upgrade paths

---------

Co-authored-by: Riccardo Cannella <44730210+Rick-1990@users.noreply.github.com>
  • Loading branch information
alessiodionisi and speziato authored Sep 23, 2024
1 parent 1b1e0b2 commit e11062d
Show file tree
Hide file tree
Showing 20 changed files with 313 additions and 40 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<p>The Swiss Army Knife<br/>for the Kubernetes Fury Distribution</p>

[![Build Status](https://ci.sighup.io/api/badges/sighupio/furyctl/status.svg?ref=refs/heads/main)](https://ci.sighup.io/sighupio/furyctl)
![Release](https://img.shields.io/badge/furyctl-v0.29.6-blue)
![Release](https://img.shields.io/badge/furyctl-v0.29.7-blue)
![Slack](https://img.shields.io/badge/slack-@kubernetes/fury-yellow.svg?logo=slack)
![License](https://img.shields.io/github/license/sighupio/furyctl)
[![Go Report Card](https://goreportcard.com/badge/github.com/sighupio/furyctl)](https://goreportcard.com/report/github.com/sighupio/furyctl)
Expand Down Expand Up @@ -69,7 +69,7 @@ $ furyctl version
...
goVersion: go1.22
osArch: amd64
version: 0.29.6
version: 0.29.7
```

### Installing from source
Expand Down
18 changes: 14 additions & 4 deletions cmd/get/kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"

"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -71,6 +72,15 @@ func NewKubeconfigCmd() *cobra.Command {
return fmt.Errorf("error while getting current directory: %w", err)
}

// Get absolute path to the config file.
absFuryctlPath, err := filepath.Abs(furyctlPath)
if err != nil {
cmdEvent.AddErrorMessage(err)
tracker.Track(cmdEvent)

return fmt.Errorf("error while getting config directory: %w", err)
}

// Get home dir.
logrus.Debug("Getting Home directory path...")
homeDir, err := os.UserHomeDir()
Expand All @@ -97,7 +107,7 @@ func NewKubeconfigCmd() *cobra.Command {
executor := execx.NewStdExecutor()

distrodl := &dist.Downloader{}
depsvl := dependencies.NewValidator(executor, binPath, furyctlPath, false)
depsvl := dependencies.NewValidator(executor, binPath, absFuryctlPath, false)

// Init first half of collaborators.
client := netx.NewGoGetterClient()
Expand All @@ -119,7 +129,7 @@ func NewKubeconfigCmd() *cobra.Command {
// Download the distribution.
logrus.Info("Downloading distribution...")

res, err := distrodl.Download(distroLocation, furyctlPath)
res, err := distrodl.Download(distroLocation, absFuryctlPath)
if err != nil {
cmdEvent.AddErrorMessage(err)
tracker.Track(cmdEvent)
Expand All @@ -134,7 +144,7 @@ func NewKubeconfigCmd() *cobra.Command {

// Validate the furyctl.yaml file.
logrus.Info("Validating configuration file...")
if err := config.Validate(furyctlPath, res.RepoPath); err != nil {
if err := config.Validate(absFuryctlPath, res.RepoPath); err != nil {
cmdEvent.AddErrorMessage(err)
tracker.Track(cmdEvent)

Expand Down Expand Up @@ -163,7 +173,7 @@ func NewKubeconfigCmd() *cobra.Command {
}
}

getter, err := cluster.NewKubeconfigGetter(res.MinimalConf, res.DistroManifest, res.RepoPath, furyctlPath, outDir)
getter, err := cluster.NewKubeconfigGetter(res.MinimalConf, res.DistroManifest, res.RepoPath, absFuryctlPath, outDir)
if err != nil {
cmdEvent.AddErrorMessage(err)
tracker.Track(cmdEvent)
Expand Down
10 changes: 10 additions & 0 deletions configs/upgrades/onpremises/1.27.8-1.27.9/pre-distribution.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

set -e

kubectlbin="{{ .paths.kubectl }}"

# Remove some validating webhooks during the upgrade
{{- if eq .spec.distribution.modules.policy.type "gatekeeper" }}
$kubectlbin delete --ignore-not-found=true validatingwebhookconfiguration gatekeeper-validating-webhook-configuration
{{- end }}
10 changes: 10 additions & 0 deletions configs/upgrades/onpremises/1.27.9-1.28.4/pre-distribution.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

set -e

kubectlbin="{{ .paths.kubectl }}"

# Remove some validating webhooks during the upgrade
{{- if eq .spec.distribution.modules.policy.type "gatekeeper" }}
$kubectlbin delete --ignore-not-found=true validatingwebhookconfiguration gatekeeper-validating-webhook-configuration
{{- end }}
20 changes: 20 additions & 0 deletions configs/upgrades/onpremises/1.27.9-1.28.4/pre-kubernetes.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh

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
{{- end }}

{{- if ne .upgrade.skipNodesUpgrade true }}
{{- range $n := .spec.kubernetes.nodes }}
{{- range $h := $n.hosts }}
ansible-playbook 56.upgrade-worker-nodes.yml --limit "{{ $h.name }}"
{{- end }}
{{- end }}
{{- end }}

{{- end }}
10 changes: 10 additions & 0 deletions configs/upgrades/onpremises/1.28.3-1.28.4/pre-distribution.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

set -e

kubectlbin="{{ .paths.kubectl }}"

# Remove some validating webhooks during the upgrade
{{- if eq .spec.distribution.modules.policy.type "gatekeeper" }}
$kubectlbin delete --ignore-not-found=true validatingwebhookconfiguration gatekeeper-validating-webhook-configuration
{{- end }}
10 changes: 10 additions & 0 deletions configs/upgrades/onpremises/1.28.4-1.29.4/pre-distribution.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

set -e

kubectlbin="{{ .paths.kubectl }}"

# Remove some validating webhooks during the upgrade
{{- if eq .spec.distribution.modules.policy.type "gatekeeper" }}
$kubectlbin delete --ignore-not-found=true validatingwebhookconfiguration gatekeeper-validating-webhook-configuration
{{- end }}
20 changes: 20 additions & 0 deletions configs/upgrades/onpremises/1.28.4-1.29.4/pre-kubernetes.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh

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
{{- end }}

{{- if ne .upgrade.skipNodesUpgrade true }}
{{- range $n := .spec.kubernetes.nodes }}
{{- range $h := $n.hosts }}
ansible-playbook 56.upgrade-worker-nodes.yml --limit "{{ $h.name }}"
{{- end }}
{{- end }}
{{- end }}

{{- end }}
10 changes: 10 additions & 0 deletions configs/upgrades/onpremises/1.29.3-1.29.4/pre-distribution.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

set -e

kubectlbin="{{ .paths.kubectl }}"

# Remove some validating webhooks during the upgrade
{{- if eq .spec.distribution.modules.policy.type "gatekeeper" }}
$kubectlbin delete --ignore-not-found=true validatingwebhookconfiguration gatekeeper-validating-webhook-configuration
{{- end }}
Loading

0 comments on commit e11062d

Please sign in to comment.