Skip to content

Commit

Permalink
Rename NotApplied to WaitApplied
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Sep 4, 2020
1 parent 18bcbc1 commit a583814
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 32 deletions.
10 changes: 5 additions & 5 deletions charts/fleet-crd/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ spec:
type: object
nullable: true
type: array
notApplied:
waitApplied:
type: integer
notReady:
type: integer
Expand Down Expand Up @@ -459,7 +459,7 @@ spec:
type: object
nullable: true
type: array
notApplied:
waitApplied:
type: integer
notReady:
type: integer
Expand Down Expand Up @@ -938,7 +938,7 @@ spec:
type: object
nullable: true
type: array
notApplied:
waitApplied:
type: integer
notReady:
type: integer
Expand Down Expand Up @@ -1095,7 +1095,7 @@ spec:
type: object
nullable: true
type: array
notApplied:
waitApplied:
type: integer
notReady:
type: integer
Expand Down Expand Up @@ -1341,7 +1341,7 @@ spec:
type: object
nullable: true
type: array
notApplied:
waitApplied:
type: integer
notReady:
type: integer
Expand Down
2 changes: 1 addition & 1 deletion docs/bundles.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace: default

# When resources are applied the system will wait for the resources to initially
# become Ready. If the resources are not ready in this time frame the
# application of resources fails and the bundle will stay in a NotApplied state.
# application of resources fails and the bundle will stay in a WaitApplied state.
# Default: 600 (10 minutes)
timeoutSeconds: 600

Expand Down
31 changes: 16 additions & 15 deletions pkg/apis/fleet.cattle.io/v1alpha1/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ import (
)

var (
Ready BundleState = "Ready"
NotReady BundleState = "NotReady"
NotApplied BundleState = "NotApplied"
ErrApplied BundleState = "ErrApplied"
OutOfSync BundleState = "OutOfSync"
Pending BundleState = "Pending"
Modified BundleState = "Modified"
Ready BundleState = "Ready"
NotReady BundleState = "NotReady"
WaitApplied BundleState = "WaitApplied"
ErrApplied BundleState = "ErrApplied"
OutOfSync BundleState = "OutOfSync"
Pending BundleState = "Pending"
Modified BundleState = "Modified"

StateRank = map[BundleState]int{
ErrApplied: 7,
NotApplied: 6,
Modified: 5,
OutOfSync: 4,
Pending: 3,
NotReady: 2,
Ready: 1,
ErrApplied: 7,
WaitApplied: 6,
Modified: 5,
OutOfSync: 4,
Pending: 3,
NotReady: 2,
Ready: 1,
}
)

Expand Down Expand Up @@ -113,7 +113,7 @@ type BundleTarget struct {

type BundleSummary struct {
NotReady int `json:"notReady,omitempty"`
NotApplied int `json:"notApplied,omitempty"`
WaitApplied int `json:"waitApplied,omitempty"`
ErrApplied int `json:"errApplied,omitempty"`
OutOfSync int `json:"outOfSync,omitempty"`
Modified int `json:"modified,omitempty"`
Expand Down Expand Up @@ -180,6 +180,7 @@ type BundleDeploymentOptions struct {
Values *GenericMap `json:"values,omitempty"`
ServiceAccount string `json:"serviceAccount,omitempty"`
Force bool `json:"force,omitempty"`
TakeOwnership bool `json:"takeOwnership,omitempty"`
}

type BundleDeploymentSpec struct {
Expand Down
26 changes: 15 additions & 11 deletions pkg/summary/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func IncrementState(summary *fleet.BundleSummary, name string, state fleet.Bundl
summary.Modified++
case fleet.Pending:
summary.Pending++
case fleet.NotApplied:
summary.NotApplied++
case fleet.WaitApplied:
summary.WaitApplied++
case fleet.ErrApplied:
summary.ErrApplied++
case fleet.NotReady:
Expand All @@ -46,7 +46,7 @@ func IsReady(summary fleet.BundleSummary) bool {

func Increment(left *fleet.BundleSummary, right fleet.BundleSummary) {
left.NotReady += right.NotReady
left.NotApplied += right.NotApplied
left.WaitApplied += right.WaitApplied
left.ErrApplied += right.ErrApplied
left.OutOfSync += right.OutOfSync
left.Modified += right.Modified
Expand All @@ -64,7 +64,7 @@ func GetDeploymentState(bundleDeployment *fleet.BundleDeployment) fleet.BundleSt
if condition.Cond(fleet.BundleDeploymentConditionDeployed).IsFalse(bundleDeployment) {
return fleet.ErrApplied
}
return fleet.NotApplied
return fleet.WaitApplied
case !bundleDeployment.Status.Ready:
return fleet.NotReady
case bundleDeployment.Spec.DeploymentID != bundleDeployment.Spec.StagedDeploymentID:
Expand Down Expand Up @@ -109,20 +109,24 @@ func MessageFromDeployment(deployment *fleet.BundleDeployment) string {
func ReadyMessage(summary fleet.BundleSummary, referencedKind string) string {
var messages []string
for msg, count := range map[fleet.BundleState]int{
fleet.OutOfSync: summary.OutOfSync,
fleet.NotReady: summary.NotReady,
fleet.NotApplied: summary.NotApplied,
fleet.ErrApplied: summary.ErrApplied,
fleet.Pending: summary.Pending,
fleet.Modified: summary.Modified,
fleet.OutOfSync: summary.OutOfSync,
fleet.NotReady: summary.NotReady,
fleet.WaitApplied: summary.WaitApplied,
fleet.ErrApplied: summary.ErrApplied,
fleet.Pending: summary.Pending,
fleet.Modified: summary.Modified,
} {
if count <= 0 {
continue
}
for _, v := range summary.NonReadyResources {
name := v.Name
if v.State == msg {
messages = append(messages, fmt.Sprintf("%s(%d) [%s %s: %s]", msg, count, referencedKind, name, v.Message))
if len(v.Message) == 0 {
messages = append(messages, fmt.Sprintf("%s(%d) [%s %s]", msg, count, referencedKind, name))
} else {
messages = append(messages, fmt.Sprintf("%s(%d) [%s %s: %s]", msg, count, referencedKind, name, v.Message))
}
break
}
}
Expand Down

0 comments on commit a583814

Please sign in to comment.