Browse Source

Remove Python 2 support

Ussuri release is the one in which we drop Python 2 support, as its EOL
is pretty close now. This commit does so in kuryr-kubernetes by
removing Python 2 unit test jobs, switching all tempest jobs to Python
3, removing specific jobs for Python 3 and updating Dockerfiles to
centos:8 that includes Python 3 from the box.

Also CentOS 7 job is removed from check queue as it seems it doesn't
play well with Python 3. A CentOS 8 job will get created soon.

Change-Id: Id9983d2fd83cef89e3198b2760816cf4a851008b
changes/85/693485/12
Michał Dulko 1 month ago
parent
commit
28b27c5de2
12 changed files with 22 additions and 122 deletions
  1. +1
    -0
      .zuul.d/base.yaml
  2. +0
    -20
      .zuul.d/octavia.yaml
  3. +1
    -6
      .zuul.d/project.yaml
  4. +4
    -4
      cni.Dockerfile
  5. +0
    -35
      cni_py3.Dockerfile
  6. +5
    -5
      controller.Dockerfile
  7. +0
    -26
      controller_py3.Dockerfile
  8. +4
    -11
      devstack/lib/kuryr_kubernetes
  9. +0
    -3
      devstack/settings
  10. +6
    -0
      releasenotes/notes/drop-py27-60f55b6bc1d082bc.yaml
  11. +0
    -2
      setup.cfg
  12. +1
    -10
      tox.ini

+ 1
- 0
.zuul.d/base.yaml View File

@@ -39,6 +39,7 @@
Q_BUILD_OVS_FROM_GIT: true
KURYR_K8S_CLOUD_PROVIDER: false
ETCD_USE_RAMDISK: true
USE_PYTHON3: true
devstack_services:
# TODO(dmellado):Temporary workaround until proper fix
base: false

+ 0
- 20
.zuul.d/octavia.yaml View File

@@ -53,15 +53,6 @@
nodeset: openstack-centos-7-single-node
voting: false

- job:
name: kuryr-kubernetes-tempest-py36
parent: kuryr-kubernetes-tempest
description: |
Tempest with DevStack running on Python 3.6
vars:
devstack_localrc:
USE_PYTHON3: true

- job:
name: kuryr-kubernetes-tempest-containerized
parent: kuryr-kubernetes-tempest
@@ -142,17 +133,6 @@
KURYR_SUBNET_DRIVER: namespace
voting: false

- job:
name: kuryr-kubernetes-tempest-containerized-py36
description: |
Tempest with Kuryr running on Python3.6 containers
parent: kuryr-kubernetes-tempest-containerized
vars:
devstack_localrc:
KURYR_CONTAINERS_USE_PY3: True
USE_PYTHON3: true
voting: true

- job:
name: kuryr-kubernetes-tempest-containerized-openshift
description: Tempest with containers and OpenShift

+ 1
- 6
.zuul.d/project.yaml View File

@@ -21,15 +21,11 @@
- kuryr-kubernetes-tempest-containerized
- kuryr-kubernetes-tempest-containerized-lower-constraints
- kuryr-kubernetes-tempest-containerized-ovn
- kuryr-kubernetes-tempest-py36
- kuryr-kubernetes-tempest-containerized-py36
- kuryr-kubernetes-tempest-multinode-containerized
- kuryr-kubernetes-tempest-centos-7
gate:
jobs:
- kuryr-kubernetes-tempest
- kuryr-kubernetes-tempest-py36
- kuryr-kubernetes-tempest-containerized-py36
- kuryr-kubernetes-tempest-containerized
experimental:
jobs:
- kuryr-kubernetes-tempest-containerized-openshift
@@ -45,7 +41,6 @@

- project:
templates:
- openstack-python-jobs
- openstack-python3-ussuri-jobs
- openstack-lower-constraints-jobs
- publish-openstack-docs-pti

+ 4
- 4
cni.Dockerfile View File

@@ -4,19 +4,19 @@ WORKDIR /go/src/opendev.com/kuryr-kubernetes
COPY . .
RUN go build -o /go/bin/kuryr-cni ./kuryr_cni

FROM centos:7
FROM centos:8
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"

ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/master"
ARG OSLO_LOCK_PATH=/var/kuryr-lock

