Skip to content

Commit 7cf7f58

Browse files
authored
Merge pull request #1610 from grycap/boto3
Boto3
2 parents 1c46815 + 7dcbdfb commit 7cf7f58

17 files changed

+745
-853
lines changed

IM/InfrastructureManager.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1434,10 +1434,7 @@ def check_oidc_token(im_auth):
14341434

14351435
if Config.OIDC_GROUPS:
14361436
# Get user groups from any of the possible fields
1437-
user_groups = userinfo.get('groups', # Generic
1438-
userinfo.get('entitlements', # GEANT
1439-
userinfo.get('eduperson_entitlement', # EGI Check-in
1440-
[])))
1437+
user_groups = userinfo.get(Config.OIDC_GROUPS_CLAIM, [])
14411438

14421439
if not set(Config.OIDC_GROUPS).issubset(user_groups):
14431440
raise InvaliddUserException("Invalid InfrastructureManager credentials. " +

IM/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'InfrastructureInfo', 'InfrastructureManager', 'recipe', 'request', 'REST', 'retry',
2020
'ServiceRequests', 'SSH', 'SSHRetry', 'timedcall', 'UnixHTTPAdapter',
2121
'VirtualMachine', 'VMRC', 'xmlobject']
22-
__version__ = '1.17.1'
22+
__version__ = '1.18.0'
2323
__author__ = 'Miguel Caballer'
2424

2525

IM/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class Config:
107107
OIDC_USER_INFO_PATH = "/userinfo"
108108
OIDC_INSTROSPECT_PATH = "/introspect"
109109
OIDC_GROUPS = []
110+
OIDC_GROUPS_CLAIM = "groups"
110111
VM_NUM_USE_CTXT_DIST = 30
111112
DELAY_BETWEEN_VM_RETRIES = 5
112113
VERIFI_SSL = False

IM/connectors/CloudConnector.py

-4
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,6 @@ def manage_dns_entries(self, op, vm, auth_data, extra_args=None):
738738
vm.dns_entries = []
739739
if op == "add":
740740
dns_entries = [entry for entry in self.get_dns_entries(vm) if entry not in vm.dns_entries]
741-
dns_entries = []
742-
for entry in self.get_dns_entries(vm):
743-
if entry not in vm.dns_entries:
744-
dns_entries.append(entry)
745741
else:
746742
dns_entries = list(vm.dns_entries)
747743
if dns_entries:

IM/connectors/EC2.py

+474-394
Large diffs are not rendered by default.

IM/connectors/Kubernetes.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import os
2222
import re
2323
import socket
24+
from random import choice
25+
from string import ascii_lowercase, digits
2426
from netaddr import IPNetwork, IPAddress
2527
try:
2628
from urlparse import urlparse
@@ -370,9 +372,12 @@ def _generate_ingress_data(self, namespace, name, dns, port, apps_dns, vm):
370372
if dns_url[1]:
371373
host = dns_url[1]
372374
if apps_dns and not host.endswith(apps_dns):
373-
if not host.endswith(".") and not apps_dns.startswith("."):
374-
host += "."
375-
host += apps_dns
375+
if host.endswith("."):
376+
host = host[:-1]
377+
host += "-" + ''.join(choice(ascii_lowercase + digits) for _ in range(4))
378+
if apps_dns.startswith("."):
379+
apps_dns = apps_dns[1:]
380+
host += "." + apps_dns
376381
if dns_url[2]:
377382
path = dns_url[2]
378383

changelog

+4
Original file line numberDiff line numberDiff line change
@@ -777,3 +777,7 @@ IM 1.17.1:
777777
* Speed up Ansible installation using newer versions.
778778
* Fix problem with 0 disk flavors in OpenStack.
779779
* Flush Inf data to DB in case of service termination.
780+
781+
IM 1.18.0:
782+
* Enable to get IM stats.
783+
* Migrate EC2 conn to boto3 library.

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@type": "SoftwareSourceCode",
77
"identifier": "im",
88
"name": "Infrastructure Manager",
9-
"version": "1.17.1",
9+
"version": "1.18.0",
1010
"description": "IM is a tool that deploys complex and customized virtual infrastructures on IaaS Cloud deployments",
1111
"license": "GNU General Public License v3.0",
1212
"author": [

doc/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
copyright = '2023, I3M-GRyCAP'
44
author = 'micafer'
55

6-
version = '1.17'
7-
release = '1.17.1'
6+
version = '1.18'
7+
release = '1.18.0'
88

99
master_doc = 'index'
1010

docker-devel/Dockerfile

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Dockerfile to create a container with the IM service
2-
FROM ubuntu:22.04
2+
FROM ubuntu:24.04
33
ARG BRANCH=devel
44
LABEL maintainer="Miguel Caballer <[email protected]>"
5-
LABEL version="1.17.1"
5+
LABEL version="1.18.0"
66
LABEL description="Container image to run the IM service. (http://www.grycap.upv.es/im)"
77
EXPOSE 8899 8800
88

@@ -12,19 +12,18 @@ RUN apt-get update && apt-get install --no-install-recommends -y patch wget pyth
1212

1313
# Install IM
1414
RUN apt-get update && apt-get install --no-install-recommends -y python3-setuptools python3-pip git && \
15-
pip3 install -U pip && \
16-
pip3 install msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity==1.8.0 && \
17-
pip3 install pyOpenSSL cheroot xmltodict pymongo ansible==8.7.0&& \
18-
pip3 install git+https://github.com/micafer/libcloud@ost_nets_extra && \
19-
pip3 install apache-libcloud==3.8.0 git+https://github.com/grycap/im@$BRANCH && \
15+
pip3 install --break-system-packages msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity==1.8.0 && \
16+
pip3 install --break-system-packages pyOpenSSL cheroot xmltodict pymongo ansible==8.7.0&& \
17+
pip3 install --break-system-packages git+https://github.com/micafer/libcloud@ost_nets_extra && \
18+
pip3 install --break-system-packages apache-libcloud==3.8.0 git+https://github.com/grycap/im@$BRANCH && \
2019
apt-get purge -y python3-pip git && \
2120
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf ~/.cache/
2221

2322
# Patch libcloud to add network extra
2423
# untill this PR is merged and released
2524
# https://github.com/apache/libcloud/pull/2016
2625
COPY ost.patch /tmp/ost.patch
27-
RUN patch /usr/local/lib/python3.10/dist-packages/libcloud/compute/drivers/openstack.py < /tmp/ost.patch && rm /tmp/ost.patch
26+
RUN patch /usr/local/lib/python3.12/dist-packages/libcloud/compute/drivers/openstack.py < /tmp/ost.patch && rm /tmp/ost.patch
2827

2928
# Copy im configuration files
3029
RUN mkdir /etc/im
@@ -38,8 +37,5 @@ RUN sed -i -e 's/VM_NUM_USE_CTXT_DIST = 30/VM_NUM_USE_CTXT_DIST = 3/g' /etc/im/i
3837
# Copy a ansible.cfg with correct minimum values
3938
COPY ansible.cfg /etc/ansible/ansible.cfg
4039

41-
# Fix boto issue https://github.com/boto/boto/issues/3783
42-
COPY endpoints.json /usr/local/lib/python3.10/dist-packages/boto/endpoints.json
43-
4440
# Start IM service
4541
CMD /usr/local/bin/im_service

docker-py3/Dockerfile

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dockerfile to create a container with the IM service
2-
FROM ubuntu:22.04
2+
FROM ubuntu:24.04
33

44
ENV VERSION=1.17.1
55

@@ -14,18 +14,17 @@ RUN apt-get update && apt-get install --no-install-recommends -y patch wget pyth
1414

1515
# Install IM
1616
RUN apt-get update && apt-get install --no-install-recommends -y python3-setuptools python3-pip git && \
17-
pip3 install -U pip && \
18-
pip3 install msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity==1.8.0 && \
19-
pip3 install pyOpenSSL cheroot xmltodict pymongo ansible==8.7.0&& \
20-
pip3 install apache-libcloud==3.8.0 IM==${VERSION} &&\
17+
pip3 install --break-system-packages msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity==1.8.0 && \
18+
pip3 install --break-system-packages pyOpenSSL cheroot xmltodict pymongo ansible==8.7.0&& \
19+
pip3 install --break-system-packages apache-libcloud==3.8.0 IM==${VERSION} &&\
2120
apt-get purge -y python3-pip git && \
2221
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf ~/.cache/
2322

2423
# Patch libcloud to add network extra
2524
# untill this PR is merged and released
2625
# https://github.com/apache/libcloud/pull/2016
2726
COPY ost.patch /tmp/ost.patch
28-
RUN patch /usr/local/lib/python3.10/dist-packages/libcloud/compute/drivers/openstack.py < /tmp/ost.patch && rm /tmp/ost.patch
27+
RUN patch /usr/local/lib/python3.12/dist-packages/libcloud/compute/drivers/openstack.py < /tmp/ost.patch && rm /tmp/ost.patch
2928

3029
# Copy im configuration files
3130
RUN mkdir /etc/im
@@ -36,8 +35,5 @@ RUN wget https://raw.githubusercontent.com/grycap/im/v${VERSION}/etc/logging.con
3635
# Copy a ansible.cfg with correct minimum values
3736
COPY ansible.cfg /etc/ansible/ansible.cfg
3837

39-
# Fix boto issue https://github.com/boto/boto/issues/3783
40-
COPY endpoints.json /usr/local/lib/python3.10/dist-packages/boto/endpoints.json
41-
4238
# Start IM service
4339
CMD ["/usr/local/bin/im_service"]

docker-py3/Dockerfile.alp

-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,5 @@ RUN apk add --no-cache git &&\
4040
# Copy a ansible.cfg with correct minimum values
4141
COPY ansible.cfg /etc/ansible/ansible.cfg
4242

43-
# Fix boto issue https://github.com/boto/boto/issues/3783
44-
COPY endpoints.json /usr/lib/python3.10/site-packages/boto/endpoints.json
45-
4643
# Start IM service
4744
CMD im_service.py

etc/im.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ OIDC_ISSUERS = https://aai.egi.eu/auth/realms/egi
145145
#OIDC_INSTROSPECT_PATH = "/introspect"
146146
# List of OIDC groups that will be allowed to access the IM service
147147
#OIDC_GROUPS =
148+
# Claim where the groups are stored in the OIDC token
149+
# OIDC_GROUPS_CLAIM = groups
148150
# Force the users to pass a valid OIDC token
149151
#FORCE_OIDC_AUTH = False
150152

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dependencies = [
4848
"PyYAML",
4949
"suds-community",
5050
"cheroot",
51-
"boto >= 2.29",
51+
"boto3",
5252
"apache-libcloud >= 3.2.0",
5353
"RADL >= 1.3.3",
5454
"flask",

requirements-tests.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ansible-base
33
paramiko >= 1.14
44
PyYAML
55
cheroot
6-
boto >= 2.29
6+
boto3
77
apache-libcloud >= 3.3.1
88
RADL >= 1.3.3
99
flask

0 commit comments

Comments
 (0)