Skip to content

Commit ad43749

Browse files
committed
Fix panic issue
Signed-off-by: Rokibul Hasan <[email protected]>
1 parent 750e384 commit ad43749

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/cmd/get/hubinfo/exec.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ func (o *Options) printComponents() error {
118118
}
119119

120120
o.printer.Write(printer.LEVEL_0, "Components:\n")
121-
if check.IsFeatureEnabled(cmgr.Spec.AddOnManagerConfiguration.FeatureGates, string(feature.AddonManagement)) {
121+
122+
if cmgr.Spec.AddOnManagerConfiguration != nil && check.IsFeatureEnabled(cmgr.Spec.AddOnManagerConfiguration.FeatureGates, string(feature.AddonManagement)) {
122123
if err := o.printAddOnManager(cmgr); err != nil {
123124
return err
124125
}
@@ -150,7 +151,7 @@ func (o *Options) printRegistration(cmgr *v1.ClusterManager) error {
150151

151152
func (o *Options) printWork(cmgr *v1.ClusterManager) error {
152153
o.printer.Write(printer.LEVEL_1, "Work:\n")
153-
if check.IsFeatureEnabled(cmgr.Spec.WorkConfiguration.FeatureGates, string(feature.ManifestWorkReplicaSet)) {
154+
if cmgr.Spec.WorkConfiguration != nil && check.IsFeatureEnabled(cmgr.Spec.WorkConfiguration.FeatureGates, string(feature.ManifestWorkReplicaSet)) {
154155
err := printer.PrintComponentsDeploy(o.printer, o.kubeClient, cmgr.Status.RelatedResources, componentNameWorkController)
155156
if err != nil {
156157
return err

pkg/helpers/check/check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func findResource(list *metav1.APIResourceList, resourceName string) bool {
8181

8282
func IsFeatureEnabled(featureGates []operatorv1.FeatureGate, feature string) bool {
8383
for _, fg := range featureGates {
84-
if fg.Feature == feature {
84+
if fg.Feature == feature && fg.Mode == operatorv1.FeatureGateModeTypeEnable {
8585
return true
8686
}
8787
}

0 commit comments

Comments
 (0)