Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
v2v: Compose image name dynamically
Browse files Browse the repository at this point in the history
Allows downstream patches.
  • Loading branch information
mareklibra committed Apr 30, 2019
1 parent 28967ac commit 8280407
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
11 changes: 9 additions & 2 deletions src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { get } from 'lodash';

const getRegistryUrl = () => get(window.SERVER_FLAGS, 'Registry', 'quay.io/nyoxi'); // TODO: upstream should be moved under quay.io/kubevirt
const getV2vImageTag = () => get(window.SERVER_FLAGS, 'ImageTagV2V', 'latest');

export const VMWARE_TO_KUBEVIRT_OS_CONFIG_MAP_NAMESPACE = 'kube-public'; // note: common-templates are in the "openshift" namespace
export const VMWARE_TO_KUBEVIRT_OS_CONFIG_MAP_NAME = 'vmware-to-kubevirt-os'; // single configMap per cluster, contains mapping of vmware guestId to common-templates OS ID
export const KUBEVIRT_V2V_CONVERSION_CONTAINER_IMAGE = 'quay.io/nyoxi/kubevirt-v2v-conversion:1.12.1-1-gf665c0a';
export const KUBEVIRT_V2V_VMWARE_CONTAINER_IMAGE = 'quay.io/nyoxi/kubevirt-vmware:1.12.1-1';

export const getKubevirtV2vConversionContainerImage = () =>
`${getRegistryUrl()}/kubevirt-v2v-conversion:${getV2vImageTag()}`;
export const getKubevirtV2vVmwareContainerImage = () => `${getRegistryUrl()}/kubevirt-vmware:${getV2vImageTag()}`;
4 changes: 2 additions & 2 deletions src/k8s/objects/v2v/vmware/conversionPod.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { KUBEVIRT_V2V_CONVERSION_CONTAINER_IMAGE } from '../../../../config';
import { getKubevirtV2vConversionContainerImage } from '../../../../config';
import { PodModel } from '../../../../models';
import { CONVERSION_BASE_NAME, CONVERSION_GENERATE_NAME } from '../../../requests/v2v';

Expand All @@ -14,7 +14,7 @@ export const buildConversionPod = ({ volumes, volumeMounts, namespace, serviceAc
containers: [
{
name: CONVERSION_BASE_NAME,
image: KUBEVIRT_V2V_CONVERSION_CONTAINER_IMAGE,
image: getKubevirtV2vConversionContainerImage(),
securityContext: {
privileged: true,
},
Expand Down
4 changes: 2 additions & 2 deletions src/k8s/objects/v2v/vmware/vmWareDeployment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { KUBEVIRT_V2V_VMWARE_CONTAINER_IMAGE } from '../../../../config';
import { getKubevirtV2vVmwareContainerImage } from '../../../../config';
import { DeploymentModel } from '../../../../models';

export const buildVmWareDeployment = ({ name, namespace }) => ({
Expand Down Expand Up @@ -26,7 +26,7 @@ export const buildVmWareDeployment = ({ name, namespace }) => ({
containers: [
{
name,
image: KUBEVIRT_V2V_VMWARE_CONTAINER_IMAGE,
image: getKubevirtV2vVmwareContainerImage(),
imagePullPolicy: 'Always',
command: ['kubevirt-vmware'],
env: [
Expand Down
4 changes: 2 additions & 2 deletions src/k8s/requests/v2v/startV2VvmwareController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getDeploymentContainer } from '../../../selectors/deployment';
import { getContainerImage } from '../../../selectors/pod';
import { buildAddOwnerReferencesPatch, buildOwnerReference } from '../../util';
import { getName } from '../../../selectors';
import { KUBEVIRT_V2V_VMWARE_CONTAINER_IMAGE } from '../../../config';
import { getKubevirtV2vVmwareContainerImage } from '../../../config';

const { info } = console;

Expand All @@ -26,7 +26,7 @@ export const startV2VVMWareController = async ({ namespace }, { k8sGet, k8sCreat
try {
activeDeployment = await k8sGet(DeploymentModel, name, namespace);

if (getContainerImage(getDeploymentContainer(activeDeployment, name)) !== KUBEVIRT_V2V_VMWARE_CONTAINER_IMAGE) {
if (getContainerImage(getDeploymentContainer(activeDeployment, name)) !== getKubevirtV2vVmwareContainerImage()) {
throw new Error(OLD_VERSION);
}
} catch (e) {
Expand Down

0 comments on commit 8280407

Please sign in to comment.