MCPcopy
hub / github.com/vmware-tanzu/sonobuoy / avoidResultsDirIssue

Function avoidResultsDirIssue

pkg/discovery/discovery.go:238–261  ·  view source on GitHub ↗

avoidResultsDirIssue prevents issue #1688; a mismatch between the resultsDir specified in the config and what is on the plugins. If that happens the worker and plugin fail to communicate and the plugin hangs.

(plugins []plugin.Interface, dir string)

Source from the content-addressed store, hash-verified

236// resultsDir specified in the config and what is on the plugins. If that happens
237// the worker and plugin fail to communicate and the plugin hangs.
238func avoidResultsDirIssue(plugins []plugin.Interface, dir string) {
239 if os.Getenv("SONOBUOY_DISABLE_RECONCILIATION") == "true" {
240 logrus.Debugln("Skipping transforms to avoid issues with legacy RESULTS_DIR since SONOBUOY_DISABLE_RECONCILIATION=true was set on the aggregator pod.")
241 return
242 }
243
244 logrus.Debugln("Applying transforms to avoid issues with legacy RESULTS_DIR. To skip this transformation, set SONOBUOY_DISABLE_RECONCILIATION=true on the aggregator pod.")
245 dirEnvVars := []corev1.EnvVar{
246 {Name: sonobuoyResultsDirKey, Value: dir},
247 {Name: legacySonobuoyResultsDirKey, Value: dir},
248 }
249 for _, p := range plugins {
250 if j, ok := p.(*job.Plugin); ok {
251 AutoAttachResultsDir([]*manifest.Manifest{&j.Definition}, dir)
252 j.Definition.Spec.Env = kutil.MergeEnv(dirEnvVars, j.Definition.Spec.Env, nil)
253 continue
254 }
255 if ds, ok := p.(*daemonset.Plugin); ok {
256 AutoAttachResultsDir([]*manifest.Manifest{&ds.Definition}, dir)
257 ds.Definition.Spec.Env = kutil.MergeEnv(dirEnvVars, ds.Definition.Spec.Env, nil)
258 continue
259 }
260 }
261}
262
263func statusCounts(item *results.Item, startingCounts map[string]int) {
264 if item == nil {

Callers 1

RunFunction · 0.85

Calls 1

AutoAttachResultsDirFunction · 0.85

Tested by

no test coverage detected