INNER CODE UNIT · Go
instancesMap
jaegertracing/jaeger-operator · pkg/autoclean/main.go:74
instancesMap := make(map[string]*v1.Jaeger)
deployments := &appsv1.DeploymentList{}
deployOpts := []client.ListOption{
matchingLabelKeys(map[string]string{inject.Label: ""}),
}
// if we are not watching all namespaces, we have to get items from each namespace being watched
if namespaces := viper.GetString(v1.ConfigWatchNamespace); namespaces != v1.WatchAllNamespaces {
for _, ns := range strings.Split(namespaces, ",") {
nsDeps := &appsv1.DeploymentList{}
if err := b.clReader.List(ctx, nsDeps, append(deployOpts, client.InNamespace(ns))...); err != nil {
log.Log.Error(
err,
"error getting a list of deployments to analyze in namespace",
"namespace", ns,
)
}
deployments.Items = append(deployments.Items, nsDeps.Items...)