Skip to content

Commit

Permalink
add columns to plan crd
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Schuh authored and brandond committed Aug 1, 2022
1 parent bafe19a commit 8abd0dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
17 changes: 8 additions & 9 deletions hack/crdgen.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package main

import (
"os"

v1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1"
_ "github.com/rancher/system-upgrade-controller/pkg/generated/controllers/upgrade.cattle.io/v1"
"github.com/rancher/system-upgrade-controller/pkg/upgrade/plan"
"github.com/rancher/wrangler/pkg/crd"
"os"
)

func main() {
plan := crd.NamespacedType("Plan.upgrade.cattle.io/v1").
WithSchemaFromStruct(v1.Plan{}).
WithColumn("Image", ".spec.upgrade.image").
WithColumn("Channel", ".spec.channel").
WithColumn("Version", ".spec.version")
crd.Print(os.Stdout, []crd.CRD{plan})
planCrd, err := plan.CRD()
if err != nil {
print(err)
return
}
crd.Print(os.Stdout, []crd.CRD{*planCrd})
}
8 changes: 6 additions & 2 deletions pkg/upgrade/plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ func CRD() (*crd.CRD, error) {
if err != nil {
return nil, err
}
return &crd.CRD{
plan := crd.CRD{
GVK: prototype.GroupVersionKind(),
PluralName: upgradeapiv1.PlanResourceName,
Status: true,
Schema: schema,
Categories: []string{"upgrade"},
}, nil
}.
WithColumn("Image", ".spec.upgrade.image").
WithColumn("Channel", ".spec.channel").
WithColumn("Version", ".spec.version")
return &plan, nil
}

func DigestStatus(plan *upgradeapiv1.Plan, secretCache corectlv1.SecretCache) (upgradeapiv1.PlanStatus, error) {
Expand Down

0 comments on commit 8abd0dd

Please sign in to comment.