Skip to content

Commit

Permalink
Fix panic issue
Browse files Browse the repository at this point in the history
Signed-off-by: Rokibul Hasan <[email protected]>
  • Loading branch information
RokibulHasan7 committed Oct 26, 2024
1 parent 750e384 commit ad43749
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/cmd/get/hubinfo/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ func (o *Options) printComponents() error {
}

o.printer.Write(printer.LEVEL_0, "Components:\n")
if check.IsFeatureEnabled(cmgr.Spec.AddOnManagerConfiguration.FeatureGates, string(feature.AddonManagement)) {

if cmgr.Spec.AddOnManagerConfiguration != nil && check.IsFeatureEnabled(cmgr.Spec.AddOnManagerConfiguration.FeatureGates, string(feature.AddonManagement)) {
if err := o.printAddOnManager(cmgr); err != nil {
return err
}
Expand Down Expand Up @@ -150,7 +151,7 @@ func (o *Options) printRegistration(cmgr *v1.ClusterManager) error {

func (o *Options) printWork(cmgr *v1.ClusterManager) error {
o.printer.Write(printer.LEVEL_1, "Work:\n")
if check.IsFeatureEnabled(cmgr.Spec.WorkConfiguration.FeatureGates, string(feature.ManifestWorkReplicaSet)) {
if cmgr.Spec.WorkConfiguration != nil && check.IsFeatureEnabled(cmgr.Spec.WorkConfiguration.FeatureGates, string(feature.ManifestWorkReplicaSet)) {
err := printer.PrintComponentsDeploy(o.printer, o.kubeClient, cmgr.Status.RelatedResources, componentNameWorkController)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/helpers/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func findResource(list *metav1.APIResourceList, resourceName string) bool {

func IsFeatureEnabled(featureGates []operatorv1.FeatureGate, feature string) bool {
for _, fg := range featureGates {
if fg.Feature == feature {
if fg.Feature == feature && fg.Mode == operatorv1.FeatureGateModeTypeEnable {
return true
}
}
Expand Down

0 comments on commit ad43749

Please sign in to comment.