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: add ovn dnat #2565
feat: add ovn dnat #2565
Conversation
|
|
|
|
kind: OvnDnatRule
apiVersion: kubeovn.io/v1
metadata:
name: eip-dnat
spec:
ovnEip: eip-dnat
ipName: cjhvpc-3.qa
protocol: tcp
internalPort: "22"
externalPort: "22"
# k get odnat
NAME EIP PROTOCOL V4EIP V4IP INTERNALPORT EXTERNALPORT IPNAME READY
eip-dnat eip-dnat tcp 10.5.49.4 10.116.16.30 22 22 cjhvpc-3.qa true |
再贴下lb的记录,以及连通性的测试 ?? |
pkg/controller/ovn_dnat.go
Outdated
|
||
eipName := cachedDnat.Spec.OvnEip | ||
if len(eipName) == 0 { | ||
klog.Errorf("failed to create dnat rule, should set eip") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should return err?
externalEndpoint := net.JoinHostPort(externalIp, externalPort) | ||
internalEndpoint := net.JoinHostPort(internalIp, internalPort) | ||
|
||
if err := c.ovnLegacyClient.CreateLoadBalancerRule(dnatName, externalEndpoint, internalEndpoint, protocol); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用 libovsdb api 替换原有 api 接口的操作,正在进行中,可以看下 LoadBalancer 的操作,是不是有新的api?
如果有的话,可以考虑替换为新的 api 接口
kind: OvnDnatRule
apiVersion: kubeovn.io/v1
metadata:
name: eip-dnat
spec:
ovnEip: eip-dnat
ipName: cjhvpc-3.qa
protocol: tcp
internalPort: "22"
externalPort: "22"
# k get odnat
NAME EIP PROTOCOL V4EIP V4IP INTERNALPORT EXTERNALPORT IPNAME READY
eip-dnat eip-dnat tcp 10.5.49.4 10.116.16.30 22 22 cjhvpc-3.qa true 4.验证 # k ko nbctl lb-list
UUID LB PROTO VIP IPs
d78d8ef5-bb5d-404e-98a6-6ef16e230078 eip-dnat tcp 10.5.49.4:22 10.116.16.30:22 # k ko nbctl lr-lb-list qa
UUID LB PROTO VIP IPs
d78d8ef5-bb5d-404e-98a6-6ef16e230078 eip-dnat tcp 10.5.49.4:22 10.116.16.30:22 $ telnet 10.5.49.4 22
Connecting to 10.5.49.4:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
SSH-2.0-OpenSSH_9.0 |
|
使用 libovsdb api 接口,替换原有的 ovnLegacyClient 接口,可以单独提个PR 修改下。 |
What type of this PR
Examples of user facing changes:
add ovn dnat