RUN yum install -y epel-release https://rdoproject.org/repos/rdo-release.rpm \
&& yum install -y --setopt=tsflags=nodocs python-pip iproute bridge-utils openvswitch sudo libstdc++ \
&& yum install -y --setopt=tsflags=nodocs gcc python-devel git
&& yum install -y --setopt=tsflags=nodocs python3-pip openvswitch sudo \
&& yum install -y --setopt=tsflags=nodocs gcc python3-devel git

COPY . /opt/kuryr-kubernetes

RUN pip install -c $UPPER_CONSTRAINTS_FILE /opt/kuryr-kubernetes \
RUN pip3 install -c $UPPER_CONSTRAINTS_FILE /opt/kuryr-kubernetes \
&& 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 \

+ 0
- 35
cni_py3.Dockerfile View File

@@ -1,35 +0,0 @@
FROM golang:1.11 AS builder

WORKDIR /go/src/opendev.com/kuryr-kubernetes
COPY . .
RUN go build -o /go/bin/kuryr-cni ./kuryr_cni

FROM fedora:30
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"

ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/master"
ARG OSLO_LOCK_PATH=/var/kuryr-lock

RUN dnf update -y \
&& dnf install -y --setopt=tsflags=nodocs python36 iproute bridge-utils openvswitch sudo libstdc++ \
&& dnf install -y --setopt=tsflags=nodocs gcc git

COPY . /opt/kuryr-kubernetes

RUN python3.6 -m ensurepip \
&& python3.6 -m pip install -c $UPPER_CONSTRAINTS_FILE /opt/kuryr-kubernetes \
&& 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 \
&& dnf -y history undo last \
&& dnf clean all \
&& rm -rf /opt/kuryr-kubernetes \
&& mkdir ${OSLO_LOCK_PATH}

COPY --from=builder /go/bin/kuryr-cni /kuryr-cni

ARG CNI_DAEMON=True
ENV CNI_DAEMON ${CNI_DAEMON}
ENV OSLO_LOCK_PATH=${OSLO_LOCK_PATH}

ENTRYPOINT [ "cni_ds_init" ]

+ 5
- 5
controller.Dockerfile View File

@@ -1,15 +1,15 @@
FROM centos:7
FROM centos:8
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"

ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/master"

RUN yum install -y epel-release \
&& yum install -y --setopt=tsflags=nodocs python-pip libstdc++ \
&& yum install -y --setopt=tsflags=nodocs gcc python-devel git
&& yum install -y --setopt=tsflags=nodocs python3-pip libstdc++ \
&& yum install -y --setopt=tsflags=nodocs gcc python3-devel git

COPY . /opt/kuryr-kubernetes

RUN pip install -c $UPPER_CONSTRAINTS_FILE --no-cache-dir /opt/kuryr-kubernetes \
RUN pip3 install -c $UPPER_CONSTRAINTS_FILE --no-cache-dir /opt/kuryr-kubernetes \
&& yum -y history undo last \
&& yum clean all \
&& rm -rf /opt/kuryr-kubernetes \
@@ -22,4 +22,4 @@ RUN pip install -c $UPPER_CONSTRAINTS_FILE --no-cache-dir /opt/kuryr-kubernetes

USER kuryr
CMD ["--config-dir", "/etc/kuryr"]
ENTRYPOINT [ "/usr/bin/kuryr-k8s-controller" ]
ENTRYPOINT [ "kuryr-k8s-controller" ]

+ 0
- 26
controller_py3.Dockerfile View File

@@ -1,26 +0,0 @@
FROM fedora:30
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"

ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/master"

RUN dnf update -y \
&& dnf install -y --setopt=tsflags=nodocs python36 libstdc++ \
&& dnf install -y --setopt=tsflags=nodocs gcc git

COPY . /opt/kuryr-kubernetes

RUN python3.6 -m ensurepip \
&& python3.6 -m pip install -c $UPPER_CONSTRAINTS_FILE --no-cache-dir /opt/kuryr-kubernetes \
&& dnf -y history undo last \
&& dnf clean all \
&& rm -rf /opt/kuryr-kubernetes \
&& groupadd -r kuryr -g 711 \
&& useradd -u 711 -g kuryr \
-d /opt/kuryr-kubernetes \
-s /sbin/nologin \
-c "Kuryr controller user" \
kuryr

