Skip to content

Instantly share code, notes, and snippets.

@venkataanil
Last active August 26, 2019 07:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save venkataanil/1a046ac7ae0ec53bed3ab01b013c0279 to your computer and use it in GitHub Desktop.
Save venkataanil/1a046ac7ae0ec53bed3ab01b013c0279 to your computer and use it in GitHub Desktop.
curl -o rhos-release-latest.noarch.rpm http://download-node-02.eng.bos.redhat.com/rcm-guest/puddles/OpenStack/rhos-release/rhos-release-latest.noarch.rpm
yum install -y rhos-release-latest.noarch.rpm
rhos-release --help
rhos-release 14-director -p passed_phase2
yum update -y; reboot
=======================================
sudo yum install git gcc libffi-devel openssl-devel python-virtualenv libselinux-python tmux -y
#install kvm and libvirt
sudo yum install qemu-kvm libvirt libvirt-python libguestfs-tools virt-install -y
sudo yum install libguestfs libguestfs-tools-c libguestfs-tools-xfs python-lxml wget libselinux-python expect -y
systemctl enable libvirtd
systemctl start libvirtd
tmux new -s osp
useradd stack
passwd stack
echo "stack ALL=(root) NOPASSWD:ALL" | tee -a /etc/sudoers.d/stack
chmod 0440 /etc/sudoers.d/stack
su - stack
ssh-keygen
create authorized_keys and add stack user public key in authorized_keys
sudo cp -r ~/.ssh /root/
# test ssh root
# ssh root@localhost
cd /home/stack
git clone https://github.com/redhat-openstack/infrared.git
cd infrared
virtualenv .venv && source .venv/bin/activate
pip install --upgrade pip
pip install --upgrade setuptools
pip install .
# add plugins
infrared plugin add plugins/virsh
infrared plugin add plugins/tripleo-undercloud
infrared plugin add plugins/tripleo-overcloud
# note clone to local machine and copy to gprfc machine
git clone https://code.engineering.redhat.com/gerrit/openshift-ir-plugin.git
# copy openshift-ir-plugin to infrared/plugins
ir plugin add --revision ocp3 plugins/openshift-ir-plugin
IMAGE='http://rhos-qe-mirror-tlv.usersys.redhat.com/brewroot/packages/rhel-guest-image/7.6/215/images/rhel-guest-image-7.6-215.x86_64.qcow2'
TOPOLOGY_NODES=undercloud:1,openshift-master:1,openshift-worker:1,openshift-infra:1,openshift-tester:1,controller:1,compute:1
MIRROR=tlv
HOST=$HOST
infrared virsh -v -o cleanup.yml --host-address $HOST --host-key ~/.ssh/id_rsa --cleanup yes 2>&1 | tee ir_virsh_cleanup_log.txt
infrared virsh -v --topology-nodes $TOPOLOGY_NODES --host-address $HOST --host-key ~/.ssh/id_rsa --image-url $IMAGE --host-memory-overcommit True 2>&1 | tee ir_virsh_log.txt
infrared tripleo-undercloud -v --mirror $MIRROR --version 14 --build passed_phase1 --images-task rpm --images-update no --config-options DEFAULT.clean_nodes='true' --registry-mirror rhos-qe-mirror-tlv.usersys.redhat.com:5000 2>&1 | tee ir_uc_log.txt
infrared tripleo-overcloud -v --introspect yes --tagging yes --deploy no --deployment-files virt --ansible-args='tag=introspect,tag' 2>&1 | tee ir_oc_log.txt
ir -vv openshift --tripleo-dns yes --openshift-release 3.11 2>&1 | tee ir_ocp_dns_log.txt
ir -vv openshift --tripleo-deploy yes --openshift-release 3.11 2>&1 | tee ir_ocp_log.txt
============== need to change internal_api network =============
# change the name of the network
openstack network set --name internal_api_test 267579ca-526e-4b59-a06f-f4a2eb31683c
openstack network segment list
# create new segment for the network, with the updated network name
openstack network segment create --physical-network internal_api_osp --network-type flat --network 52e36f09-3b4c-4fb0-9a8c-efb962a38e30 internal_api_osp
# delete the segment with internal network name
openstack network segment delete d8896af7-9a3b-446d-9699-ad5e1d2cbd8d
# now we can create internal_api network, no need, THT will create that
# openstack network create --provider-network-type flat --provider-physical-network internal_api internal_api
============================================================
# in infrared node, create oc_extra_templates.yml and instackenv.json under /home/stack/infrared/
# instackenv.json file should have only compute and controller like in https://github.com/venkataanil/files/blob/master/instackenv.json
# oc_extra_templates.yml content
(.venv) [stack@gprfc049 infrared]$ cat oc_extra_templates.yml
---
tripleo_heat_templates:
- /home/stack/osp/networks-disable.yaml
- /home/stack/osp/network-environment.yaml
- /home/stack/osp/ips-from-pool-all.yaml
- /home/stack/osp/disable-telemetry.yaml
# network_data.yaml in undercloud should be like https://github.com/venkataanil/files/blob/master/network_data.yaml Add tenant and StorageMgmt in this file, as osp will create them.
# networks-dasble in undercloud https://github.com/venkataanil/files/blob/master/networks-disable.yaml , keep None as definition for Storage, internal, external and management networks as they are already created by OCP. Remove Tenant and StorageMgmt here as default resource definition will be used for them
# copy https://github.com/openstack/tripleo-heat-templates/blob/master/environments/disable-telemetry.yaml to /home/stack/osp/disable-telemetry.yaml
# copy network-environment.yaml, controller.yaml, compute.yaml, ips-from-pool-all.yaml from https://github.com/venkataanil/files to /home/stack/osp
infrared tripleo-overcloud --deployment-files virt --controller-nodes 1 --compute-nodes 1 --version 14 --deploy yes --overcloud-templates /home/stack/infrared/oc_extra_templates.yml --instackenv-file /home/stack/infrared/instackenv.json --extra-deploy-params="-n /home/stack/network_data.yaml" 2>&1 | tee ir_oc14_log1.txt
Add below flows for pods to communicate with controller
1) Add flows in worker node
sudo ovs-ofctl add-flow -O OpenFlow13 br0 "table=90,priority=100,ip,nw_dst=10.131.0.0/23,actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],set_field:172.17.1.30->tun_dst,output:1"
sudo ovs-ofctl add-flow -O OpenFlow13 br0 "table=50,priority=100,arp,arp_tpa=10.131.0.0/23,actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],set_field:172.17.1.30->tun_dst,output:1"
sudo ovs-ofctl add-flow -O OpenFlow13 br0 "table=10,priority=100,tun_src=172.17.1.30,actions=goto_table:30"
2) Add below flow in controller
sudo ip r a 10.128.0.0/14 dev br0
make masters as unschedulable
oc adm manage-node openshift-master-0 --schedulable=false
run busybox image and check if we can ping controller from container
# to create pod, go to master node and execute below command
kubectl run busybox -ti --image=busybox /bin/sh
compute node ===
cd /var/lib/config-data/puppet-generated/
sudo tar -czf /tmp/compute_config.tar.gz nova_libvirt neutron
worker node ====
git clone https://github.com/zzzeek/overcloud_basic
mkdir compute_node
cp overcloud_basic/roles/simulate-compute-node/files/* compute_node/
# copy compute config which we have copied from compue node
cp compute_config compute_node/
Add delorean and delorean-deps in Dockerfile instead of args
sudo docker build compute_node
sudo docker image save 0a84624ef471 -o fake_node.tar
undercloud =====
scp heat-admin@worker:~/fake_node.tar .
sudo docker image load -i fake_node.tar
sudo docker tag 0a84624ef471 192.168.24.1:8787/fake-node
sudo docker push 192.168.24.1:8787/fake-node
# on the worker node add selinux rule to access mount paths https://stackoverflow.com/questions/24288616/permission-denied-on-accessing-host-directory-in-docker
[root@openshift-worker-0 compute_node]# chcon -Rt svirt_sandbox_file_t /home/tripleo-admin/compute_node/hosts
[root@openshift-worker-0 compute_node]# chcon -Rt svirt_sandbox_file_t /home/tripleo-admin/compute_node/neutron/etc/neutron
[root@openshift-worker-0 compute_node]# chcon -Rt svirt_sandbox_file_t /home/tripleo-admin/compute_node/nova_libvirt/etc/nova
oc adm policy add-scc-to-user privileged -z default
use the replica set from https://github.com/venkataanil/files/blob/master/fake-replicaset.yaml as fake_node.yaml
kubectl create -f fake_node.yaml
(overcloud) [stack@undercloud-0 ~]$ openstack compute service list
[heat-admin@controller-0 ~]$ sudo docker exec nova_api nova-manage cell_v2 discover_hosts
note: neutron-openvswitch-agent was terminating as bridge_mappings were set like
bridge_mappings=datacentre:br-ex,tenant:br-isolated
and it is unable to find br-isolatated. I removed br-isolated and retained br-ex like below and it started working.
bridge_mappings = datacentre:br-ex
== in undercloud,
source overcloudrc
openstack image list
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
openstack flavor list
openstack flavor create --id 0 --ram 512 --vcpus 1 --disk 10 m1.tiny
neutron net-create n1
neutron subnet-create --name sn1 n1 11.0.0.0/24
nova availability-zone-list
openstack host list
nova boot --flavor 0 --image cirros --availability-zone nova:fake-node-ch7r8 --nic net-id=8e7bf3ef-543a-416b-966c-a1e16f81c19b vm3
====================================================================================================================
END
===================================================================================================================
########################################################### ignore below commands, (these are other approaches which I tried :) ================================
===========================================================================================
# test with docker run
# sudo docker run -d -v "/home/heat-admin/compute_node/hosts:/etc/hosts_compute:ro" -v "/home/heat-admin/compute_node/neutron/etc/neutron:/etc/neutron/original:ro" -v "/home/heat-admin/compute_node/nova_libvirt/etc/nova:/etc/nova/original/:ro" 192.168.24.1:8787/fake-node
use the fake_node.yaml from https://raw.githubusercontent.com/venkataanil/files/master/fake_node.yaml
kubectl create -f fake_node.yaml
# overcloud14 command
# make sure below files(network_data.yaml and networks-daible.yaml) exist in uc
# cat oc_extra_templates.yml
#---
#tripleo_heat_templates:
# - /home/stack/network_data.yaml
# - /home/stack/networks-disable.yaml
# -
# https://github.com/openstack/tripleo-heat-templates/blob/master/environments/disable-telemetry.yaml
# infrared tripleo-overcloud --deployment-files virt --version 14 --introspect yes --tagging yes --deploy yes --overcloud-templates oc_extra_templates.yml 2>&1 | tee ir_oc14_log.txt
#--instackenv-file
cp instackenv.json /home/stack/.infrared/plugins/tripleo-overcloud/instackenv.json
infrared tripleo-overcloud --deployment-files virt --controller-nodes 1 --compute-nodes 1 --version 14 --deploy yes --overcloud-templates oc_extra_templates.yml --instackenv-file instackenv.json 2>&1 | tee ir_oc14_log1.txt
#infrared tripleo-overcloud --deployment-files virt --controller-nodes 1 --compute-nodes 1 --version 14 --deploy yes --instackenv-file instackenv.json --overcloud-script overcloud_deploy.sh 2>&1 | tee ir_oc14_log2.txt
# infrared tripleo-overcloud --deployment-files virt --controller-nodes 1 --compute-nodes 1 --version 14 --deploy yes --overcloud-templates /home/stack/oc_extra_templates.yml --instackenv-file /home/stack/instackenv.json --extra-deploy-params="-n /home/stack/network_data.yaml" 2>&1 | tee ir_oc14_log4.txt
infrared tripleo-overcloud --deployment-files virt --controller-nodes 1 --compute-nodes 1 --version 14 --deploy yes --overcloud-templates /home/stack/infrared/oc_extra_templates.yml --instackenv-file /home/stack/infrared/instackenv.json --extra-deploy-params="-n /home/stack/network_data.yaml" 2>&1 | tee ir_oc14_log4.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment