-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
control-service: fine-tune the job-builder-secure (#2497)
# Why We attempted to execute several data jobs utilizing secure images within our internal deployments. However, we hit a lot of issues: ``` rm: cannot remove '/var/run/secrets/kubernetes.io/serviceaccount/..data': Read-only file system rm: cannot remove '/var/run/secrets/kubernetes.io/serviceaccount/token': Read-only file system rm: cannot remove '/var/run/secrets/kubernetes.io/serviceaccount/namespace': Read-only file system rm: cannot remove '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt': Read-only file system rm: cannot remove '/var/run/secrets/kubernetes.io/serviceaccount/..2023_07_28_14_10_49.411331550/token': Read-only file system rm: cannot remove '/var/run/secrets/kubernetes.io/serviceaccount/..2023_07_28_14_10_49.411331550/namespace': Read-only file system rm: cannot remove '/var/run/secrets/kubernetes.io/serviceaccount/..2023_07_28_14_10_49.411331550/ca.crt': Read-only file system error building image: error building stage: failed to execute command: waiting for process to exit: exit status 1 ``` ``` Traceback (most recent call last): File "/vdk/site-packages/vdk/internal/plugin/plugin.py", line 56, in load_plugins_from_setuptools_entrypoints self.__plugin_manager.load_setuptools_entrypoints(self.__group_name) File "/vdk/site-packages/pluggy/_manager.py", line 364, in load_setuptools_entrypoints plugin = ep.load() File "/usr/local/lib/python3.8/importlib/metadata.py", line 77, in load module = import_module(match.group('module')) File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 843, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/vdk/site-packages/vdk/plugin/kerberos/kerberos_plugin.py", line 11, in <module> from vdk.plugin.kerberos.authenticator_factory import KerberosAuthenticatorFactory File "/vdk/site-packages/vdk/plugin/kerberos/authenticator_factory.py", line 10, in <module> from vdk.plugin.kerberos.minikerberos_authenticator import ( File "/vdk/site-packages/vdk/plugin/kerberos/minikerberos_authenticator.py", line 8, in <module> from minikerberos.common.creds import KerberosCredential File "/vdk/site-packages/minikerberos/common/creds.py", line 32, in <module> from oscrypto.asymmetric import rsa_pkcs1v15_sign, load_private_key File "/vdk/site-packages/oscrypto/asymmetric.py", line 19, in <module> from ._asymmetric import _unwrap_private_key_info File "/vdk/site-packages/oscrypto/_asymmetric.py", line 27, in <module> from .kdf import pbkdf1, pbkdf2, pkcs12_kdf File "/vdk/site-packages/oscrypto/kdf.py", line 9, in <module> from .util import rand_bytes File "/vdk/site-packages/oscrypto/util.py", line 14, in <module> from ._openssl.util import rand_bytes File "/vdk/site-packages/oscrypto/_openssl/util.py", line 6, in <module> from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error File "/vdk/site-packages/oscrypto/_openssl/_libcrypto.py", line 9, in <module> from ._libcrypto_cffi import ( File "/vdk/site-packages/oscrypto/_openssl/_libcrypto_cffi.py", line 27, in <module> raise LibraryNotFoundError('The library libcrypto could not be found') oscrypto.errors.LibraryNotFoundError: The library libcrypto could not be found warning: Plugin load failed ``` # What We have made updates to the native dependencies of the image and reverted to the base job image model. # Testing Done Execution of data jobs within the internal deployment environment. Signed-off-by: Miroslav Ivanov [email protected] --------- Signed-off-by: Miroslav Ivanov [email protected]
- Loading branch information
1 parent
99608ce
commit 8c8b752
Showing
8 changed files
with
118 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 92 additions & 3 deletions
95
projects/control-service/projects/job-base-image-secure/Dockerfile-data-job-base
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,98 @@ | ||
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices | ||
ARG base_image | ||
FROM $base_image as base | ||
FROM photon:latest as build | ||
|
||
ARG PYTHON_MAJOR | ||
ARG PYTHON_MINOR | ||
ARG PYTHON_PATCH | ||
ARG PYTHON_VERSION=${PYTHON_MAJOR}.${PYTHON_MINOR}.${PYTHON_PATCH} | ||
|
||
ARG _prefixdir=/usr/local | ||
ARG _bindir=${_prefixdir}/bin | ||
ARG _libdir=${_prefixdir}/lib | ||
ARG _workdir=/usr/src | ||
ARG _pylibdir=${_libdir}/python${PYTHON_MAJOR}.${PYTHON_MINOR} | ||
ARG _bytecode_suffixes=.cpython-*.pyc | ||
|
||
ENV PATH=${_bindir}:${PATH} | ||
WORKDIR ${_workdir} | ||
|
||
# Install build dependencies | ||
RUN yum install -y \ | ||
coreutils \ | ||
gcc \ | ||
glibc-devel \ | ||
binutils \ | ||
build-essential \ | ||
wget \ | ||
make \ | ||
openssl-devel \ | ||
bzip2-devel \ | ||
libffi-devel \ | ||
zlib-devel \ | ||
sqlite-devel \ | ||
krb5-devel \ | ||
e2fsprogs-devel | ||
|
||
# Extract python source | ||
RUN : \ | ||
&& set -ex \ | ||
&& curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz \ | ||
&& tar -xvzf Python-${PYTHON_VERSION}.tgz \ | ||
&& mv Python-${PYTHON_VERSION} python \ | ||
&& rm Python-${PYTHON_VERSION}.tgz | ||
|
||
# Build and install python | ||
RUN : \ | ||
&& set -ex \ | ||
&& cd ${_workdir}/python \ | ||
&& ./configure ax_cv_c_float_words_bigendian=no \ | ||
--enable-loadable-sqlite-extensions \ | ||
--enable-optimizations \ | ||
--enable-option-checking=fatal \ | ||
--enable-shared \ | ||
--with-lto \ | ||
--without-ensurepip \ | ||
--prefix=${_prefixdir} \ | ||
LDFLAGS=-Wl,-rpath=${_libdir} \ | ||
&& make \ | ||
&& make install | ||
|
||
# Make some useful symlinks | ||
RUN : \ | ||
&& set -ex \ | ||
&& cd ${_bindir} \ | ||
&& ln -s python${PYTHON_MAJOR} python | ||
|
||
# Get and install pip | ||
RUN : \ | ||
&& set -ex \ | ||
&& curl -O https://bootstrap.pypa.io/get-pip.py \ | ||
&& python get-pip.py \ | ||
&& pip --version \ | ||
&& rm -f get-pip.py | ||
|
||
# Cleanup files | ||
RUN : \ | ||
&& set -ex \ | ||
&& rm -rf \ | ||
${_workdir}/python \ | ||
${_pylibdir}/turtle.py \ | ||
${_pylibdir}/__pycache__/turtle*${_bytecode_suffixes} \ | ||
${_bindir}/idle* \ | ||
${_pylibdir}/idlelib \ | ||
${_pylibdir}/tkinter \ | ||
${_pylibdir}/turtledemo \ | ||
${_pylibdir}/ctypes/test \ | ||
${_pylibdir}/distutils/tests \ | ||
${_pylibdir}/lib2to3/tests \ | ||
${_pylibdir}/sqlite3/test \ | ||
${_pylibdir}/test \ | ||
${_pylibdir}/tkinter/test \ | ||
${_pylibdir}/unittest/test \ | ||
&& find ${_pylibdir} -type d -name __pycache__ -exec rm -rf '{}' + | ||
|
||
FROM photon:latest | ||
|
||
# Copies essential binaries, libraries, headers, and Python files from the base Python image, | ||
# excluding build dependencies. | ||
COPY --from=base /usr/local/ /usr/local/ | ||
COPY --from=build /usr/local/ /usr/local/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/control-service/projects/job-builder-secure/version.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.3.0 | ||
1.3.1 |
92 changes: 0 additions & 92 deletions
92
projects/control-service/projects/python-image-secure/Dockerfile-python
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
projects/control-service/projects/python-image-secure/README.md
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
projects/control-service/projects/python-image-secure/publish-python-image.sh
This file was deleted.
Oops, something went wrong.