Skip to content

Commit

Permalink
trial
Browse files Browse the repository at this point in the history
  • Loading branch information
uriziv1 committed Aug 25, 2024
1 parent 520c34c commit a43601c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ import (
const MainBasePath = "/"
const CompatibilityBasePath = "/compatibility/"

func safeIntToUint32(val int) (uint32, error) {
if val < 0 || val > math.MaxUint32 {

Check failure on line 38 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

undefined: math
return 0, errors.New("integer overflow")

Check failure on line 39 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

undefined: errors.New
}
return uint32(val), nil
}

func GetDeployment(namespace string) *appsv1.Deployment {
return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -58,8 +65,8 @@ func GetService(port int, namespace string) *apiv1.Service {
Spec: apiv1.ServiceSpec{
Ports: []apiv1.ServicePort{
{Protocol: "TCP",
TargetPort: intstr.IntOrString{IntVal: int32(uint64(port))},
Port: int32(uint64(port)),
TargetPort: intstr.IntOrString{IntVal: safeIntToUint32(port)},

Check failure on line 68 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

multiple-value safeIntToUint32(port) (value of type (uint32, error)) in single-value context
Port: safeIntToUint32(port),

Check failure on line 69 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

multiple-value safeIntToUint32(port) (value of type (uint32, error)) in single-value context
Name: "console-port",
},
},
Expand All @@ -81,7 +88,7 @@ func GetConsolePluginCR(consolePort int, basePath string, serviceNamespace strin
Service: consolev1alpha1.ConsolePluginService{
Name: "ibm-odf-console-service",
Namespace: serviceNamespace,
Port: int32(uint64(consolePort)),
Port: safeIntToUint32(port),

Check failure on line 91 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

multiple-value safeIntToUint32(port) (value of type (uint32, error)) in single-value context

Check failure on line 91 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

undefined: port
BasePath: basePath,
},
},
Expand Down

0 comments on commit a43601c

Please sign in to comment.