Skip to content

Commit fbd4f86

Browse files
authored
Feat: Add velero to EC (#530)
* update embedded-cluster-kinds * add default velero, include in metadata * install velero when it is enabled in both the cluster spec and license * add velero to autoupdate cron * deploy velero in an integration test * enable snapshots in config * handle empty license file path * typo and rearranging functions * do not use whether velero is enabled * update embedded-cluster-operator to handle velero * print charts * ??? * disable backups/snapshots * enable node agent * set k0s pod volume path * actually wait for velero * test logging * specify latest velero image outside of chart release * reduce CPU and memory requirements for nginx pod * reduce memcached resources * actually upgrade application * cleanup and version test * wait for restic daemonset too * add velero plugin for aws * ? * nope * ??? * test * remove? * put the repo removal in the right action * fix daemonset name * set uploader type to restic
1 parent bcef7be commit fbd4f86

File tree

16 files changed

+388
-7
lines changed

16 files changed

+388
-7
lines changed

.github/actions/e2e/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ inputs:
77
airgap-license-id:
88
description: 'airgap-enabled license id to use for e2e tests'
99
required: true
10+
snapshot-license-id:
11+
description: 'snapshot-enabled license id to use for e2e tests'
12+
required: true
1013
license-id:
1114
description: 'license id to use for e2e tests'
1215
required: true
@@ -69,6 +72,7 @@ runs:
6972
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
7073
export LICENSE_ID=${{ inputs.license-id }}
7174
export AIRGAP_LICENSE_ID=${{ inputs.airgap-license-id }}
75+
export SNAPSHOT_LICENSE_ID=${{ inputs.snapshot-license-id }}
7276
echo "${{ inputs.license }}" | base64 --decode > e2e/license.yaml
7377
export TESTIM_ACCESS_TOKEN=${{ inputs.testim-access-token }}
7478
export TESTIM_BRANCH=${{ inputs.testim-branch }}

.github/workflows/dependencies.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ jobs:
4747
run: |
4848
export VERSION=`curl https://api.github.com/repos/distribution/distribution/tags | jq -r '.[].name' | tr -d v | grep -v alpha | grep -v beta | head -n 1`
4949
sed -i "/^REGISTRY_IMAGE_VERSION/c\REGISTRY_IMAGE_VERSION = $VERSION" Makefile
50+
- name: Velero Chart
51+
run: |
52+
export VERSION=`curl https://api.github.com/repos/vmware-tanzu/helm-charts/tags | jq -r '.[].name' | grep velero | tr -d 'velero-' | head -n 1`
53+
sed -i "/^VELERO_CHART_VERSION/c\VELERO_CHART_VERSION = $VERSION" Makefile
54+
- name: Velero Image
55+
run: |
56+
export VERSION=`curl https://api.github.com/repos/vmware-tanzu/velero/tags | jq -r '.[].name' | grep -v 'rc' | head -n 1`
57+
sed -i "/^VELERO_IMAGE_VERSION/c\VELERO_IMAGE_VERSION = $VERSION" Makefile
58+
- name: Velero AWS Plugin Image
59+
run: |
60+
export VERSION=`curl https://api.github.com/repos/vmware-tanzu/velero-plugin-for-aws/tags | jq -r '.[].name' | grep -v 'rc' | head -n 1`
61+
sed -i "/^VELERO_AWS_PLUGIN_IMAGE_VERSION/c\VELERO_AWS_PLUGIN_IMAGE_VERSION = $VERSION" Makefile
5062
- name: Kubectl
5163
run: |
5264
export VERSION=`curl -L -s https://dl.k8s.io/release/stable.txt`

.github/workflows/pull-request.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ jobs:
184184
- TestMaterialize
185185
- TestLocalArtifactMirror
186186
- TestSingleNodeAirgapUpgradeUbuntuJammy
187+
- TestInstallSnapshotFromReplicatedApp
187188
steps:
188189
- name: Checkout
189190
uses: actions/checkout@v4
@@ -192,10 +193,12 @@ jobs:
192193
with:
193194
name: embedded-release
194195
path: output/bin
196+
195197
- uses: ./.github/actions/e2e
196198
with:
197199
test-name: '${{ matrix.tests }}'
198200
airgap-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
201+
snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
199202
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
200203
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
201204
testim-access-token: ${{ secrets.TESTIM_ACCESS_TOKEN }}

.github/workflows/release-dev.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ jobs:
137137
- TestMaterialize
138138
- TestLocalArtifactMirror
139139
- TestSingleNodeAirgapUpgradeUbuntuJammy
140+
- TestInstallSnapshotFromReplicatedApp
140141
steps:
141142
- name: Checkout
142143
uses: actions/checkout@v4
@@ -149,6 +150,7 @@ jobs:
149150
with:
150151
test-name: '${{ matrix.tests }}'
151152
airgap-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
153+
snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
152154
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
153155
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
154156
testim-access-token: ${{ secrets.TESTIM_ACCESS_TOKEN }}

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ADMIN_CONSOLE_IMAGE_OVERRIDE =
99
ADMIN_CONSOLE_MIGRATIONS_IMAGE_OVERRIDE =
1010
EMBEDDED_OPERATOR_CHART_URL = oci://registry.replicated.com/library
1111
EMBEDDED_OPERATOR_CHART_NAME = embedded-cluster-operator
12-
EMBEDDED_OPERATOR_CHART_VERSION = 0.28.1
12+
EMBEDDED_OPERATOR_CHART_VERSION = 0.28.2
1313
EMBEDDED_OPERATOR_UTILS_IMAGE = busybox:1.36.1
1414
EMBEDDED_CLUSTER_OPERATOR_IMAGE_OVERRIDE =
1515
OPENEBS_CHART_URL = https://openebs.github.io/charts
@@ -20,6 +20,11 @@ REGISTRY_CHART_URL = https://helm.twun.io
2020
REGISTRY_CHART_NAME = twuni/docker-registry
2121
REGISTRY_CHART_VERSION = 2.2.3
2222
REGISTRY_IMAGE_VERSION = 2.8.3
23+
VELERO_CHART_URL = https://vmware-tanzu.github.io/helm-charts
24+
VELERO_CHART_NAME = vmware-tanzu/velero
25+
VELERO_CHART_VERSION = 6.0.0
26+
VELERO_IMAGE_VERSION = v1.13.2
27+
VELERO_AWS_PLUGIN_IMAGE_VERSION = v1.9.2
2328
KUBECTL_VERSION = v1.30.0
2429
K0S_VERSION = v1.29.4+k0s.0
2530
PREVIOUS_K0S_VERSION ?= v1.28.9+k0s.0
@@ -48,7 +53,12 @@ LD_FLAGS = -X github.com/replicatedhq/embedded-cluster/pkg/defaults.K0sVersion=$
4853
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.ChartURL=$(REGISTRY_CHART_URL) \
4954
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.ChartName=$(REGISTRY_CHART_NAME) \
5055
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.Version=$(REGISTRY_CHART_VERSION) \
51-
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.ImageVersion=$(REGISTRY_IMAGE_VERSION)
56+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/registry.ImageVersion=$(REGISTRY_IMAGE_VERSION) \
57+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.ChartURL=$(VELERO_CHART_URL) \
58+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.ChartName=$(VELERO_CHART_NAME) \
59+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.Version=$(VELERO_CHART_VERSION) \
60+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.VeleroTag=$(VELERO_IMAGE_VERSION) \
61+
-X github.com/replicatedhq/embedded-cluster/pkg/addons/velero.AwsPluginTag=$(VELERO_AWS_PLUGIN_IMAGE_VERSION)
5262

5363
.DEFAULT_GOAL := default
5464
default: embedded-cluster-linux-amd64

cmd/embedded-cluster/version.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ func gatherVersionMetadata() (*types.ReleaseMetadata, error) {
144144
return nil, fmt.Errorf("unable to get airgap images: %w", err)
145145
}
146146

147+
// Additional builtin addons
148+
builtinCharts, err := applier.GetBuiltinCharts()
149+
if err != nil {
150+
return nil, fmt.Errorf("unable to get builtin charts: %w", err)
151+
}
152+
meta.BuiltinConfigs = builtinCharts
153+
147154
// Render k0s config to get the images contained within
148155
k0sConfig := config.RenderK0sConfig()
149156
meta.K0sImages = airgap.GetImageURIs(k0sConfig.Spec, true)

e2e/install_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,53 @@ func TestSingleNodeAirgapUpgradeUbuntuJammy(t *testing.T) {
616616
t.Logf("%s: test complete", time.Now().Format(time.RFC3339))
617617
}
618618

619+
func TestInstallSnapshotFromReplicatedApp(t *testing.T) {
620+
t.Parallel()
621+
tc := cluster.NewTestCluster(&cluster.Input{
622+
T: t,
623+
Nodes: 1,
624+
Image: "ubuntu/jammy",
625+
})
626+
defer tc.Destroy()
627+
t.Logf("%s: downloading embedded-cluster on node 0", time.Now().Format(time.RFC3339))
628+
line := []string{"vandoor-prepare.sh", os.Getenv("SHORT_SHA"), os.Getenv("SNAPSHOT_LICENSE_ID"), "false"}
629+
if _, _, err := RunCommandOnNode(t, tc, 0, line); err != nil {
630+
t.Fatalf("fail to download embedded-cluster on node 0 %s: %v", tc.Nodes[0], err)
631+
}
632+
633+
t.Logf("%s: installing embedded-cluster on node 0", time.Now().Format(time.RFC3339))
634+
line = []string{"single-node-install.sh", "cli"}
635+
if _, _, err := RunCommandOnNode(t, tc, 0, line); err != nil {
636+
t.Fatalf("fail to install embedded-cluster on node %s: %v", tc.Nodes[0], err)
637+
}
638+
639+
t.Logf("%s: checking installation state", time.Now().Format(time.RFC3339))
640+
line = []string{"check-installation-state.sh", os.Getenv("SHORT_SHA")}
641+
if _, _, err := RunCommandOnNode(t, tc, 0, line); err != nil {
642+
t.Fatalf("fail to check installation state: %v", err)
643+
}
644+
645+
t.Logf("%s: ensuring velero is installed", time.Now().Format(time.RFC3339))
646+
line = []string{"check-velero-state.sh", os.Getenv("SHORT_SHA")}
647+
if _, _, err := RunCommandOnNode(t, tc, 0, line); err != nil {
648+
t.Fatalf("fail to check velero state: %v", err)
649+
}
650+
651+
t.Logf("%s: running kots upstream upgrade", time.Now().Format(time.RFC3339))
652+
line = []string{"kots-upstream-upgrade.sh", os.Getenv("SHORT_SHA")}
653+
if _, _, err := RunCommandOnNode(t, tc, 0, line); err != nil {
654+
t.Fatalf("fail to run kots upstream upgrade: %v", err)
655+
}
656+
657+
t.Logf("%s: checking installation state after upgrade", time.Now().Format(time.RFC3339))
658+
line = []string{"check-postupgrade-state.sh", os.Getenv("SHORT_SHA")}
659+
if _, _, err := RunCommandOnNode(t, tc, 0, line); err != nil {
660+
t.Fatalf("fail to check postupgrade state: %v", err)
661+
}
662+
663+
t.Logf("%s: test complete", time.Now().Format(time.RFC3339))
664+
}
665+
619666
func downloadAirgapBundle(t *testing.T, versionLabel string, destPath string) string {
620667
// download airgap bundle
621668
airgapURL := fmt.Sprintf("https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci-airgap/%s?airgap=true", versionLabel)

e2e/kots-release-install/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ spec:
2222
image: nginx:1.24-alpine
2323
resources:
2424
limits:
25-
memory: '256Mi'
26-
cpu: '500m'
25+
memory: '64Mi'
26+
cpu: '50m'
2727
env:
2828
- name: APP_SEQUENCE
2929
value: "{{repl Cursor }}"

e2e/kots-release-upgrade/cluster-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ spec:
6767
- chartname: oci://registry-1.docker.io/bitnamicharts/memcached
6868
name: memcached
6969
namespace: memcached
70-
values: "abc: xyz"
70+
values: |
71+
volumePermissions:
72+
resources:
73+
requests:
74+
cpu: 25m
75+
memory: 128Mi
76+
limits:
77+
cpu: 25m
78+
memory: 256Mi
7179
order: 4
7280
version: 6.6.4

e2e/kots-release-upgrade/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ spec:
2222
image: nginx:1.25-alpine
2323
resources:
2424
limits:
25-
memory: '256Mi'
26-
cpu: '500m'
25+
memory: '64Mi'
26+
cpu: '50m'
2727
env:
2828
- name: APP_SEQUENCE
2929
value: "{{repl Cursor }}"

0 commit comments

Comments
 (0)