-
Notifications
You must be signed in to change notification settings - Fork 19
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
fix(): offboard ns when invalid labels are applied to ns #409
Conversation
Signed-off-by: gourishkb <[email protected]>
Signed-off-by: gourishkb <[email protected]>
Signed-off-by: gourishkb <[email protected]>
This filter is to prevent envoy gateway services to be fetched in the slice gateway edge list
Signed-off-by: gourishkb <[email protected]>
Signed-off-by: gourishkb <[email protected]>
worker-operator Updated the docs URL link
* fix(): configurable ns exclusion list Signed-off-by: Priyank Upadhyay <[email protected]> * fix(): refactors Signed-off-by: Priyank Upadhyay <[email protected]> --------- Signed-off-by: Priyank Upadhyay <[email protected]>
Signed-off-by: Bharath Horatti <[email protected]>
…worker env vars Signed-off-by: Mridul Gain <[email protected]>
Signed-off-by: Mridul Gain <[email protected]>
Signed-off-by: Mridul Gain <[email protected]>
…ed in worker env vars Signed-off-by: Mridul Gain <[email protected]>
Signed-off-by: Mridul Gain <[email protected]>
Signed-off-by: Mridul Gain <[email protected]>
if isClient(slicegateway) { | ||
// get the remote port number this gw pod is connected to on the remote cluster | ||
_, remotePortInUse := getClientGwRemotePortInUse(ctx, r.Client, slicegateway, GetDepNameFromPodName(slicegateway.Status.Config.SliceGatewayID, gwPod.PodName)) | ||
gwPod.RemotePort = int32(remotePortInUse) |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types High
strconv.Atoi
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that the integer value obtained from strconv.Atoi
is within the bounds of the int32
type before casting it. This can be achieved by using strconv.ParseInt
with a specified bit size of 32, which directly returns an int64
that can be safely cast to int32
after ensuring it is within the valid range.
- Replace the use of
strconv.Atoi
withstrconv.ParseInt
specifying a bit size of 32. - Add bounds checking to ensure the parsed integer is within the range of
int32
before casting.
-
Copy modified lines R684-R689
@@ -683,3 +683,8 @@ | ||
_, remotePortInUse := getClientGwRemotePortInUse(ctx, r.Client, slicegateway, GetDepNameFromPodName(slicegateway.Status.Config.SliceGatewayID, gwPod.PodName)) | ||
gwPod.RemotePort = int32(remotePortInUse) | ||
if remotePortInUse >= math.MinInt32 && remotePortInUse <= math.MaxInt32 { | ||
gwPod.RemotePort = int32(remotePortInUse) | ||
} else { | ||
log.Error(fmt.Errorf("remote port out of int32 range"), "Invalid remote port", "remotePortInUse", remotePortInUse) | ||
gwPod.RemotePort = 0 // or some default value | ||
} | ||
} |
-
Copy modified line R337 -
Copy modified lines R339-R340
@@ -336,5 +336,6 @@ | ||
if envVar.Name == "NODE_PORT" { | ||
nodePort, err := strconv.Atoi(envVar.Value) | ||
nodePort64, err := strconv.ParseInt(envVar.Value, 10, 32) | ||
if err == nil { | ||
return true, nodePort | ||
nodePort := int32(nodePort64) | ||
return true, int(nodePort) | ||
} |
Signed-off-by: gourishkb <[email protected]>
Description
When a namespace is applied labels and/or annotations that are not part of the sliceconfig spec,
worker operator does remove the labels/annotations and hence, the workloads may come up with unnecessary labels/annotations.
This issue is now fixed under the changes in this PR
Fixes #
How Has This Been Tested?
test-cases
Checklist:
go fmt
Does this PR introduce a breaking change?