[英]Building operator image directly without operator-sdk?
I had created my Kubernetes operator with the help of the Operator SDK Now I want to make some automatic build with my GitHub repo so when I push something to the master to trigger build of the operator image.我在Operator SDK的帮助下创建了 Kubernetes 运算符
Can I use go build + docker build
(for building the image) instead of the operator-sdk build
?我可以使用go build + docker build
(用于构建图像)而不是operator-sdk build
吗?
Because if it is doing the same job I don't want to depend on one more tool for building the image.因为如果它在做同样的工作,我不想再依赖一种工具来构建图像。
I run operator-sdk build
with --verbose
and it looks like it is doing these only two thing (go build + docker build) but I am not sure.我使用--verbose
运行operator-sdk build
,看起来它只做这两件事(go build + docker build),但我不确定。 There could be some validations and checks before these command if I don't want to such validations exist I don't want to skip them.如果我不想存在这样的验证,我不想跳过它们,那么在这些命令之前可能会有一些验证和检查。
Is a bad idea to use go
and docker
to directly build the image instead of operator-sdk
?使用go
和docker
直接构建映像而不是operator-sdk
是一个坏主意吗? Because I don't want to do something special during the build I just want to not have one more dependency in the build infrastructure if it's possible to avoid it.因为我不想在构建过程中做一些特别的事情,所以如果可以避免的话,我只想在构建基础架构中不再依赖它。
I faced a similar question and if you look at the source code for operator-sdk
, it actually triggers go build
and a docker build
(the CLI, and not even the APIs for docker build
).我遇到了类似的问题,如果您查看operator-sdk
的源代码,它实际上会触发go build
和docker build
(CLI,甚至不是docker build
的 API)。 So yes, I wrote a simple docker file to do a go build
.所以是的,我写了一个简单的 docker 文件来go build
。 That's it.而已。
EDIT: Here's the source for how the docker build
command is formed and finally run as a system command: https://github.com/operator-framework/operator-sdk/blob/master/cmd/operator-sdk/build/cmd.go#L98编辑:这是docker build
命令如何形成并最终作为系统命令运行的来源: https://github.com/operator-framework/operator-sdk/blob/master/cmd/operator-sdk/build/cmd .go#L98
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.