Skip to content

Commit

Permalink
Add container image building jobs (#31)
Browse files Browse the repository at this point in the history
Build container

Reviewed-by: None <None>
Reviewed-by: OpenTelekomCloud Bot <None>
  • Loading branch information
gtema authored Jul 20, 2021
1 parent 333c780 commit 45896c7
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.tox
.stestr
octavia_proxy.egg-info
.eggs
25 changes: 25 additions & 0 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@
- name: opentelekomcloud/python-otcextensions
override-checkout: elb

- job:
name: octavia-proxy-build-image
parent: build-docker-image
description: Build octavia-proxy container image
timeout: 2700 # 45 minutes
provides: octavia-proxy-container-image
vars: &octavia-proxy_image_vars
docker_images:
- context: .
repository: opentelekomcloud/octavia-proxy
tags:
# If zuul.tag is defined: [ '3', '3.19', '3.19.0' ]. Only works for 3-component tags.
# Otherwise: ['latest']
&imagetag "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}"
siblings:
- opentelekomcloud/python-otcextensions

- job:
name: octavia-proxy-upload-image
parent: otcinfra-upload-image-quay
provides: octavia-proxy-container-image
vars: *octavia-proxy_image_vars

- project:
merge-mode: squash-merge
default-branch: main
Expand All @@ -17,7 +40,9 @@
jobs:
- otc-tox-pep8
- otc-tox-py39-tips
- octavia-proxy-build-image
gate:
jobs:
- otc-tox-pep8
- otc-tox-py39-tips
- octavia-proxy-upload-image
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM docker.io/opendevorg/python-builder:3.9 as builder
ENV DEBIAN_FRONTEND=noninteractive

COPY . /tmp/src
RUN echo "gunicorn" >> /tmp/src/requirements.txt
RUN assemble

FROM docker.io/opendevorg/python-base:3.9 as octavia-proxy
ENV DEBIAN_FRONTEND=noninteractive

COPY --from=builder /output/ /output
RUN mkdir /etc/octavia_proxy
COPY etc/octavia_proxy.conf octavia_proxy/api/config.py /etc/octavia_proxy/

RUN /output/install-from-bindep \
&& rm -rf /output \
&& useradd -u 10001 -m -d /var/lib/octavia_proxy -c "Octavia Proxy" octavia_proxy \
&& chown -R 10001 /etc/octavia_proxy

VOLUME /var/lib/octavia_proxy

USER 10001
EXPOSE 9876
CMD ["gunicorn", "-b 0.0.0.0:9876", \
"octavia_proxy.api.app:setup_app(argv=[])"]
4 changes: 2 additions & 2 deletions etc/octavia.conf → etc/octavia_proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ auth_url=https://iam.eu-de.otc.t-systems.com
log_name='token_validate'

[api_settings]
# bind_host = 127.0.0.1
# bind_port = 9876
bind_host = 0.0.0.0
bind_port = 9876

# How should authentication be handled (keystone, noauth, validatetoken)
auth_strategy = validatetoken
Expand Down
5 changes: 4 additions & 1 deletion octavia_proxy/common/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
def prepare_service(argv=None):
"""Sets global config from config file and sets up logging."""
argv = argv or []
config.init(argv[1:])
config.init(
argv[1:],
default_config_files=['/etc/octavia_proxy/octavia_proxy.conf']
)
config.setup_logging(cfg.CONF)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ oslo.middleware>=4.0.1 # Apache-2.0
oslo.policy>=2.1.0 # Apache-2.0
oslo.reports>=1.18.0 # Apache-2.0

octavia_lib==2.3.1 # Apache-2.0
octavia_lib==2.4.0 # Apache-2.0

# OTC dependencies
otcextensions # Apache-2.0
Expand Down
13 changes: 11 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@ keywords =
packages =
octavia_proxy

data_files =
etc/octavia_proxy.conf =
etc/octavia_proxy.conf

[entry_points]
wsgi_scripts =
octavia-proxy-wsgi = octavia_proxy.api.app:setup_app
console_scripts =
octavia-proxy = octavia_proxy.cmd.api:main

octavia_proxy.api.drivers =
elbv2 = octavia_proxy.api.drivers.elbv2.driver:ELBv2Driver
elbv3 = octavia_proxy.api.drivers.elbv3.driver:ELBv3Driver

oslo.policy.policies =
octavia = octavia.policies:list_rules
octavia = octavia_proxy.policies:list_rules
oslo.policy.enforcer =
octavia = octavia.common.policy:get_no_context_enforcer
octavia = octavia_proxy.common.policy:get_no_context_enforcer

0 comments on commit 45896c7

Please sign in to comment.