跳转到主要内容

为Thoth的Python Source-To-Image (s2i)应用程序提供的工具和库

项目描述

为Thoth的Python Source-To-Image (s2i)应用程序提供的工具和库。

此应用程序可以帮助您将现有应用程序迁移到Thoth或展示集群中使用的构建配置信息。

请观看 在线逐步教程,了解此工具的使用方法

如何将现有的Python s2i应用程序迁移到使用Thoth

如果您有一个使用OpenShift s2i的Python应用程序,并且希望从Thoth的建议中受益,您只需在安装 thoth-s2i 后执行以下命令即可简单地迁移所有OpenShift模板

thoth-s2i patch --s2i-thoth quay.io/thoth-station/s2i-thoth-ubi8-py36 --insert-env-var path/to/openshift/templates

上述命令将在提供的目录中查找所有模板,并加载使用的构建配置。如果构建配置使用s2i镜像流,它将简单地用Thoth的s2i替换它。

查看更多可用选项和配置选项,请参阅 --help

如果应用程序已部署,您可以检查在构建应用程序的命名空间中使用的构建配置所用的镜像流。

thoth-s2i report --namespace <my-namespace>

上述命令将为您提供有关构建配置中使用的镜像流、镜像流标签和导入的容器镜像的完整报告。

如果您希望将应用程序迁移到使用 Thoth 的推荐引擎,可以运行以下迁移脚本

thoth-s2i migrate --namespace <my-namespace> -l app=myapp --s2i-thoth quay.io/thoth-station/s2i-thoth-ubi8-py36 --tag latest --insert-env-vars --from-image-stream-tag 'registry.redhat.io/ubi8/python-36:*' --dry-run

上述命令将执行“dry run”操作 - 它将遍历与给定标签选择器 app=myapp 匹配的可用构建配置,并将任何对 registry.redhat.io/ubi8/python-36 的使用替换为最新的 Thoth 等效 UBI 8 镜像。此外,它将注入 Thoth 正确构建和配置 OpenShift 构建过程所需的环境变量。

在审查完所做的更改(它们被打印到 stdout/stderr)后,您可以在集群中实际执行此操作

thoth-s2i migrate --namespace <my-namespace> -l app=myapp --s2i-thoth quay.io/thoth-station/s2i-thoth-ubi8-py36 --tag latest --insert-env-vars --from-image-stream-tag 'registry.redhat.io/ubi8/python-36:*' --trigger-build --import-image

上述命令将更改应用到集群。此外,如果对构建配置所做的更改不会触发新的构建(没有配置更改的构建触发器),thoth-s2i 将触发 OpenShift 对调整后的构建配置的构建。使用的 Thoth s2i 镜像将被导入到 OpenShift 的注册表中。

有关更多信息,请参阅 thoth-s2i migrate --help

列出可用的 Thoth s2i 镜像

您可以使用 Thoth 列出由 Thoth 提供的可用的 Thoth s2i 容器镜像

thoth-s2i images

有关更多信息,请参阅 --help

获取集群中 BuildConfig 配置的信息

要获取命名空间内 BuildConfig 配置和镜像流配置的信息,请运行以下命令

$ thoth-s2i report --namespace <my-namespace>
📝 init-job
        🠒 strategy: 'Source'
        🠒 image_stream: 's2i-thoth-ubi8-py36'
        🠒 image_stream_tag: 'latest'
        🠒 is_s2i: True
        🠒 is_s2i_thoth: True
        🠒 s2i_image_name: 'quay.io/thoth-station/s2i-thoth-ubi8-py36'
        🠒 s2i_image_tag: 'v0.8.0'
📝 inspect-hwinfo
        🠒 strategy: 'Source'
        🠒 image_stream: 's2i-thoth-ubi8-py36'
        🠒 image_stream_tag: 'latest'
        🠒 is_s2i: True
        🠒 is_s2i_thoth: True
        🠒 s2i_image_name: 'quay.io/thoth-station/s2i-thoth-ubi8-py36'
        🠒 s2i_image_tag: 'v0.8.0'
📝 inspection-test-9ae7a488
        🠒 strategy: 'Docker'
        🠒 is_s2i: False
📝 inspection-test-ce614dfe
        🠒 strategy: 'Docker'
      🠒 is_s2i: False

有关更多信息,请参阅 --help

导入 Thoth s2i 容器镜像

要将 Thoth 的 s2i 兼容镜像导入到集群,请运行以下命令

thoth-s2i import-image --namespace <my-namespace>

有关更多信息,请参阅 --help

将现有应用程序迁移到使用 Thoth 的推荐引擎

此工具可以自动将使用 Python s2i(源到镜像)的现有应用程序迁移到 Thoth s2i。这样,应用程序将受益于 Thoth 对软件堆栈的建议。为此,请运行以下命令

thoth-s2i migrate --namespace <my-namespace> --import-image --s2i-thoth quay.io/thoth-station/s2i-thoth-ubi8-py36 --tag latest --trigger-build -l app=myapp

有关更多信息,请参阅 --help

修补 Thoth 的 OpenShift 模板

要自动修补本地 OpenShift 模板以便它们使用 Thoth 的 s2i,请运行以下命令

thoth-s2i patch openshift/ --s2i-thoth quay.io/thoth-station/s2i-thoth-ubi8-py36 --insert-env-variables

有关更多信息,请参阅 --help

安装

要安装 thoth-s2i 库,请运行以下命令之一

# Using pip:
pip3 install thoth-s2i

# or using Pipenv:
pipenv install thoth-s2i

# or using directly git branch:
pip3 install git+https://github.com/thoth-station/thoth-s2i@master

请参阅 PyPI 上的托管项目 PyPI 和 GitHub 上的源代码 GitHub

从 Git 运行

要从 Git master 分支运行此实用程序,请运行以下命令

git clone https://github.com/thoth-station/s2i
cd s2i
pipenv install --dev
PYTHONPATH=. pipenv run python3 ./thoth-s2i --help

项目详情


下载文件

下载适合您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。

源分发

thoth-s2i-0.1.2.tar.gz (14.6 kB 查看哈希值)

上传时间 源代码

由以下组织支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面