Skip to content

Commit

Permalink
Fix sec issues
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Nov 27, 2024
1 parent df688f9 commit 03596d1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/backends/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (k *KubeBackend) ListServices() ([]*types.Service, error) {
services := []*types.Service{}

for _, cm := range configmaps.Items {
service, err := getServiceFromConfigMap(&cm)
service, err := getServiceFromConfigMap(&cm) // #nosec G601
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/backends/knative.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (kn *KnativeBackend) ListServices() ([]*types.Service, error) {
services := []*types.Service{}

for _, cm := range configmaps.Items {
service, err := getServiceFromConfigMap(&cm)
service, err := getServiceFromConfigMap(&cm) // #nosec G601
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/backends/openfaas.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (of *OpenfaasBackend) ListServices() ([]*types.Service, error) {
services := []*types.Service{}

for _, cm := range configmaps.Items {
service, err := getServiceFromConfigMap(&cm)
service, err := getServiceFromConfigMap(&cm) // #nosec G601
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/handlers/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ func MakeJobsInfoHandler(back types.ServerlessBackend, kubeClientset kubernetes.
for _, contStatus := range pod.Status.ContainerStatuses {
if contStatus.Name == types.ContainerName {
if contStatus.State.Running != nil {
jobsInfo[jobName].StartTime = &contStatus.State.Running.StartedAt
jobsInfo[jobName].StartTime = &(contStatus.State.Running.StartedAt)
} else if contStatus.State.Terminated != nil {
jobsInfo[jobName].StartTime = &contStatus.State.Terminated.StartedAt
jobsInfo[jobName].FinishTime = &contStatus.State.Terminated.FinishedAt
jobsInfo[jobName].StartTime = &(contStatus.State.Terminated.StartedAt)
jobsInfo[jobName].FinishTime = &(contStatus.State.Terminated.FinishedAt)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/resourcemanager/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,14 @@ func getClusterStatus(service *types.Service) {
if service.Delegation == "random" {
max := big.NewInt(int64(noDelegateCode))
randomNumber, _ := rand.Int(rand.Reader, max)
randPriority := randomNumber.Int64()
randPriority := randomNumber.Uint64()
replica.Priority = uint(randPriority)
fmt.Println("Priority ", replica.Priority, " with ", service.Delegation, " delegation")
} else if service.Delegation == "load-based" {
//Map the totalClusterCPU range to a smaller range (input range 0 to 32 cpu to output range 100 to 0 priority)
totalClusterCPU := clusterStatus.CPUFreeTotal
mappedCPUPriority := mapToRange(totalClusterCPU, 0, 32000, 100, 0)
replica.Priority = uint(mappedCPUPriority)
replica.Priority = uint(mappedCPUPriority) // #nosec G115
fmt.Println("Priority ", replica.Priority, " with ", service.Delegation, " delegation")
} else if service.Delegation != "static" {
replica.Priority = noDelegateCode
Expand Down
4 changes: 2 additions & 2 deletions pkg/types/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func getPodTemplateSpec(service Service, cfg *Config) v1.PodTemplateSpec {
podSpec.Containers[i].Ports = []v1.ContainerPort{
{
Name: podPortName,
ContainerPort: int32(service.Expose.APIPort),
ContainerPort: int32(service.Expose.APIPort), // #nosec G115
},
}
podSpec.Containers[i].VolumeMounts[0].ReadOnly = false
Expand Down Expand Up @@ -352,7 +352,7 @@ func getServiceSpec(service Service, cfg *Config) *v1.Service {
Port: servicePortNumber,
TargetPort: intstr.IntOrString{
Type: 0,
IntVal: int32(service.Expose.APIPort),
IntVal: int32(service.Expose.APIPort), // #nosec G115
},
}
service_type := v1.ServiceType(typeClusterIP)
Expand Down

0 comments on commit 03596d1

Please sign in to comment.