创建新项目或命名空间时在 Openshift 上添加内部 webhook

Add internal webhook on Openshift when creating a new project or namespace

提问人:uniwinux 提问时间:11/7/2023 更新时间:11/9/2023 访问量:22

问:

我不是在谈论从 git/gitlab/argocd 创建 webhook,我想要的是当 Openshift 创建一个新项目时,它会调用一个 webhook(或脚本或过程),所以它只执行一次。它应该创建共享密钥/配置映射。

这应该是解决方案,https://bugzilla.redhat.com/show_bug.cgi?id=1346209 但Redhat关闭了它。

知道怎么做吗?

OpenShift Webhook

评论


答:

0赞 Ricky Vene 11/7/2023 #1

您需要创建一个自定义控制器或操作员来监视新项目事件,然后创建一个具有速率限制的 Webhook,https://github.com/rv-openshift/webhook-rate,这是一个具有速率限制的 Webhook。

0赞 titou10 11/9/2023 #2

您不需要 webhook,即修改为新项目创建的对象

您可以修改用于创建新项目的模板并添加您喜欢的任何对象(ConfigMap 等),还可以设置安全性

OCP官方文档:https://docs.openshift.com/container-platform/4.14/applications/projects/configuring-project-creation.html

默认模板创建 2 件事:a和 aProjectRoleBinding