Skip to content

Commit bbf19c5

Browse files
authored
KubeVirt Default Image (#563)
* KubeVirt Plugin * Add kubevirt to defaultPlugins used in e2e * add kubevirt to alm-examples * switched to konveyor * set ENV * remove redundant entry. Already added plugin to settings.json
1 parent fbab17b commit bbf19c5

File tree

12 files changed

+84
-4
lines changed

12 files changed

+84
-4
lines changed

api/v1alpha1/oadp_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const DefaultPluginGCP DefaultPlugin = "gcp"
3838
const DefaultPluginMicrosoftAzure DefaultPlugin = "azure"
3939
const DefaultPluginCSI DefaultPlugin = "csi"
4040
const DefaultPluginOpenShift DefaultPlugin = "openshift"
41+
const DefaultPluginKubeVirt DefaultPlugin = "kubevirt"
4142

4243
type CustomPlugin struct {
4344
Name string `json:"name"`
@@ -54,6 +55,7 @@ const GCPPluginImageKey UnsupportedImageKey = "gcpPluginImageFqin"
5455
const CSIPluginImageKey UnsupportedImageKey = "csiPluginImageFqin"
5556
const ResticRestoreImageKey UnsupportedImageKey = "resticRestoreImageFqin"
5657
const RegistryImageKey UnsupportedImageKey = "registryImageFqin"
58+
const KubeVirtPluginImageKey UnsupportedImageKey = "kubevirtPluginImageFqin"
5759

5860
type VeleroConfig struct {
5961
// FeatureFlags defines the list of features to enable for Velero instance

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/oadp-operator.clusterserviceversion.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ metadata:
3838
"velero": {
3939
"defaultPlugins": [
4040
"openshift",
41-
"aws"
41+
"aws",
42+
"kubevirt"
4243
]
4344
}
4445
},
@@ -479,6 +480,8 @@ spec:
479480
value: velero-plugin-for-gcp
480481
- name: VELERO_AZURE_PLUGIN_REPO
481482
value: velero-plugin-for-microsoft-azure
483+
- name: VELERO_KUBEVIRT_PLUGIN_REPO
484+
value: kubevirt-velero-plugin
482485
- name: VELERO_CSI_PLUGIN_REPO
483486
value: velero-plugin-for-csi
484487
- name: VELERO_TAG
@@ -493,6 +496,8 @@ spec:
493496
value: latest
494497
- name: VELERO_CSI_PLUGIN_TAG
495498
value: latest
499+
- name: VELERO_KUBEVIRT_PLUGIN_TAG
500+
value: 0.2.0
496501
image: quay.io/konveyor/oadp-operator:latest
497502
imagePullPolicy: Always
498503
livenessProbe:
@@ -615,4 +620,6 @@ spec:
615620
name: csi_plugin
616621
- image: quay.io/konveyor/registry:latest
617622
name: registry
623+
- image: quay.io/konveyor/kubevirt-velero-plugin:v0.2.0
624+
name: kubevirt_plugin
618625
version: 99.0.0

config/manager/manager.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ spec:
5959
value: velero-plugin-for-gcp
6060
- name: VELERO_AZURE_PLUGIN_REPO
6161
value: velero-plugin-for-microsoft-azure
62+
- name: VELERO_KUBEVIRT_PLUGIN_REPO
63+
value: kubevirt-velero-plugin
6264
- name: VELERO_CSI_PLUGIN_REPO
6365
value: velero-plugin-for-csi
6466
- name: VELERO_TAG
@@ -73,6 +75,8 @@ spec:
7375
value: latest
7476
- name: VELERO_CSI_PLUGIN_TAG
7577
value: latest
78+
- name: VELERO_KUBEVIRT_PLUGIN_TAG
79+
value: 0.2.0
7680
args:
7781
- --leader-elect
7882
image: controller:latest

config/manifests/bases/oadp-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,6 @@ spec:
150150
name: csi_plugin
151151
- image: quay.io/konveyor/registry:latest
152152
name: registry
153+
- image: quay.io/konveyor/kubevirt-velero-plugin:v0.2.0
154+
name: kubevirt_plugin
153155
version: 99.0.0

config/samples/oadp_v1alpha1_dpa.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ spec:
88
defaultPlugins:
99
- openshift
1010
- aws
11+
- kubevirt
1112
restic:
1213
enable: true
1314
backupLocations:

pkg/common/common.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
GCPPluginImage = "quay.io/konveyor/velero-plugin-for-gcp:konveyor-1.3.0"
1818
CSIPluginImage = "quay.io/konveyor/velero-plugin-for-csi:konveyor-0.2.0"
1919
RegistryImage = "quay.io/konveyor/registry:oadp-0.3.0"
20+
KubeVirtPluginImage = "quay.io/konveyor/kubevirt-velero-plugin:v0.2.0"
2021
)
2122

2223
// Plugin names
@@ -26,6 +27,7 @@ const (
2627
VeleroPluginForGCP = "velero-plugin-for-gcp"
2728
VeleroPluginForCSI = "velero-plugin-for-csi"
2829
VeleroPluginForOpenshift = "openshift-velero-plugin"
30+
KubeVirtPlugin = "kubevirt-velero-plugin"
2931
)
3032

3133
// Environment Vars keys

pkg/credentials/credentials.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ func getAzurePluginImage(dpa *oadpv1alpha1.DataProtectionApplication) string {
114114
return fmt.Sprintf("%v/%v/%v:%v", os.Getenv("REGISTRY"), os.Getenv("PROJECT"), os.Getenv("VELERO_AZURE_PLUGIN_REPO"), os.Getenv("VELERO_AZURE_PLUGIN_TAG"))
115115
}
116116

117+
func getKubeVirtPluginImage(dpa *oadpv1alpha1.DataProtectionApplication) string {
118+
if dpa.Spec.UnsupportedOverrides[oadpv1alpha1.KubeVirtPluginImageKey] != "" {
119+
return dpa.Spec.UnsupportedOverrides[oadpv1alpha1.KubeVirtPluginImageKey]
120+
}
121+
if os.Getenv("VELERO_KUBEVIRT_PLUGIN_REPO") == "" {
122+
return common.KubeVirtPluginImage
123+
}
124+
return fmt.Sprintf("%v/%v/%v:%v", os.Getenv("REGISTRY"), os.Getenv("PROJECT"), os.Getenv("VELERO_KUBEVIRT_PLUGIN_REPO"), os.Getenv("VELERO_KUBEVIRT_PLUGIN_TAG"))
125+
}
126+
117127
func getPluginImage(pluginName string, dpa *oadpv1alpha1.DataProtectionApplication) string {
118128
switch pluginName {
119129

@@ -131,6 +141,9 @@ func getPluginImage(pluginName string, dpa *oadpv1alpha1.DataProtectionApplicati
131141

132142
case common.VeleroPluginForAzure:
133143
return getAzurePluginImage(dpa)
144+
145+
case common.KubeVirtPlugin:
146+
return getKubeVirtPluginImage(dpa)
134147
}
135148
return ""
136149
}

pkg/credentials/credentials_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,53 @@ func TestCredentials_getPluginImage(t *testing.T) {
381381
"VELERO_CSI_PLUGIN_TAG": "latest",
382382
},
383383
},
384+
// KubeVirt tests
385+
{
386+
name: "given default Velero CR without env var set, image should be built from default",
387+
dpa: &oadpv1alpha1.DataProtectionApplication{
388+
ObjectMeta: metav1.ObjectMeta{
389+
Name: "test-Velero-CR",
390+
Namespace: "test-ns",
391+
},
392+
Spec: oadpv1alpha1.DataProtectionApplicationSpec{
393+
Configuration: &oadpv1alpha1.ApplicationConfig{
394+
Velero: &oadpv1alpha1.VeleroConfig{
395+
DefaultPlugins: []oadpv1alpha1.DefaultPlugin{
396+
oadpv1alpha1.DefaultPluginKubeVirt,
397+
},
398+
},
399+
},
400+
},
401+
},
402+
pluginName: common.KubeVirtPlugin,
403+
wantImage: "quay.io/konveyor/kubevirt-velero-plugin:v0.2.0",
404+
},
405+
{
406+
name: "given default Velero CR with env var set, image should be built via env vars",
407+
dpa: &oadpv1alpha1.DataProtectionApplication{
408+
ObjectMeta: metav1.ObjectMeta{
409+
Name: "test-Velero-CR",
410+
Namespace: "test-ns",
411+
},
412+
Spec: oadpv1alpha1.DataProtectionApplicationSpec{
413+
Configuration: &oadpv1alpha1.ApplicationConfig{
414+
Velero: &oadpv1alpha1.VeleroConfig{
415+
DefaultPlugins: []oadpv1alpha1.DefaultPlugin{
416+
oadpv1alpha1.DefaultPluginKubeVirt,
417+
},
418+
},
419+
},
420+
},
421+
},
422+
pluginName: common.KubeVirtPlugin,
423+
wantImage: "quay.io/kubevirt/kubevirt-velero-plugin:latest",
424+
setEnvVars: map[string]string{
425+
"REGISTRY": "quay.io",
426+
"PROJECT": "kubevirt",
427+
"VELERO_KUBEVIRT_PLUGIN_REPO": "kubevirt-velero-plugin",
428+
"VELERO_KUBEVIRT_PLUGIN_TAG": "latest",
429+
},
430+
},
384431
}
385432
for _, tt := range tests {
386433
t.Run(tt.name, func(t *testing.T) {

tests/e2e/common.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,3 @@ func isCredentialsSecretDeleted(namespace string, credSecretRef string) wait.Con
229229
return false, err
230230
}
231231
}
232-

0 commit comments

Comments
 (0)