Skip to content

Commit b0e0d4b

Browse files
dougszumskijovial
authored andcommitted
Add cASO Docker image
cASO is an OpenStack accounting exporter. For more detail see: https://github.com/IFCA/caso Conflicts: kolla/common/config.py (cherry picked from commit e4c1466) (cherry picked from commit 838078d97bc2399f6e4e5288cfc39b179e6da6d6)
1 parent 909ad12 commit b0e0d4b

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

docker/caso/Dockerfile.j2

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
2+
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
3+
4+
{% block caso_header %}{% endblock %}
5+
6+
{% import "macros.j2" as macros with context %}
7+
8+
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
9+
{% set caso_packages = [
10+
'cronie',
11+
] %}
12+
{% elif base_distro in ['debian', 'ubuntu'] %}
13+
{% set caso_packages = [
14+
'cron',
15+
] %}
16+
{% endif %}
17+
18+
{{ macros.install_packages(caso_packages | customizable("packages")) }}
19+
20+
{{ macros.configure_user(name='caso') }}
21+
22+
{% set caso_pip_packages = [
23+
'caso'
24+
] %}
25+
26+
# NOTE(wszumski:) Upgrade pip, otherwise we hit: ModuleNotFoundError: No module
27+
# named 'setuptools_rust' when install latest cryptography module. Doesn't
28+
# really make sense to use constraints as caso is not tied to an openstack
29+
# release.
30+
RUN mkdir -p /requirements \
31+
&& curl -sSL -o /requirements/upper-constraints.txt https://releases.openstack.org/constraints/upper/{{ openstack_release }}
32+
RUN {{ macros.install_pip(["pip"]) }}
33+
34+
RUN {{ macros.install_pip(caso_pip_packages | customizable("pip_packages"), constraints = false) }} \
35+
&& mkdir -p /etc/caso \
36+
&& chown -R caso: /etc/caso
37+
38+
COPY extend_start.sh /usr/local/bin/kolla_extend_start
39+
40+
RUN touch /usr/local/bin/kolla_caso_extend_start \
41+
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_caso_extend_start
42+
43+
{% block caso_base_footer %}{% endblock %}

docker/caso/extend_start.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# Create log directory, with appropriate permissions
4+
CASO_LOG_DIR="/var/log/kolla/caso"
5+
if [[ ! -d "$CASO_LOG_DIR" ]]; then
6+
mkdir -p $CASO_LOG_DIR
7+
fi
8+
if [[ $(stat -c %U:%G ${CASO_LOG_DIR}) != "caso:kolla" ]]; then
9+
chown caso:kolla ${CASO_LOG_DIR}
10+
fi
11+
if [[ $(stat -c %a ${CASO_LOG_DIR}) != "755" ]]; then
12+
chmod 755 ${CASO_LOG_DIR}
13+
fi
14+
15+
. /usr/local/bin/kolla_caso_extend_start

kolla/common/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,11 @@
11691169
'masakari-user': {
11701170
'uid': 42485,
11711171
'gid': 42485,
1172-
}
1172+
},
1173+
'caso-user': {
1174+
'uid': 52400,
1175+
'gid': 52400,
1176+
},
11731177
}
11741178

11751179

0 commit comments

Comments
 (0)