engine, yamlgraph: Disable the old exported resources stuff

These were really just stubs so that I could prove out the reactive
model very early, and I don't think they're really used anywhere.

I'm also not really using the yamlgraph frontend. If someone wants any
of that code, step up, or it will rot even more.
This commit is contained in:
James Shubin
2025-03-24 19:17:26 -04:00
parent 3dfca97f86
commit 30aca74089
4 changed files with 30 additions and 42 deletions

View File

@@ -30,7 +30,6 @@
package yamlgraph
import (
"context"
"fmt"
"sync"
@@ -170,8 +169,8 @@ func (obj *GAPI) Next() chan gapi.Next {
return
}
// FIXME: add timeout to context
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
//ctx, cancel := context.WithCancel(context.Background())
//defer cancel()
startChan := make(chan struct{}) // start signal
close(startChan) // kick it off!
@@ -180,16 +179,17 @@ func (obj *GAPI) Next() chan gapi.Next {
if obj.data.NoStreamWatch {
watchChan = nil
} else {
var err error
watchChan, err = obj.data.World.ResWatch(ctx)
if err != nil {
next := gapi.Next{
Err: errwrap.Wrapf(err, "%s: could not start watch", Name),
Exit: true, // exit, b/c programming error?
}
ch <- next
return
}
// XXX: disabled for now until someone ports to new API.
//var err error
//watchChan, err = obj.data.World.ResWatch(ctx)
//if err != nil {
// next := gapi.Next{
// Err: errwrap.Wrapf(err, "%s: could not start watch", Name),
// Exit: true, // exit, b/c programming error?
// }
// ch <- next
// return
//}
}
for {

View File

@@ -32,7 +32,6 @@
package yamlgraph
import (
"context"
"fmt"
"strings"
@@ -239,12 +238,13 @@ func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.World,
}
// store in backend (usually etcd)
if err := world.ResExport(context.TODO(), resourceList); err != nil {
return nil, fmt.Errorf("config: could not export resources: %v", err)
}
// XXX: disabled for now until someone ports to new API.
//if err := world.ResExport(context.TODO(), resourceList); err != nil {
// return nil, fmt.Errorf("config: could not export resources: %v", err)
//}
// lookup from backend (usually etcd)
var hostnameFilter []string // empty to get from everyone
//var hostnameFilter []string // empty to get from everyone
kindFilter := []string{}
for _, t := range obj.Collector {
kind := strings.ToLower(t.Kind)
@@ -253,11 +253,12 @@ func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.World,
// do all the graph look ups in one single step, so that if the backend
// database changes, we don't have a partial state of affairs...
if len(kindFilter) > 0 { // if kindFilter is empty, don't need to do lookups!
var err error
resourceList, err = world.ResCollect(context.TODO(), hostnameFilter, kindFilter)
if err != nil {
return nil, fmt.Errorf("config: could not collect resources: %v", err)
}
// XXX: disabled for now until someone ports to new API.
//var err error
//resourceList, err = world.ResCollect(context.TODO(), hostnameFilter, kindFilter)
//if err != nil {
// return nil, fmt.Errorf("config: could not collect resources: %v", err)
//}
}
for _, res := range resourceList {
matched := false
@@ -283,11 +284,12 @@ func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.World,
// res.MetaParams().Noop = noop
//}
if t.Pattern != "" { // XXX: simplistic for now
if xres, ok := res.(engine.CollectableRes); ok {
xres.CollectPattern(t.Pattern) // res.Dirname = t.Pattern
}
}
// XXX: disabled for now until someone ports to new API.
//if t.Pattern != "" { // XXX: simplistic for now
// if xres, ok := res.(engine.CollectableRes); ok {
// xres.CollectPattern(t.Pattern) // res.Dirname = t.Pattern
// }
//}
obj.Logf("collected: %s", res)