Note: This repository is under development and not recommended to use on production environment and is not supported by Red Hat.
- If you are on RHEL9:
yum clean all && yum update -y
dnf -y upgrade --refresh && dnf clean all
dnf install -y \
glibc-langpack-en \
git \
make \
python3.12 \
python3.12-pip \
gcc \
jq
python3.12 -m pip install --no-cache-dir --upgrade pip \
python3.12 -m pip install --no-cache-dir ansible-core==2.18.1 \
python3.12 -m pip install --no-cache-dir ansible-lint==25.4.0 \
python3.12 -m pip install --no-cache-dir jmespath \
rm -rf /var/cache/dnf
- Minimum of python 3.12, ansible-core 2.18.1 and ansible-lint 25.4.0 is recommended.
-
Python latest package installed from https://www.python.org/. This has been tested with installer
-
After installation of python install ansible using the following command:
python3 -m pip install --user ansible # Make sure ansible version is 2.18.1
Reference: Installing Ansible
-
For running tests install the following:
python3 -m pip install --user jmespath
-
Make sure
jq
is installed in your system. -
You can install the packages mentioned in section Install necessary dependencies as per your requirements.
- Clone the repository as follows:
git clone [email protected]:openshift/network.offline_migration_sdn_to_ovnk.git
- Change to that directory:
cd network.offline_migration_sdn_to_ovnk
- Install the ansible collection:
make install
- Check if the collection is installed:
ansible-galaxy collection list | grep network.offline_migration_sdn_to_ovnk
- To run the migration from OpenShiftSDN to OVNKubernetes
ansible-playbook -v playbooks/playbook-migration.yml
- To run the rollback from OVNKubernetes to OpenShiftSDN
ansible-playbook -v playbooks/playbook-rollback.yml
- Disable auto-migration features
In migration-playbook.yml
or rollback-playbook.yml
based on whether you are migrating or rollback
please set the following:
To disable auto-migration of features:
migration_disable_auto_migration: true # true enables disable_automatic_migration. You will need to set egress_ip, egress_firewall and multicast as follows:
migration_egress_ip: false
migration_egress_firewall: false
migration_multicast: false
To keep automigration enabled:
migration_disable_auto_migration: false
If you are setting under rollback playbook you need to add prefix rollback_
to the mentioned vars above instead
of migration_
- Customize network features:
- In
migration-playbook.yml
you can set the following fields with custom values:
- In
migration_mtu: 1400
migration_geneve_port: 6081
migration_ipv4_subnet: "100.64.0.0/16"
- In the rollback-playbook.yml you can set the following fields with custom values:
rollback_mtu: 1400
rollback_vxlanPort: 4790
If you are setting under rollback playbook you need to add prefix rollback_
to the mentioned vars above instead
of migration_
- If you use nncp on primary interface then during migration pass the primary interface name in the playbook
playbooks/migration-playbook.yml
:
migration_interface_name: eth0
- You must run lint tests after making any changes to the code.
make lint
- You must run sanity tests after making any changes to the code.
make sanity
- To check how things work in CI:
Assuming if you have access to registry.ci.openshift.org.
- docker login:
cat hack/docker-login.sh
#!/usr/bin/env bash
PULL_SECRET="pull-secret.json"
REGISTRY="registry.ci.openshift.org"
USERNAME=$(jq -r ".auths[\"$REGISTRY\"].auth" < "$PULL_SECRET" | base64 -d | cut -d: -f1)
PASSWORD=$(jq -r ".auths[\"$REGISTRY\"].auth" < "$PULL_SECRET" | base64 -d | cut -d: -f2)
echo "$PASSWORD" | docker login "$REGISTRY" -u "$USERNAME" --password-stdin
- docker build:
docker build --file ci/Dockerfile --tag quay.io/<your reponame>/ansible-test-runner:1 .
- docker push:
docker push quay.io/<your reponame>/ansible-test-runner:1
- Run the job in your OpenShift Environment:
ANSIBLE_TEST_IMAGE=quay.io/<your reponame>/ansible-test-runner:1 ./ci/incluster_intergration.sh
-
For testing ansible and sanity tests on CI please use scripts
test_incluster_lint.sh
andtest_incluster_sanity_lint.sh
respectively -
If you don't have access to registry.ci.openshift.org then you can use Dockerfile.debug to build your image.