Skip to content

Commit

Permalink
fix: fix slice init issue
Browse files Browse the repository at this point in the history
Signed-off-by: cuishuang <[email protected]>
  • Loading branch information
cuishuang committed Sep 26, 2024
1 parent 841368a commit 1e0c2ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cloud/pkg/cloudstream/iptables/iptables.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (im *Manager) reconcile() {
for _, ipports := range addedIPPort {
ipport := strings.Split(ipports, ":")
ip, port := ipport[0], ipport[1]
args := append([]string{"-p", "tcp", "-j", "DNAT", "--dport", port, "--to", ip + ":" + strconv.Itoa(im.streamPort)})
args := []string{"-p", "tcp", "-j", "DNAT", "--dport", port, "--to", ip + ":" + strconv.Itoa(im.streamPort)}
if _, err := im.iptables.EnsureRule(utiliptables.Append, utiliptables.TableNAT, tunnelPortChain, args...); err != nil {
klog.ErrorS(err, "Failed to ensure rules", "table", utiliptables.TableNAT, "chain", tunnelPortChain)
return
Expand All @@ -150,7 +150,7 @@ func (im *Manager) reconcile() {
for _, ipports := range deletedIPPort {
ipport := strings.Split(ipports, ":")
ip, port := ipport[0], ipport[1]
args := append([]string{"-p", "tcp", "-j", "DNAT", "--dport", port, "--to", ip + ":" + strconv.Itoa(im.streamPort)})
args := []string{"-p", "tcp", "-j", "DNAT", "--dport", port, "--to", ip + ":" + strconv.Itoa(im.streamPort)}
if err := im.iptables.DeleteRule(utiliptables.TableNAT, tunnelPortChain, args...); err != nil {
klog.ErrorS(err, "Failed to delete rules", "table", utiliptables.TableNAT, "chain", tunnelPortChain)
return
Expand Down
2 changes: 1 addition & 1 deletion keadm/cmd/keadm/app/cmd/helm/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (cu *KubeCloudHelmInstTool) checkProfile(baseHelmRoot string) error {
validProfiles[IptablesMgrProfileKey] = true
validProfiles[ControllerManagerProfileKey] = true
if ok := validProfiles[cu.ProfileKey]; !ok {
validKeys := make([]string, len(validProfiles))
validKeys := make([]string, 0, len(validProfiles))
for k := range validProfiles {
validKeys = append(validKeys, k)
}
Expand Down

0 comments on commit 1e0c2ea

Please sign in to comment.