Merge pull request #7221 from blackpiglet/schedule_cli_fix

Fix shedule get and describe CLI nil pointer issue
pull/7225/head
Xun Jiang/Bruce Jiang 2023-12-18 20:44:03 +08:00 committed by GitHub
commit ee879fdcc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -41,9 +41,8 @@ func NewDescribeCommand(f client.Factory, use string) *cobra.Command {
crClient, err := f.KubebuilderClient()
cmd.CheckError(err)
var schedules *v1.ScheduleList
schedules := new(v1.ScheduleList)
if len(args) > 0 {
schedules = new(v1.ScheduleList)
for _, name := range args {
schedule := new(v1.Schedule)
err := crClient.Get(context.TODO(), ctrlclient.ObjectKey{Namespace: f.Namespace(), Name: name}, schedule)

View File

@ -43,9 +43,8 @@ func NewGetCommand(f client.Factory, use string) *cobra.Command {
crClient, err := f.KubebuilderClient()
cmd.CheckError(err)
var schedules *api.ScheduleList
schedules := new(api.ScheduleList)
if len(args) > 0 {
schedules = new(api.ScheduleList)
for _, name := range args {
schedule := new(api.Schedule)
err := crClient.Get(context.TODO(), ctrlclient.ObjectKey{Name: name, Namespace: f.Namespace()}, schedule)