Description
OADP code is changed when sent to production, for example
|
- name: RELATED_IMAGE_VELERO |
|
value: quay.io/konveyor/velero:latest |
|
- name: RELATED_IMAGE_VELERO_RESTORE_HELPER |
|
value: quay.io/konveyor/velero-restore-helper:latest |
|
- name: RELATED_IMAGE_OPENSHIFT_VELERO_PLUGIN |
|
value: quay.io/konveyor/openshift-velero-plugin:latest |
|
- name: RELATED_IMAGE_VELERO_PLUGIN_FOR_AWS |
|
value: quay.io/konveyor/velero-plugin-for-aws:latest |
|
- name: RELATED_IMAGE_VELERO_PLUGIN_FOR_MICROSOFT_AZURE |
|
value: quay.io/konveyor/velero-plugin-for-microsoft-azure:latest |
|
- name: RELATED_IMAGE_VELERO_PLUGIN_FOR_GCP |
|
value: quay.io/konveyor/velero-plugin-for-gcp:latest |
|
- name: RELATED_IMAGE_VELERO_PLUGIN_FOR_CSI |
|
value: quay.io/konveyor/velero-plugin-for-csi:latest |
|
- name: RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN |
|
value: quay.io/konveyor/kubevirt-velero-plugin:v0.2.0 |
|
- name: RELATED_IMAGE_MUSTGATHER |
|
value: registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.2 |
values are changed to production images.
But, these values are not changed
|
const ( |
|
VeleroImage = "quay.io/konveyor/velero:latest" |
|
OpenshiftPluginImage = "quay.io/konveyor/openshift-velero-plugin:latest" |
|
AWSPluginImage = "quay.io/konveyor/velero-plugin-for-aws:latest" |
|
AzurePluginImage = "quay.io/konveyor/velero-plugin-for-microsoft-azure:latest" |
|
GCPPluginImage = "quay.io/konveyor/velero-plugin-for-gcp:latest" |
|
CSIPluginImage = "quay.io/konveyor/velero-plugin-for-csi:latest" |
|
RegistryImage = "quay.io/konveyor/registry:latest" |
|
KubeVirtPluginImage = "quay.io/konveyor/kubevirt-velero-plugin:v0.2.0" |
|
) |
Which means, in a production environment, all fallback from below functions, are wrong.
|
func getVeleroImage(dpa *oadpv1alpha1.DataProtectionApplication) string { |
|
if dpa.Spec.UnsupportedOverrides[oadpv1alpha1.VeleroImageKey] != "" { |
|
return dpa.Spec.UnsupportedOverrides[oadpv1alpha1.VeleroImageKey] |
|
} |
|
if os.Getenv("RELATED_IMAGE_VELERO") == "" { |
|
return common.VeleroImage |
|
} |
|
return os.Getenv("RELATED_IMAGE_VELERO") |
|
} |
|
func getAWSPluginImage(dpa *oadpv1alpha1.DataProtectionApplication) string { |
|
if dpa.Spec.UnsupportedOverrides[oadpv1alpha1.AWSPluginImageKey] != "" { |
|
return dpa.Spec.UnsupportedOverrides[oadpv1alpha1.AWSPluginImageKey] |
|
} |
|
if os.Getenv("RELATED_IMAGE_VELERO_PLUGIN_FOR_AWS") == "" { |
|
return common.AWSPluginImage |
|
} |
|
return os.Getenv("RELATED_IMAGE_VELERO_PLUGIN_FOR_AWS") |
|
} |
|
|
|
func getCSIPluginImage(dpa *oadpv1alpha1.DataProtectionApplication) string { |
|
if dpa.Spec.UnsupportedOverrides[oadpv1alpha1.CSIPluginImageKey] != "" { |
|
return dpa.Spec.UnsupportedOverrides[oadpv1alpha1.CSIPluginImageKey] |
|
} |
|
if os.Getenv("RELATED_IMAGE_VELERO_PLUGIN_FOR_CSI") == "" { |
|
return common.CSIPluginImage |
|
} |
|
return os.Getenv("RELATED_IMAGE_VELERO_PLUGIN_FOR_CSI") |
|
} |
|
|
|
func getGCPPluginImage(dpa *oadpv1alpha1.DataProtectionApplication) string { |
|
if dpa.Spec.UnsupportedOverrides[oadpv1alpha1.GCPPluginImageKey] != "" { |
|
return dpa.Spec.UnsupportedOverrides[oadpv1alpha1.GCPPluginImageKey] |
|
} |
|
if os.Getenv("RELATED_IMAGE_VELERO_PLUGIN_FOR_GCP") == "" { |
|
return common.GCPPluginImage |
|
} |
|
return os.Getenv("RELATED_IMAGE_VELERO_PLUGIN_FOR_GCP") |
|
} |
|
|
|
func getOpenshiftPluginImage(dpa *oadpv1alpha1.DataProtectionApplication) string { |
|
if dpa.Spec.UnsupportedOverrides[oadpv1alpha1.OpenShiftPluginImageKey] != "" { |
|
return dpa.Spec.UnsupportedOverrides[oadpv1alpha1.OpenShiftPluginImageKey] |
|
} |
|
if os.Getenv("RELATED_IMAGE_OPENSHIFT_VELERO_PLUGIN") == "" { |
|
return common.OpenshiftPluginImage |
|
} |
|
return os.Getenv("RELATED_IMAGE_OPENSHIFT_VELERO_PLUGIN") |
|
} |
|
|
|
func getAzurePluginImage(dpa *oadpv1alpha1.DataProtectionApplication) string { |
|
if dpa.Spec.UnsupportedOverrides[oadpv1alpha1.AzurePluginImageKey] != "" { |
|
return dpa.Spec.UnsupportedOverrides[oadpv1alpha1.AzurePluginImageKey] |
|
} |
|
if os.Getenv("RELATED_IMAGE_VELERO_PLUGIN_FOR_MICROSOFT_AZURE") == "" { |
|
return common.AzurePluginImage |
|
} |
|
return os.Getenv("RELATED_IMAGE_VELERO_PLUGIN_FOR_MICROSOFT_AZURE") |
|
} |
|
|
|
func getKubeVirtPluginImage(dpa *oadpv1alpha1.DataProtectionApplication) string { |
|
if dpa.Spec.UnsupportedOverrides[oadpv1alpha1.KubeVirtPluginImageKey] != "" { |
|
return dpa.Spec.UnsupportedOverrides[oadpv1alpha1.KubeVirtPluginImageKey] |
|
} |
|
if os.Getenv("RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN") == "" { |
|
return common.KubeVirtPluginImage |
|
} |
|
return os.Getenv("RELATED_IMAGE_KUBEVIRT_VELERO_PLUGIN") |
|
} |
How to reproduce
Install OADP operator from marketplace and change the value of one these environment variables to an empty string (or remove the environment variable). Create DPA that will use one of these images, without using unsupportedOverrides. OADP will try to use a non production image instead of a production one.
Related work for DPA when API version updates
Instead of having unsupportedOverrides field in DPA, could not we use these environment variables to change images used? Instead of a field in DPA, would need to change value in operator CSV.