Skip to content

Commit

Permalink
fix: kbcli report with sc and pvc (apecloud#5225)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshanying authored Sep 21, 2023
1 parent 1b14e9c commit fb10233
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions controllers/apps/configuration/configuration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (r *ConfigurationReconciler) runTasks(
nil,
fetcher.ClusterVerComObj)
if err != nil {
return
return err
}

revision := strconv.FormatInt(configuration.GetGeneration(), 10)
Expand All @@ -163,7 +163,7 @@ func (r *ConfigurationReconciler) runTasks(
errs = append(errs, err)
}
if len(errs) == 0 {
return
return nil
}
return utilerrors.NewAggregate(errs)
}
Expand Down
8 changes: 8 additions & 0 deletions internal/cli/cmd/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ func (o *reportKubeblocksOptions) handleManifests(ctx context.Context) error {
resourceLists = append(resourceLists, cliutil.ListResourceByGVR(ctx, o.genericClientSet.dynamic, o.namespace, scopedgvrs, []metav1.ListOptions{o.kubeBlocksSelector}, &allErrors)...)
// get global resources
resourceLists = append(resourceLists, cliutil.ListResourceByGVR(ctx, o.genericClientSet.dynamic, metav1.NamespaceAll, globalGvrs, []metav1.ListOptions{o.kubeBlocksSelector}, &allErrors)...)
// get all storage class
resourceLists = append(resourceLists, cliutil.ListResourceByGVR(ctx, o.genericClientSet.dynamic, metav1.NamespaceAll, []schema.GroupVersionResource{types.StorageClassGVR()}, []metav1.ListOptions{{}}, &allErrors)...)
if err := o.reportWritter.WriteObjects(manifestsFolder, resourceLists, o.outputFormat); err != nil {
return err
}
Expand Down Expand Up @@ -492,8 +494,13 @@ func (o *reportClusterOptions) handleManifests(ctx context.Context) error {
types.BackupPolicyGVR(),
types.BackupToolGVR(),
types.RestoreJobGVR(),
types.PVCGVR(),
}
globalGvrs = []schema.GroupVersionResource{
types.PVGVR(),
}
)

var err error
if o.cluster, err = o.genericClientSet.kbClientSet.AppsV1alpha1().Clusters(o.namespace).Get(ctx, o.clusterName, metav1.GetOptions{}); err != nil {
return err
Expand All @@ -508,6 +515,7 @@ func (o *reportClusterOptions) handleManifests(ctx context.Context) error {
resourceLists := make([]*unstructured.UnstructuredList, 0)
// write manifest
resourceLists = append(resourceLists, cliutil.ListResourceByGVR(ctx, o.genericClientSet.dynamic, o.namespace, scopedgvrs, []metav1.ListOptions{o.clusterSelector}, &allErrors)...)
resourceLists = append(resourceLists, cliutil.ListResourceByGVR(ctx, o.genericClientSet.dynamic, metav1.NamespaceAll, globalGvrs, []metav1.ListOptions{o.clusterSelector}, &allErrors)...)
if err := o.reportWritter.WriteObjects("manifests", resourceLists, o.outputFormat); err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/plan/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package plan

import (
intctrlutil "github.com/apecloud/kubeblocks/internal/controllerutil"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

intctrlutil "github.com/apecloud/kubeblocks/internal/controllerutil"

appsv1alpha1 "github.com/apecloud/kubeblocks/apis/apps/v1alpha1"
"github.com/apecloud/kubeblocks/internal/controller/component"
"github.com/apecloud/kubeblocks/internal/controller/configuration"
Expand Down

0 comments on commit fb10233

Please sign in to comment.