Skip to content

Commit

Permalink
fix: lorry crash when using hostnetwork (apecloud#7957)
Browse files Browse the repository at this point in the history
(cherry picked from commit 99cb59e)
  • Loading branch information
wangyelei committed Aug 12, 2024
1 parent 0fac9aa commit b220dc2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions controllers/apps/transformer_component_hostnetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package apps

import (
"slices"
"strconv"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -142,11 +143,19 @@ func updateLorrySpecAfterPortsChanged(synthesizeComp *component.SynthesizedCompo
}

func updateLorry(synthesizeComp *component.SynthesizedComponent, container *corev1.Container, httpPort, grpcPort int) error {
container.Command = []string{"lorry",
"--port", strconv.Itoa(httpPort),
"--grpcport", strconv.Itoa(grpcPort),
kbLorryBinary := "/kubeblocks/lorry"
if slices.Contains(container.Command, kbLorryBinary) {
container.Command = []string{kbLorryBinary,
"--port", strconv.Itoa(httpPort),
"--grpcport", strconv.Itoa(grpcPort),
"--config-path", "/kubeblocks/config/lorry/components/",
}
} else {
container.Command = []string{"lorry",
"--port", strconv.Itoa(httpPort),
"--grpcport", strconv.Itoa(grpcPort),
}
}

if container.StartupProbe != nil && container.StartupProbe.TCPSocket != nil {
container.StartupProbe.TCPSocket.Port = intstr.FromInt(httpPort)
}
Expand Down

0 comments on commit b220dc2

Please sign in to comment.