USER kuryr
CMD ["--config-dir", "/etc/kuryr"]
ENTRYPOINT [ "/usr/local/bin/kuryr-k8s-controller" ]

+ 4
- 11
devstack/lib/kuryr_kubernetes View File

@@ -327,17 +327,10 @@ EOF
function build_kuryr_containers() {
local build_args
local build_dir
local use_py3
local py_suffix

build_dir="${DEST}/kuryr-kubernetes"
pushd "$build_dir"

use_py3=$(trueorfalse False KURYR_CONTAINERS_USE_PY3)
if [[ "$use_py3" == "True" ]]; then
py_suffix="_py3"
fi

KURYR_CONTAINERS_USE_LOWER_CONSTRAINTS=$(trueorfalse False KURYR_CONTAINERS_USE_LOWER_CONSTRAINTS)
if [[ "$KURYR_CONTAINERS_USE_LOWER_CONSTRAINTS" == "True" ]]; then
build_args="--build-arg UPPER_CONSTRAINTS_FILE=/opt/kuryr-kubernetes/lower-constraints.txt"
@@ -348,11 +341,11 @@ function build_kuryr_containers() {
# resolved instead of podman we need to use buildah directly,
# hence this awful if clause.
if [[ ${CONTAINER_ENGINE} == 'crio' ]]; then
sudo buildah bud -t docker.io/kuryr/controller -f controller${py_suffix}.Dockerfile .
sudo buildah bud -t docker.io/kuryr/cni -f cni${py_suffix}.Dockerfile .
sudo buildah bud -t docker.io/kuryr/controller -f controller.Dockerfile .
sudo buildah bud -t docker.io/kuryr/cni -f cni.Dockerfile .
else
container_runtime build -t kuryr/controller -f controller${py_suffix}.Dockerfile ${build_args} .
container_runtime build -t kuryr/cni -f cni${py_suffix}.Dockerfile ${build_args} .
container_runtime build -t kuryr/controller -f controller.Dockerfile ${build_args} .
container_runtime build -t kuryr/cni -f cni.Dockerfile ${build_args} .
fi
popd
}

+ 0
- 3
devstack/settings View File

@@ -102,9 +102,6 @@ KURYR_ENABLE_INGRESS=${KURYR_ENABLE_INGRESS:-False}
# Kuryr L7 router's name
KURYR_L7_ROUTER_NAME=${KURYR_L7_ROUTER_NAME:-kuryr-l7-router}

# Whether to use Python3
KURYR_CONTAINERS_USE_PY3=${KURYR_CONTAINERS_USE_PY3:-False}

# Whether to use lower-constraints.txt when installing dependencies.
KURYR_CONTAINERS_USE_LOWER_CONSTRAINTS=${KURYR_CONTAINERS_USE_LOWER_CONSTRAINTS:-False}


+ 6
- 0
releasenotes/notes/drop-py27-60f55b6bc1d082bc.yaml View File

@@ -0,0 +1,6 @@
---
upgrade:
- |
Python 2.7 support has been dropped. Last release of Kuryr-Kubernetes to support
py2.7 is OpenStack Train. The minimum version of Python now supported by
Kuryr-Kubernetes is Python 3.6.

+ 0
- 2
setup.cfg View File

@@ -13,8 +13,6 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7

+ 1
- 10
tox.ini View File

@@ -1,6 +1,6 @@
[tox]
minversion = 2.3.1
envlist = py27,py37,pep8
envlist = py37,pep8
skipsdist = True

[testenv]
@@ -18,18 +18,9 @@ commands = find {toxinidir} -type f -name "*.py[c|o]" -delete
rm -f .testrepository/times.dbm
stestr run {posargs}

[testenv:fullstack]
basepython = python2.7
setenv = OS_TEST_PATH=./kuryr/tests/fullstack
passenv = OS_*

[testenv:debug]
commands = oslo_debug_helper -t kuryr_kubernetes/tests {posargs}

[testenv:debug-py27]
basepython = python2.7
commands = oslo_debug_helper -t kuryr_kubernetes/tests {posargs}

[testenv:debug-py36]
basepython = python3.6
commands = oslo_debug_helper -t kuryr_kubernetes/tests {posargs}

Loading…
Cancel
Save