Skip to content

Commit cdaf41b

Browse files
authored
chore(velero): update version to 1.16 (#2215)
* updated velero version * fix * f * f * f * f * f * f --------- Co-authored-by: emosbaugh <[email protected]>
1 parent 36076c9 commit cdaf41b

File tree

10 files changed

+177
-41
lines changed

10 files changed

+177
-41
lines changed

pkg/addons/install.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ func getAddOnsForInstall(opts InstallOptions) []types.AddOn {
8888

8989
if opts.DisasterRecoveryEnabled {
9090
addOns = append(addOns, &velero.Velero{
91-
ProxyRegistryDomain: domains.ProxyRegistryDomain,
92-
Proxy: opts.Proxy,
93-
HostCABundlePath: opts.HostCABundlePath,
91+
ProxyRegistryDomain: domains.ProxyRegistryDomain,
92+
Proxy: opts.Proxy,
93+
HostCABundlePath: opts.HostCABundlePath,
94+
EmbeddedClusterK0sSubDir: runtimeconfig.EmbeddedClusterK0sSubDir(),
9495
})
9596
}
9697

@@ -122,9 +123,10 @@ func getAddOnsForRestore(opts InstallOptions) []types.AddOn {
122123
ProxyRegistryDomain: domains.ProxyRegistryDomain,
123124
},
124125
&velero.Velero{
125-
Proxy: opts.Proxy,
126-
ProxyRegistryDomain: domains.ProxyRegistryDomain,
127-
HostCABundlePath: opts.HostCABundlePath,
126+
Proxy: opts.Proxy,
127+
ProxyRegistryDomain: domains.ProxyRegistryDomain,
128+
HostCABundlePath: opts.HostCABundlePath,
129+
EmbeddedClusterK0sSubDir: runtimeconfig.EmbeddedClusterK0sSubDir(),
128130
},
129131
}
130132
return addOns

pkg/addons/upgrade.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ func getAddOnsForUpgrade(in *ecv1beta1.Installation, meta *ectypes.ReleaseMetada
102102

103103
if in.Spec.LicenseInfo != nil && in.Spec.LicenseInfo.IsDisasterRecoverySupported {
104104
addOns = append(addOns, &velero.Velero{
105-
Proxy: in.Spec.Proxy,
106-
ProxyRegistryDomain: domains.ProxyRegistryDomain,
107-
HostCABundlePath: hostCABundlePath,
105+
Proxy: in.Spec.Proxy,
106+
ProxyRegistryDomain: domains.ProxyRegistryDomain,
107+
HostCABundlePath: hostCABundlePath,
108+
EmbeddedClusterK0sSubDir: runtimeconfig.EmbeddedClusterK0sSubDir(),
108109
})
109110
}
110111

pkg/addons/velero/integration/hostcabundle_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,28 @@ func TestHostCABundle(t *testing.T) {
4646
require.NotNil(t, veleroDeploy, "Velero deployment should not be nil")
4747
require.NotNil(t, nodeAgentDaemonSet, "NodeAgent daemonset should not be nil")
4848

49+
var envVar *corev1.EnvVar
50+
for _, v := range veleroDeploy.Spec.Template.Spec.Containers[0].Env {
51+
if v.Name == "SSL_CERT_DIR" {
52+
envVar = &v
53+
break
54+
}
55+
}
56+
if assert.NotNil(t, envVar, "Velero SSL_CERT_DIR environment variable should not be nil") {
57+
assert.Equal(t, envVar.Value, "/certs")
58+
}
59+
60+
envVar = nil
61+
for _, v := range nodeAgentDaemonSet.Spec.Template.Spec.Containers[0].Env {
62+
if v.Name == "SSL_CERT_DIR" {
63+
envVar = &v
64+
break
65+
}
66+
}
67+
if assert.NotNil(t, envVar, "NodeAgent daemonset SSL_CERT_DIR environment variable should not be nil") {
68+
assert.Equal(t, envVar.Value, "/certs")
69+
}
70+
4971
var volume *corev1.Volume
5072
for _, v := range veleroDeploy.Spec.Template.Spec.Volumes {
5173
if v.Name == "host-ca-bundle" {
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package integration
2+
3+
import (
4+
"context"
5+
"path/filepath"
6+
"strings"
7+
"testing"
8+
9+
"github.com/replicatedhq/embedded-cluster/pkg/addons/velero"
10+
"github.com/replicatedhq/embedded-cluster/pkg/helm"
11+
"github.com/stretchr/testify/assert"
12+
"github.com/stretchr/testify/require"
13+
appsv1 "k8s.io/api/apps/v1"
14+
corev1 "k8s.io/api/core/v1"
15+
"sigs.k8s.io/yaml"
16+
)
17+
18+
func TestK0sDir(t *testing.T) {
19+
k0sDir := filepath.Join(t.TempDir(), "k0s")
20+
addon := &velero.Velero{
21+
DryRun: true,
22+
EmbeddedClusterK0sSubDir: k0sDir,
23+
}
24+
25+
hcli, err := helm.NewClient(helm.HelmOptions{})
26+
require.NoError(t, err, "NewClient should not return an error")
27+
28+
err = addon.Install(context.Background(), t.Logf, nil, hcli, nil, nil)
29+
require.NoError(t, err, "velero.Install should not return an error")
30+
31+
manifests := addon.DryRunManifests()
32+
require.NotEmpty(t, manifests, "DryRunManifests should not be empty")
33+
34+
var nodeAgentDaemonSet *appsv1.DaemonSet
35+
for _, manifest := range manifests {
36+
if strings.Contains(string(manifest), "# Source: velero/templates/node-agent-daemonset.yaml") {
37+
err := yaml.Unmarshal(manifest, &nodeAgentDaemonSet)
38+
require.NoError(t, err, "Failed to unmarshal Velero node agent daemonset")
39+
}
40+
}
41+
42+
require.NotNil(t, nodeAgentDaemonSet, "NodeAgent daemonset should not be nil")
43+
44+
var hostPodsVolume, hostPluginsVolume *corev1.Volume
45+
for _, v := range nodeAgentDaemonSet.Spec.Template.Spec.Volumes {
46+
if v.Name == "host-pods" {
47+
hostPodsVolume = &v
48+
}
49+
if v.Name == "host-plugins" {
50+
hostPluginsVolume = &v
51+
}
52+
}
53+
if assert.NotNil(t, hostPodsVolume, "Velero host-pods volume should not be nil") {
54+
assert.Equal(t, hostPodsVolume.VolumeSource.HostPath.Path, k0sDir+"/kubelet/pods")
55+
}
56+
if assert.NotNil(t, hostPluginsVolume, "Velero host-plugins volume should not be nil") {
57+
assert.Equal(t, hostPluginsVolume.VolumeSource.HostPath.Path, k0sDir+"/kubelet/plugins")
58+
}
59+
}

pkg/addons/velero/static/metadata.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55
# $ make buildtools
66
# $ output/bin/buildtools update addon <addon name>
77
#
8-
version: 8.5.0
8+
version: 10.0.1
99
location: oci://proxy.replicated.com/anonymous/registry.replicated.com/ec-charts/velero
1010
images:
1111
kubectl:
1212
repo: proxy.replicated.com/anonymous/replicated/ec-kubectl
1313
tag:
14-
amd64: 1.33.1-r1-amd64@sha256:5c2c30d0c7c7487e563a99f12eb4e486cc7d5c873b3e02e43f161c1e13d2a427
15-
arm64: 1.33.1-r1-arm64@sha256:4c532d484cfe82030d34df937d11539f1191635aaee299b9a614b06586210d02
14+
amd64: 1.33.1-r2-amd64@sha256:d12713fa87e9bd0f8c276e909ec86cc385c45a41449fc4df288bfe53ee1404ce
15+
arm64: 1.33.1-r2-arm64@sha256:829211426dd63d8bd54f6e93edfa360088bebc0dfe44bcdf4fc93d2a5736247a
1616
velero:
1717
repo: proxy.replicated.com/anonymous/replicated/ec-velero
1818
tag:
19-
amd64: 1.15.2-r7-amd64@sha256:70ce38cb610535d5fc42173fa14d4d39fed89724333e5cb567de3355fdc15f74
20-
arm64: 1.15.2-r7-arm64@sha256:94864b07214fea81bf87cb6d6f62ae9fd8bfd273f42c09e53efac8c5c83d1632
19+
amd64: 1.16.1-r0-amd64@sha256:a4dc13ebad06ed8a4e04eaea7f7aaf46028c8c868bcf095b220392d85a467d75
20+
arm64: 1.16.1-r0-arm64@sha256:3f1752a3c6c8e97e1073aa093111e253c4987434f99fcf721ab92ef053536e16
2121
velero-plugin-for-aws:
2222
repo: proxy.replicated.com/anonymous/replicated/ec-velero-plugin-for-aws
2323
tag:
24-
amd64: 1.11.1-r32-amd64@sha256:9c7a4f092a9c103630c1dcb75d49bdf23616e7ea6fccc96c898d1ef0d36eb99f
25-
arm64: 1.11.1-r32-arm64@sha256:16a7969df546ac49bdd87bc71c0d06ba0123dd51445d1b61552760f3e9dcc55e
24+
amd64: 1.12.1-r0-amd64@sha256:d37d0abacfafe9c1b4c6c8ae6540549897e00c99cca9d5bcdb21057eef7ce635
25+
arm64: 1.12.1-r0-arm64@sha256:ffa59576bb9eb876dc54eb7b7f0056018b9c96e691aacc443d3b15a0c5d9fa80
2626
velero-restore-helper:
2727
repo: proxy.replicated.com/anonymous/replicated/ec-velero-restore-helper
2828
tag:
29-
amd64: 1.15.2-r7-amd64@sha256:30bc6935e5340c193cbba5245372e8ad19efb711a2cd91a1e614f083db5a98aa
30-
arm64: 1.15.2-r7-arm64@sha256:614b435f4b5da3550e1d3fecc92bf9a126b04c7744da461209f14bb41f9ff66b
29+
amd64: 1.16.1-r0-amd64@sha256:0f910e5162c9502e068735d38fa4b594fec9af598c2afc83bdec279a4438f7b9
30+
arm64: 1.16.1-r0-arm64@sha256:7bdcdcc4a627cf44877fef4e9515fdcb02d9d6ec3855d1d136cec27a2bf4d08e

pkg/addons/velero/static/values.tpl.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ configMaps:
2727
{{- end }}
2828
nodeAgent:
2929
podVolumePath: /var/lib/embedded-cluster/k0s/kubelet/pods
30+
pluginVolumePath: /var/lib/embedded-cluster/k0s/kubelet/plugins
3031
snapshotsEnabled: false
3132
affinity:
3233
nodeAffinity:

pkg/addons/velero/values.go

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77

88
"github.com/pkg/errors"
99
"github.com/replicatedhq/embedded-cluster/pkg/helm"
10-
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig"
1110
"sigs.k8s.io/controller-runtime/pkg/client"
1211
)
1312

@@ -28,14 +27,25 @@ func (v *Velero) GenerateHelmValues(ctx context.Context, kcli client.Client, ove
2827
return nil, errors.Wrap(err, "unmarshal helm values")
2928
}
3029

31-
extraEnvVars := map[string]any{}
30+
extraEnvVars := []map[string]any{}
3231
extraVolumes := []map[string]any{}
3332
extraVolumeMounts := []map[string]any{}
3433

3534
if v.Proxy != nil {
36-
extraEnvVars["HTTP_PROXY"] = v.Proxy.HTTPProxy
37-
extraEnvVars["HTTPS_PROXY"] = v.Proxy.HTTPSProxy
38-
extraEnvVars["NO_PROXY"] = v.Proxy.NoProxy
35+
extraEnvVars = append(extraEnvVars, []map[string]any{
36+
{
37+
"name": "HTTP_PROXY",
38+
"value": v.Proxy.HTTPProxy,
39+
},
40+
{
41+
"name": "HTTPS_PROXY",
42+
"value": v.Proxy.HTTPSProxy,
43+
},
44+
{
45+
"name": "NO_PROXY",
46+
"value": v.Proxy.NoProxy,
47+
},
48+
}...)
3949
}
4050

4151
if v.HostCABundlePath != "" {
@@ -52,7 +62,10 @@ func (v *Velero) GenerateHelmValues(ctx context.Context, kcli client.Client, ove
5262
"mountPath": "/certs/ca-certificates.crt",
5363
})
5464

55-
extraEnvVars["SSL_CERT_DIR"] = "/certs"
65+
extraEnvVars = append(extraEnvVars, map[string]any{
66+
"name": "SSL_CERT_DIR",
67+
"value": "/certs",
68+
})
5669
}
5770

5871
copiedValues["configuration"] = map[string]any{
@@ -66,11 +79,16 @@ func (v *Velero) GenerateHelmValues(ctx context.Context, kcli client.Client, ove
6679
"extraVolumeMounts": extraVolumeMounts,
6780
}
6881

69-
podVolumePath := filepath.Join(runtimeconfig.EmbeddedClusterK0sSubDir(), "kubelet/pods")
82+
podVolumePath := filepath.Join(v.EmbeddedClusterK0sSubDir, "kubelet/pods")
7083
err = helm.SetValue(copiedValues, "nodeAgent.podVolumePath", podVolumePath)
7184
if err != nil {
7285
return nil, errors.Wrap(err, "set helm value nodeAgent.podVolumePath")
7386
}
87+
pluginVolumePath := filepath.Join(v.EmbeddedClusterK0sSubDir, "kubelet/plugins")
88+
err = helm.SetValue(copiedValues, "nodeAgent.pluginVolumePath", pluginVolumePath)
89+
if err != nil {
90+
return nil, errors.Wrap(err, "set helm value nodeAgent.pluginVolumePath")
91+
}
7492

7593
for _, override := range overrides {
7694
copiedValues, err = helm.PatchValues(copiedValues, override)

pkg/addons/velero/values_test.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestGenerateHelmValues_HostCABundlePath(t *testing.T) {
2525
require.Len(t, values["extraVolumeMounts"], 1)
2626

2727
require.IsType(t, map[string]any{}, values["configuration"])
28-
require.IsType(t, map[string]any{}, values["configuration"].(map[string]any)["extraEnvVars"])
28+
require.IsType(t, []map[string]any{}, values["configuration"].(map[string]any)["extraEnvVars"])
2929

3030
require.IsType(t, map[string]any{}, values["nodeAgent"])
3131
require.IsType(t, []map[string]any{}, values["nodeAgent"].(map[string]any)["extraVolumes"])
@@ -41,8 +41,17 @@ func TestGenerateHelmValues_HostCABundlePath(t *testing.T) {
4141
assert.Equal(t, "host-ca-bundle", extraVolumeMount["name"])
4242
assert.Equal(t, "/certs/ca-certificates.crt", extraVolumeMount["mountPath"])
4343

44-
extraEnvVars := values["configuration"].(map[string]any)["extraEnvVars"].(map[string]any)
45-
assert.Equal(t, "/certs", extraEnvVars["SSL_CERT_DIR"])
44+
extraEnvVars := values["configuration"].(map[string]any)["extraEnvVars"].([]map[string]any)
45+
// Find the SSL_CERT_DIR environment variable
46+
var foundSSLCertDir bool
47+
for _, env := range extraEnvVars {
48+
if env["name"] == "SSL_CERT_DIR" {
49+
assert.Equal(t, "/certs", env["value"])
50+
foundSSLCertDir = true
51+
break
52+
}
53+
}
54+
assert.True(t, foundSSLCertDir, "SSL_CERT_DIR environment variable should be set")
4655

4756
extraVolumes := values["nodeAgent"].(map[string]any)["extraVolumes"].([]map[string]any)
4857
assert.Equal(t, "/etc/ssl/certs/ca-certificates.crt", extraVolumes[0]["hostPath"].(map[string]any)["path"])

pkg/addons/velero/velero.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ import (
1818
var _ types.AddOn = (*Velero)(nil)
1919

2020
type Velero struct {
21-
Proxy *ecv1beta1.ProxySpec
22-
ProxyRegistryDomain string
23-
HostCABundlePath string
21+
Proxy *ecv1beta1.ProxySpec
22+
ProxyRegistryDomain string
23+
HostCABundlePath string
24+
EmbeddedClusterK0sSubDir string
2425

2526
// DryRun is a flag to enable dry-run mode for Velero.
2627
// If true, Velero will only render the helm template and additional manifests, but not install

tests/dryrun/install_test.go

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ func TestHTTPProxyWithCABundleConfiguration(t *testing.T) {
603603

604604
// Set HTTP proxy environment variables
605605
t.Setenv("HTTP_PROXY", "http://localhost:3128")
606-
t.Setenv("HTTPS_PROXY", "http://localhost:3128")
606+
t.Setenv("HTTPS_PROXY", "https://localhost:3128")
607607
t.Setenv("NO_PROXY", "localhost,127.0.0.1,10.0.0.0/8")
608608

609609
dr := dryrunInstall(t, &dryrun.Client{HelmClient: hcli})
@@ -635,7 +635,7 @@ func TestHTTPProxyWithCABundleConfiguration(t *testing.T) {
635635
},
636636
{
637637
"name": "HTTPS_PROXY",
638-
"value": "http://localhost:3128",
638+
"value": "https://localhost:3128",
639639
},
640640
{
641641
"name": "NO_PROXY",
@@ -669,11 +669,23 @@ func TestHTTPProxyWithCABundleConfiguration(t *testing.T) {
669669
assert.Equal(t, "velero", veleroOpts.ReleaseName)
670670

671671
assertHelmValues(t, veleroOpts.Values, map[string]any{
672-
"configuration.extraEnvVars": map[string]any{
673-
"HTTPS_PROXY": "http://localhost:3128",
674-
"HTTP_PROXY": "http://localhost:3128",
675-
"NO_PROXY": noProxy,
676-
"SSL_CERT_DIR": "/certs",
672+
"configuration.extraEnvVars": []map[string]any{
673+
{
674+
"name": "HTTP_PROXY",
675+
"value": "http://localhost:3128",
676+
},
677+
{
678+
"name": "HTTPS_PROXY",
679+
"value": "https://localhost:3128",
680+
},
681+
{
682+
"name": "NO_PROXY",
683+
"value": noProxy,
684+
},
685+
{
686+
"name": "SSL_CERT_DIR",
687+
"value": "/certs",
688+
},
677689
},
678690
"extraVolumes": []map[string]any{{
679691
"name": "host-ca-bundle",
@@ -686,6 +698,17 @@ func TestHTTPProxyWithCABundleConfiguration(t *testing.T) {
686698
"mountPath": "/certs/ca-certificates.crt",
687699
"name": "host-ca-bundle",
688700
}},
701+
"nodeAgent.extraVolumes": []map[string]any{{
702+
"name": "host-ca-bundle",
703+
"hostPath": map[string]any{
704+
"path": hostCABundle,
705+
"type": "FileOrCreate",
706+
},
707+
}},
708+
"nodeAgent.extraVolumeMounts": []map[string]any{{
709+
"mountPath": "/certs/ca-certificates.crt",
710+
"name": "host-ca-bundle",
711+
}},
689712
})
690713

691714
// admin console
@@ -705,7 +728,7 @@ func TestHTTPProxyWithCABundleConfiguration(t *testing.T) {
705728
},
706729
{
707730
"name": "HTTPS_PROXY",
708-
"value": "http://localhost:3128",
731+
"value": "https://localhost:3128",
709732
},
710733
{
711734
"name": "NO_PROXY",
@@ -739,15 +762,15 @@ func TestHTTPProxyWithCABundleConfiguration(t *testing.T) {
739762
return hc.HTTP != nil && hc.HTTP.CollectorName == "http-replicated-app"
740763
},
741764
validate: func(hc *troubleshootv1beta2.HostCollect) {
742-
assert.Equal(t, "http://localhost:3128", hc.HTTP.Get.Proxy)
765+
assert.Equal(t, "https://localhost:3128", hc.HTTP.Get.Proxy)
743766
},
744767
},
745768
"http-proxy-replicated-com": {
746769
match: func(hc *troubleshootv1beta2.HostCollect) bool {
747770
return hc.HTTP != nil && hc.HTTP.CollectorName == "http-proxy-replicated-com"
748771
},
749772
validate: func(hc *troubleshootv1beta2.HostCollect) {
750-
assert.Equal(t, "http://localhost:3128", hc.HTTP.Get.Proxy)
773+
assert.Equal(t, "https://localhost:3128", hc.HTTP.Get.Proxy)
751774
},
752775
},
753776
})

0 commit comments

Comments
 (0)