Skip to content

Commit

Permalink
fix(meta-labeler): fix extracting endpoint from env vars (#394)
Browse files Browse the repository at this point in the history
* fix(meta-labeler): fix extracting endpoint from env vars

Signed-off-by: arkbriar <[email protected]>

* fix: fix errors in e2e test

Signed-off-by: arkbriar <[email protected]>

---------

Signed-off-by: arkbriar <[email protected]>
  • Loading branch information
arkbriar authored Apr 4, 2023
1 parent 1d084ef commit 750be4b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pkg/controller/meta_pod_role_labeler.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func (mpl *MetaPodRoleLabeler) getMetaRole(ctx context.Context, host string, por
}
}

logger := log.FromContext(ctx)
logger.Info("No role recognized from the current member list!", "members", resp.Members, "address", fmt.Sprintf("%s:%d", host, port), "endpoint", endpoint)

return consts.MetaRoleUnknown, nil
}

Expand Down Expand Up @@ -132,7 +135,7 @@ func (mpl *MetaPodRoleLabeler) getEndpointFromEnvVars(pod *corev1.Pod, envVars [
// Get the value of RW_ADVERTISE_ADDR.
for _, envVar := range envVars {
if envVar.Name == envs.RWAdvertiseAddr {
endpoint = envVar.Value
endpoint = strings.Split(envVar.Value, ":")[0]
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/risingwave/meta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function risingwave::utils::is_meta_setup_valid() {
meta_leaders="$(k8s::kubectl::get pod -l risingwave/component=meta -l risingwave/meta-role=leader -o=jsonpath='{.items..metadata.name}')"

if [ -z "$meta_leaders" ]; then
logging::error "No meta leader node found"
logging::warn "No meta leader node found"
return 1
fi

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/risingwave/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function test::run::risingwave::multi_meta_failover_fencing() {

local old_leader_restarts
old_leader_restarts="$(k8s::kubectl::get pod "${meta_leader_names}" -o=jsonpath='{.items..status.containerStatuses..restartCount}')"
if [ "$old_leader_restarts" -le "$meta_leaders_restarts" ]; then
if ((old_leader_restarts <= meta_leaders_restarts)); then
logging::error "Leader did not restart"
return 1
fi
Expand Down

0 comments on commit 750be4b

Please sign in to comment.