List extraction is not necessary
@@ -40,7 +40,6 @@ import (
experimentsapi "github.com/thestormforge/optimize-go/pkg/api/experiments/v1alpha1"
"github.com/thestormforge/optimize-go/pkg/config"
corev1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
@@ -386,20 +385,15 @@ func (o *Options) generateExperiment() error {
// and resources generated by the generator
o.resources = make(map[string]struct{})
- metaList, err := meta.ExtractList(list)
- if err != nil {
- return err
- }
-
s := runtime.NewScheme()
clientgoscheme.AddToScheme(s)
redsky.AddToScheme(s)
- for idx, listItem := range metaList {
+ for idx := range list.Items {
// TODO this will fail if we have CRDs that we are patching since we dont have their kinds
// registered to the scheme
u := &unstructured.Unstructured{}
- if err := s.Convert(listItem, u, runtime.InternalGroupVersioner); err != nil {
+ if err := s.Convert(list.Items[idx].Object, u, runtime.InternalGroupVersioner); err != nil {
return err
}
