Skip to content

Commit 84e7dc2

Browse files
committed
Simulator: load simulator CRDs earlier
The NodeConfig CRD was loaded just before loading NodeConfig objects. There is a chance the client can't get the mapping. Move the CRD loading to the first stage. Signed-off-by: Kiefer Chang <[email protected]>
1 parent 72c1d93 commit 84e7dc2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pkg/simulator/objects/apply.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"k8s.io/client-go/restmapper"
2424

2525
supportbundlekit "github.com/rancher/support-bundle-kit/pkg/simulator/apis/supportbundlekit.io/v1"
26+
"github.com/rancher/support-bundle-kit/pkg/simulator/crd"
2627
)
2728

2829
type ProgressHandler func(int, int)
@@ -90,6 +91,13 @@ func (o *ObjectManager) CreateUnstructuredClusterObjects() error {
9091

9192
progressMgr := NewProgressManager("Step 1/4: Cluster CRDs")
9293

94+
// add simulator CRDs
95+
simCRDs, err := crd.Objects(false)
96+
if err != nil {
97+
return fmt.Errorf("error generating Simulator CRD objects: %v", err)
98+
}
99+
crds = append(crds, simCRDs...)
100+
93101
// apply CRDs first
94102
err = o.ApplyObjects(crds, false, nil, progressMgr.progress)
95103
if err != nil {

pkg/simulator/objects/process_node_zips.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"k8s.io/apimachinery/pkg/runtime"
1616

1717
bundlekit "github.com/rancher/support-bundle-kit/pkg/simulator/apis/supportbundlekit.io/v1"
18-
"github.com/rancher/support-bundle-kit/pkg/simulator/crd"
1918
)
2019

2120
const (
@@ -94,11 +93,6 @@ func (o *ObjectManager) ProcessNodeZipObjects() (noStatusObjs []runtime.Object,
9493
return noStatusObjs, withStatusObjs, fmt.Errorf("error evaulating absolute path to node dirs: %v", err)
9594
}
9695

97-
crdObjects, err := crd.Objects(false)
98-
if err != nil {
99-
return noStatusObjs, withStatusObjs, fmt.Errorf("error generating CRD objects: %v", err)
100-
}
101-
10296
nodeZipList, err := generateNodeZipList(bundleAbsPath)
10397

10498
if err != nil {
@@ -114,8 +108,6 @@ func (o *ObjectManager) ProcessNodeZipObjects() (noStatusObjs []runtime.Object,
114108
&NodeInfoNS, &NodeInfoSASecret, &NodeInfoSA,
115109
}
116110

117-
noStatusObjs = append(noStatusObjs, crdObjects...)
118-
119111
for _, v := range podList {
120112
withStatusObjs = append(withStatusObjs, v)
121113
}

0 commit comments

Comments
 (0)