|
|
@ -74,6 +74,7 @@ type watcher struct {
|
|
|
|
restConfig rest.Config
|
|
|
|
restConfig rest.Config
|
|
|
|
discovery discovery.DiscoveryInterface
|
|
|
|
discovery discovery.DiscoveryInterface
|
|
|
|
clients map[schema.GroupVersionKind]*objectclient.ObjectClient
|
|
|
|
clients map[schema.GroupVersionKind]*objectclient.ObjectClient
|
|
|
|
|
|
|
|
namespaced map[schema.GroupVersionKind]bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (w *watcher) start(ctx context.Context) {
|
|
|
|
func (w *watcher) start(ctx context.Context) {
|
|
|
@ -208,15 +209,25 @@ func (w *watcher) apply(addon v1.Addon, set *objectset.ObjectSet) (map[schema.Gr
|
|
|
|
ds := op.NewDesiredSet(nil, set)
|
|
|
|
ds := op.NewDesiredSet(nil, set)
|
|
|
|
|
|
|
|
|
|
|
|
for _, gvk := range addon.Status.GVKs {
|
|
|
|
for _, gvk := range addon.Status.GVKs {
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
|
|
|
namespaced bool
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
client, ok := w.clients[gvk]
|
|
|
|
client, ok := w.clients[gvk]
|
|
|
|
if !ok {
|
|
|
|
if ok {
|
|
|
|
client, err = objectset.NewDiscoveredClient(gvk, w.restConfig, w.discovery)
|
|
|
|
namespaced = w.namespaced[gvk]
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
client, namespaced, err = objectset.NewDiscoveredClient(gvk, w.restConfig, w.discovery)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if w.namespaced == nil {
|
|
|
|
|
|
|
|
w.namespaced = map[schema.GroupVersionKind]bool{}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
w.namespaced[gvk] = namespaced
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ds.AddDiscoveredClient(gvk, client)
|
|
|
|
ds.AddDiscoveredClient(gvk, client, namespaced)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if err := ds.Apply(); err != nil {
|
|
|
|
if err := ds.Apply(); err != nil {
|
|
|
|