Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Edit hostNetwork through the k8s property #1772

Merged
merged 37 commits into from
Oct 30, 2023

Conversation

zxwsclcmxbh
Copy link

No description provided.

event/manager.go Outdated
//server: end.URL,
//暂时 rbd-eventlog-agent:6366
//server: option.Config.EventLogServer[0] + ":6363",
server: "rbd-eventlog-agent:6366",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这应该是允许参数配置的吧,而不是写死

@@ -51,6 +51,8 @@ func (c *Dis) discoverEventServer() {
var servers []string
for _, en := range re.List {
if en.URL != "" {
// rbd-eventlog-agent:6363
en.URL = option.Config.EventLogServer[0] + ":6363"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个端口一定会是6363 吗

server := getTCPConnConfig(s.serviceID, s.config["stream-server"])
if server == s.writer.server {
// TODO:bug
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

什么bug?

return getLogAddress(cluster)
//return getLogAddress(cluster)
//rbd-eventlog-agent:6362
return option.Config.EventLogServer[0] + ":6362"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要写死,固定参数可配置

//HostNetwork: func() bool {
// if _, ok := as.ExtensionSet["hostnetwork"]; ok {
// return true
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有用的注释删除掉,但是建议这部分做个兼容,避免低版本rainbond 用户已经使用了这个环境变量,发布的模版在新版本无法正常使用

@@ -155,6 +156,11 @@ func TenantServiceVersion(as *v1.AppService, dbmanager db.Manager) error {
HostIPC: createHostIPC(as, dbmanager),
},
}
// 如果参数配置了IsHostNetwork,那么使用k8s属性去修改
var s *option.Worker
if s.Config.IsHostNetwork {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

增加了全局的 hostNetwork 变量是干嘛的呢?设置这个参数,让 worker 生成的所有pod全部使用 hostNetwork 模式?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目的是做个兼容,如果新版本,需要用k8s属性的模式去改hostNetwork,就设置IsHostNetwork = true,否则默认IsHostNetwork = false,使用环境变量的方式去改hostNetwork。这里命名不是很规范,“IsHostNetwork”有歧义,稍后修改更详细一点。

fs.StringVar(&a.RuntimeEndpoint, "runtime-endpoint", sources.RuntimeEndpointContainerd, "container runtime endpoint")
// rbd-eventlog service
fs.StringVar(&a.EventServer, "event-server", "", "service name of event-server")
fs.StringVar(&a.LogAddress, "log-address", "", "service name of log-address")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你新增的这两个参数有啥区别呢,在参数说明里,能否给出配置示例

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在说明里还是没有给出配置示例

@zxwsclcmxbh zxwsclcmxbh changed the title feat:Modify hostNetwork through k8s properties feat:Edit hostNetwork through the k8s property Oct 29, 2023
Signed-off-by: banghao <[email protected]>
Signed-off-by: banghao <[email protected]>
@zxwsclcmxbh zxwsclcmxbh changed the title feat:Edit hostNetwork through the k8s property feat: Edit hostNetwork through the k8s property Oct 30, 2023
Signed-off-by: banghao <[email protected]>
@yangkaa yangkaa changed the base branch from main to edge_computing October 30, 2023 06:34
@yangkaa yangkaa merged commit 9294a17 into goodrain:edge_computing Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants