Skip to content

Commit

Permalink
fix: chart prepare cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavan Sokke Nagaraj committed Aug 3, 2023
1 parent 4503c5b commit 4374ad0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cli/cmd/cluster_prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (r *runners) prepareCluster(_ *cobra.Command, args []string) error {
// to be pushed to the oci registry. this is a terrible hack working
// around that part. a pr is in progress to deliver this status

if len(release.ChartNames) == 0 {
if len(release.Charts) == 0 {
return errors.New("no charts found in release")
}

Expand All @@ -194,8 +194,8 @@ func (r *runners) prepareCluster(_ *cobra.Command, args []string) error {
// run preflights

// install the chart or application
for _, chartName := range release.ChartNames {
output, err := installChartRelease(a.Slug, release.Sequence, chartName, email, customer.InstallationID, kubeconfig, r.args.prepareClusterValuesPath, r.args.prepareClusterValueItems)
for _, chart := range release.Charts {
output, err := installChartRelease(a.Slug, release.Sequence, chart.Name, email, customer.InstallationID, kubeconfig, r.args.prepareClusterValuesPath, r.args.prepareClusterValueItems)
if err != nil {
return errors.Wrap(err, "install release")
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/kotsclient/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func (c *VendorV3Client) CreateRelease(appID string, multiyaml string) (*types.R
}

releaseInfo := types.ReleaseInfo{
AppID: response.Release.AppID,
Sequence: response.Release.Sequence,
ChartNames: response.Release.ChartNames,
AppID: response.Release.AppID,
Sequence: response.Release.Sequence,
Charts: response.Release.Charts,
}

return &releaseInfo, nil
Expand Down
21 changes: 19 additions & 2 deletions pkg/types/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ package types

import "time"

type ChartStatus string

var (
ChartStatusUnknown ChartStatus = "unknown"
ChartStatusPushing ChartStatus = "pushing"
ChartStatusPushed ChartStatus = "pushed"
ChartStatusError ChartStatus = "error"
)

type ReleaseInfo struct {
ActiveChannels []Channel
AppID string
Expand All @@ -10,7 +19,7 @@ type ReleaseInfo struct {
Editable bool
Sequence int64
Version string
ChartNames []string
Charts []Chart
}

type LintMessage struct {
Expand Down Expand Up @@ -70,7 +79,15 @@ type KotsAppRelease struct {
ReleaseNotes string `json:"releaseNotes"`
IsReleaseNotEditable bool `json:"isReleaseNotEditable"`
Channels []*Channel `json:"channels"`
ChartNames []string `json:"chartNames"`
Charts []Chart `json:"charts"`
}

type Chart struct {
Name string `json:"name"`
Version string `json:"version"`
Status ChartStatus `json:"status"`
Error string `json:"error,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
}

type EntitlementValue struct {
Expand Down

0 comments on commit 4374ad0

Please sign in to comment.