github-vet / github-vet/rangeloop-pointer-findings
wmstipes/k8s-rvstore: Advanced Kubernetes/scheduler/kubernetes/test/e2e/scalability/load.go; 139 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [wmstipes/k8s-rvstore](https://www.github.com/wmstipes/k8s-rvstore) at [Advanced Kubernetes/scheduler/kubernetes/test/e2e/scalability/load.go](https://github.com/wmstipes/k8s-rvstore/blob/ca7165fd6e93e383535c89493066aac1c0eaa538/Advanced Kubernetes/scheduler/kubernetes/test/e2e/scalability/load.go#L203-L341)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.
>
[Click here to see the code in its original context.](https://github.com/wmstipes/k8s-rvstore/blob/ca7165fd6e93e383535c89493066aac1c0eaa538/Advanced Kubernetes/scheduler/kubernetes/test/e2e/scalability/load.go#L203-L341)
Click here to show the 139 line(s) of Go which triggered the analyzer.
```go
for _, testArg := range loadTests {
feature := "ManualPerformance"
if isCanonical(&testArg) {
feature = "Performance"
}
name := fmt.Sprintf("[Feature:%s] should be able to handle %v pods per node %v with %v secrets, %v configmaps and %v daemons",
feature,
testArg.podsPerNode,
testArg.kind,
testArg.secretsPerPod,
testArg.configMapsPerPod,
testArg.daemonsPerNode,
)
if testArg.quotas {
name += " with quotas"
}
itArg := testArg
itArg.services = os.Getenv("CREATE_SERVICES") != "false"
It(name, func() {
// Create a number of namespaces.
namespaceCount := (nodeCount + nodeCountPerNamespace - 1) / nodeCountPerNamespace
namespaces, err := CreateNamespaces(f, namespaceCount, fmt.Sprintf("load-%v-nodepods", itArg.podsPerNode), testPhaseDurations.StartPhase(110, "namespace creation"))
framework.ExpectNoError(err)
totalPods := (itArg.podsPerNode - itArg.daemonsPerNode) * nodeCount
configs, secretConfigs, configMapConfigs = generateConfigs(totalPods, itArg.image, itArg.command, namespaces, itArg.kind, itArg.secretsPerPod, itArg.configMapsPerPod)
if itArg.quotas {
framework.ExpectNoError(CreateQuotas(f, namespaces, 2*totalPods, testPhaseDurations.StartPhase(115, "quota creation")))
}
f.AddonResourceConstraints = loadResourceConstraints()
serviceCreationPhase := testPhaseDurations.StartPhase(120, "services creation")
defer serviceCreationPhase.End()
if itArg.services {
e2elog.Logf("Creating services")
services := generateServicesForConfigs(configs)
createService := func(i int) {
defer GinkgoRecover()
framework.ExpectNoError(testutils.CreateServiceWithRetries(clientset, services[i].Namespace, services[i]))
}
workqueue.ParallelizeUntil(context.TODO(), serviceOperationsParallelism, len(services), createService)
e2elog.Logf("%v Services created.", len(services))
defer func(services []*v1.Service) {
serviceCleanupPhase := testPhaseDurations.StartPhase(800, "services deletion")
defer serviceCleanupPhase.End()
e2elog.Logf("Starting to delete services...")
deleteService := func(i int) {
defer GinkgoRecover()
framework.ExpectNoError(testutils.DeleteResourceWithRetries(clientset, api.Kind("Service"), services[i].Namespace, services[i].Name, nil))
}
workqueue.ParallelizeUntil(context.TODO(), serviceOperationsParallelism, len(services), deleteService)
e2elog.Logf("Services deleted")
}(services)
} else {
e2elog.Logf("Skipping service creation")
}
serviceCreationPhase.End()
// Create all secrets.
secretsCreationPhase := testPhaseDurations.StartPhase(130, "secrets creation")
defer secretsCreationPhase.End()
for i := range secretConfigs {
secretConfigs[i].Run()
defer secretConfigs[i].Stop()
}
secretsCreationPhase.End()
// Create all configmaps.
configMapsCreationPhase := testPhaseDurations.StartPhase(140, "configmaps creation")
defer configMapsCreationPhase.End()
for i := range configMapConfigs {
configMapConfigs[i].Run()
defer configMapConfigs[i].Stop()
}
configMapsCreationPhase.End()
// StartDaemon if needed
daemonSetCreationPhase := testPhaseDurations.StartPhase(150, "daemonsets creation")
defer daemonSetCreationPhase.End()
for i := 0; i < itArg.daemonsPerNode; i++ {
daemonName := fmt.Sprintf("load-daemon-%v", i)
daemonConfig := &testutils.DaemonConfig{
Client: f.ClientSet,
Name: daemonName,
Namespace: f.Namespace.Name,
LogFunc: e2elog.Logf,
}
daemonConfig.Run()
defer func(config *testutils.DaemonConfig) {
framework.ExpectNoError(framework.DeleteResourceAndWaitForGC(
f.ClientSet,
extensions.Kind("DaemonSet"),
config.Namespace,
config.Name,
))
}(daemonConfig)
}
daemonSetCreationPhase.End()
// Simulate lifetime of RC:
// * create with initial size
// * scale RC to a random size and list all pods
// * scale RC to a random size and list all pods
// * delete it
//
// This will generate ~5 creations/deletions per second assuming:
// - X small RCs each 5 pods [ 5 * X = totalPods / 2 ]
// - Y medium RCs each 30 pods [ 30 * Y = totalPods / 4 ]
// - Z big RCs each 250 pods [ 250 * Z = totalPods / 4]
// We would like to spread creating replication controllers over time
// to make it possible to create/schedule them in the meantime.
// Currently we assume pods/second average throughput.
// We may want to revisit it in the future.
e2elog.Logf("Starting to create %v objects...", itArg.kind)
creatingTime := time.Duration(totalPods/throughput) * time.Second
createAllResources(configs, creatingTime, testPhaseDurations.StartPhase(200, "load pods creation"))
By("============================================================================")
// We would like to spread scaling replication controllers over time
// to make it possible to create/schedule & delete them in the meantime.
// Currently we assume that pods/second average throughput.
// The expected number of created/deleted pods is totalPods/4 when scaling,
// as each RC changes its size from X to a uniform random value in [X/2, 3X/2].
scalingTime := time.Duration(totalPods/(4*throughput)) * time.Second
e2elog.Logf("Starting to scale %v objects first time...", itArg.kind)
scaleAllResources(configs, scalingTime, testPhaseDurations.StartPhase(300, "scaling first time"))
By("============================================================================")
// Cleanup all created replication controllers.
// Currently we assume pods/second average deletion throughput.
// We may want to revisit it in the future.
deletingTime := time.Duration(totalPods/throughput) * time.Second
e2elog.Logf("Starting to delete %v objects...", itArg.kind)
deleteAllResources(configs, deletingTime, testPhaseDurations.StartPhase(500, "load pods deletion"))
})
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {isCanonical 1} was not found in the callgraph; reference was passed directly to third-party code
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: ca7165fd6e93e383535c89493066aac1c0eaa538
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.