Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(crds)!: consistently use message field instead of error field #1542

Merged
merged 5 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/v1alpha1/stage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,9 @@ type StageStatus struct {
History FreightReferenceStack `json:"history,omitempty"`
// Health is the Stage's last observed health.
Health *Health `json:"health,omitempty"`
// Error describes any errors that are preventing the Stage controller
// Message describes any errors that are preventing the Stage controller
// from assessing Stage health or from finding new Freight.
Error string `json:"error,omitempty"`
Message string `json:"message,omitempty"`
// ObservedGeneration represents the .metadata.generation that this Stage
// status was reconciled against.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ message FreightReference {
message StageStatus {
optional FreightReference current_freight = 2 [json_name = "currentFreight"];
repeated FreightReference history = 3 [json_name = "history"];
string error = 4 [json_name = "error"];
string message = 4 [json_name = "message"];
optional Health health = 5 [json_name = "health"];
optional PromotionInfo current_promotion = 6 [json_name = "currentPromotion"];
string phase = 7 [json_name = "phase"];
Expand Down Expand Up @@ -296,7 +296,7 @@ message WarehouseSpec {
}

message WarehouseStatus {
string error = 1 [json_name = "error"];
string message = 1 [json_name = "message"];
int64 observed_generation = 2 [json_name = "observedGeneration"];
}

Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/warehouse_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ type ChartSubscription struct {

// WarehouseStatus describes a Warehouse's most recently observed state.
type WarehouseStatus struct {
// Error describes any errors that are preventing the Warehouse controller
// Message describes any errors that are preventing the Warehouse controller
// from polling repositories to discover new Freight.
Error string `json:"error,omitempty"`
Message string `json:"message,omitempty"`
// ObservedGeneration represents the .metadata.generation that this Warehouse
// was reconciled against.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
Expand Down
10 changes: 5 additions & 5 deletions charts/kargo/crds/kargo.akuity.io_stages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -844,11 +844,6 @@ spec:
- freight
- name
type: object
error:
description: |-
Error describes any errors that are preventing the Stage controller
from assessing Stage health or from finding new Freight.
type: string
health:
description: Health is the Stage's last observed health.
properties:
Expand Down Expand Up @@ -1056,6 +1051,11 @@ spec:
type: object
type: object
type: array
message:
description: |-
Message describes any errors that are preventing the Stage controller
from assessing Stage health or from finding new Freight.
type: string
observedGeneration:
description: |-
ObservedGeneration represents the .metadata.generation that this Stage
Expand Down
4 changes: 2 additions & 2 deletions charts/kargo/crds/kargo.akuity.io_warehouses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ spec:
status:
description: Status describes the Warehouse's most recently observed state.
properties:
error:
message:
description: |-
Error describes any errors that are preventing the Warehouse controller
Message describes any errors that are preventing the Warehouse controller
from polling repositories to discover new Freight.
type: string
observedGeneration:
Expand Down
6 changes: 3 additions & 3 deletions internal/api/types/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
CurrentFreight: FromFreightReferenceProto(s.GetCurrentFreight()),
History: history,
Health: FromHealthProto(s.GetHealth()),
Error: s.GetError(),
Message: s.GetMessage(),

Check warning on line 93 in internal/api/types/v1alpha1/types.go

View check run for this annotation

Codecov / codecov/patch

internal/api/types/v1alpha1/types.go#L93

Added line #L93 was not covered by tests
}
}

Expand Down Expand Up @@ -760,7 +760,7 @@
CurrentPromotion: currentPromotion,
History: history,
Health: health,
Error: e.Status.Error,
Message: e.Status.Message,
},
}
}
Expand Down Expand Up @@ -1082,7 +1082,7 @@
var status *v1alpha1.WarehouseStatus
if w.GetStatus() != nil {
status = &v1alpha1.WarehouseStatus{
Error: w.GetStatus().Error,
Message: w.GetStatus().Message,

Check warning on line 1085 in internal/api/types/v1alpha1/types.go

View check run for this annotation

Codecov / codecov/patch

internal/api/types/v1alpha1/types.go#L1085

Added line #L1085 was not covered by tests
ObservedGeneration: w.GetStatus().ObservedGeneration,
}
}
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/stages/stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@
newStatus, err = r.syncNormalStage(ctx, stage)
}
if err != nil {
newStatus.Error = err.Error()
logger.Errorf("error syncing Stage: %s", stage.Status.Error)
newStatus.Message = err.Error()
logger.Errorf("error syncing Stage: %s", stage.Status.Message)

Check warning on line 525 in internal/controller/stages/stages.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/stages/stages.go#L524-L525

Added lines #L524 - L525 were not covered by tests
} else {
// Be sure to blank this out in case there's an error in this field from
// the previous reconciliation
newStatus.Error = ""
newStatus.Message = ""

Check warning on line 529 in internal/controller/stages/stages.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/stages/stages.go#L529

Added line #L529 was not covered by tests
}

updateErr := kubeclient.PatchStatus(ctx, r.kargoClient, stage, func(status *kargoapi.StageStatus) {
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/warehouses/warehouses.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@

newStatus, err := r.syncWarehouse(ctx, warehouse)
if err != nil {
newStatus.Error = err.Error()
newStatus.Message = err.Error()

Check warning on line 194 in internal/controller/warehouses/warehouses.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/warehouses/warehouses.go#L194

Added line #L194 was not covered by tests
logger.Errorf("error syncing Warehouse: %s", err)
}

Expand Down Expand Up @@ -236,7 +236,7 @@
) (kargoapi.WarehouseStatus, error) {
status := *warehouse.Status.DeepCopy()
status.ObservedGeneration = warehouse.Generation
status.Error = "" // Clear any previous error
status.Message = "" // Clear any previous error

logger := logging.LoggerFromContext(ctx)

Expand Down
Loading
Loading