Fix stable gate

This combines two commits as they are a circular dependency:

-------------------------------------------

Update Centos version for container images.

Due to the EOL for Centos 8, we need to go forward, and adopt to the
Stream version of Centos for container images of kuryr CNI and
controller.

There was applied modification for fixing (hopefully transient) issues
with variable usage in yum/dnf, so there is a need for replacing those
manually.

And finally, there was a switch from deprecated yum to dnf.

(cherry picked from commit c624887103)

-------------------------------------------

Work with pyroute2 0.6.4

pyroute2 0.6.4 seems to break us due to their packages split. This
commit attempts to fix it by making sure we import modules correctly.

(cherry picked from commit 1c2cd78966)
Change-Id: I30ef9ce99b039d00f63ced6e78fd4cfe432b50f6
This commit is contained in:
Roman Dobosz 2022-02-01 13:59:51 +01:00 committed by Michał Dulko
parent 0dbb151a24
commit 8ec71e7e3f
5 changed files with 27 additions and 20 deletions

View File

@ -4,17 +4,22 @@ WORKDIR /go/src/opendev.com/kuryr-kubernetes
COPY . .
RUN go build -o /go/bin/kuryr-cni ./kuryr_cni
FROM registry.centos.org/centos:8
FROM quay.io/centos/centos:stream8
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"
ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/wallaby"
ARG OSLO_LOCK_PATH=/var/kuryr-lock
ARG PKG_YUM_REPO=https://rdoproject.org/repos/openstack-victoria/rdo-release-victoria-2.el8.noarch.rpm
ARG RDO_REPO=https://repos.fedorapeople.org/repos/openstack/openstack-wallaby/rdo-release-wallaby-2.el8.noarch.rpm
RUN yum upgrade -y \
&& yum install -y epel-release $PKG_YUM_REPO \
&& yum install -y --setopt=tsflags=nodocs python3-pip openvswitch sudo iproute libstdc++ pciutils kmod-libs \
&& yum install -y --setopt=tsflags=nodocs gcc gcc-c++ python3-devel git
# NOTE(gryf): There is a sed substitution to make package manager to
# cooperate. It might be a subject to change in the future, either when
# yum/dnf starts to respect yum.conf variables, or mirror location would
# change.
RUN dnf upgrade -y && dnf install -y epel-release $RDO_REPO \
&& sed -e 's/$releasever/8-stream/' -i /etc/yum.repos.d/messaging.repo \
&& sed -e 's/$basearch/x86_64/' -i /etc/yum.repos.d/messaging.repo \
&& dnf install -y --setopt=tsflags=nodocs python3-pip openvswitch sudo iproute libstdc++ pciutils kmod-libs \
&& dnf install -y --setopt=tsflags=nodocs gcc gcc-c++ python3-devel git
COPY . /opt/kuryr-kubernetes
@ -23,8 +28,8 @@ RUN pip3 --no-cache-dir install -U pip \
&& cp /opt/kuryr-kubernetes/cni_ds_init /usr/bin/cni_ds_init \
&& mkdir -p /etc/kuryr-cni \
&& cp /opt/kuryr-kubernetes/etc/cni/net.d/* /etc/kuryr-cni \
&& yum -y history undo last \
&& yum clean all \
&& dnf -y history undo last \
&& dnf clean all \
&& rm -rf /opt/kuryr-kubernetes \
&& mkdir ${OSLO_LOCK_PATH}

View File

@ -1,20 +1,20 @@
FROM registry.centos.org/centos:8
FROM quay.io/centos/centos:stream8
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"
ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/wallaby"
RUN yum upgrade -y \
&& yum install -y epel-release \
&& yum install -y --setopt=tsflags=nodocs python3-pip libstdc++ \
&& yum install -y --setopt=tsflags=nodocs gcc gcc-c++ python3-devel git
RUN dnf upgrade -y \
&& dnf install -y epel-release \
&& dnf install -y --setopt=tsflags=nodocs python3-pip libstdc++ \
&& dnf install -y --setopt=tsflags=nodocs gcc gcc-c++ python3-devel git
COPY . /opt/kuryr-kubernetes
RUN pip3 --no-cache-dir install -U pip \
&& python3 -m pip install -c $UPPER_CONSTRAINTS_FILE --no-cache-dir /opt/kuryr-kubernetes \
&& yum -y history undo last \
&& yum clean all \
&& dnf -y history undo last \
&& dnf clean all \
&& rm -rf /opt/kuryr-kubernetes \
&& groupadd -r kuryr -g 711 \
&& useradd -u 711 -g kuryr \

View File

@ -20,6 +20,7 @@ import os_vif
from os_vif.objects import vif as osv_objects
from oslo_log import log as logging
import pyroute2
from pyroute2 import netns as pyroute_netns
from stevedore import driver as stv_driver
from kuryr_kubernetes import config
@ -81,14 +82,14 @@ def _enable_ipv6(netns):
netns = utils.convert_netns(netns)
path = utils.convert_netns('/proc/self/ns/net')
self_ns_fd = open(path)
pyroute2.netns.setns(netns)
pyroute_netns.setns(netns)
path = utils.convert_netns('/proc/sys/net/ipv6/conf/all/disable_ipv6')
with open(path, 'w') as disable_ipv6:
disable_ipv6.write('0')
except Exception:
raise
finally:
pyroute2.netns.setns(self_ns_fd)
pyroute_netns.setns(self_ns_fd)
def _configure_l3(vif, ifname, netns, is_default_gateway):

View File

@ -19,6 +19,7 @@ import os
from oslo_log import log as logging
import psutil
import pyroute2
from pyroute2 import netlink as pyroute_netlink
from kuryr_kubernetes.cni.binding import base as b_base
from kuryr_kubernetes import config
@ -72,7 +73,7 @@ class NestedDriver(health.HealthHandler, b_base.BaseBindingDriver,
if type(name) is int: # Skip ones duplicated by id
continue
if iface['flags'] & pyroute2.netlink.rtnl.ifinfmsg.IFF_LOOPBACK:
if iface['flags'] & pyroute_netlink.rtnl.ifinfmsg.IFF_LOOPBACK:
continue # Skip loopback
LOG.debug(f'Using interface {name} as bridge interface.')

View File

@ -367,7 +367,7 @@ class VIFSriovDriver(health.HealthHandler, b_base.BaseBindingDriver):
pf_index = ip.link_lookup(ifname=pf)[0]
try:
ip.link("set", index=pf_index, vf={"vf": vf_index, "mac": mac})
except pyroute2.netlink.exceptions.NetlinkError:
except pyroute2.NetlinkError:
LOG.exception("Unable to set mac for VF %s on pf %s",
vf_index, pf)
raise
@ -380,7 +380,7 @@ class VIFSriovDriver(health.HealthHandler, b_base.BaseBindingDriver):
try:
ip.link("set", index=pf_index, vf={"vf": vf_index,
"vlan": vlan_id})
except pyroute2.netlink.exceptions.NetlinkError:
except pyroute2.NetlinkError:
LOG.exception("Unable to set vlan for VF %s on pf %s",
vf_index, pf)
raise