Skip to content

Commit

Permalink
cleaning some code, fixing unit test failures
Browse files Browse the repository at this point in the history
Signed-off-by: mszacillo <[email protected]>
  • Loading branch information
mszacillo committed Oct 23, 2024
1 parent a6627bf commit db2babb
Show file tree
Hide file tree
Showing 12 changed files with 309 additions and 162 deletions.
45 changes: 23 additions & 22 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -20026,29 +20026,34 @@
"description": "FailoverHistoryItem represents either a failover event in the history.",
"type": "object",
"required": [
"originCluster",
"fromCluster",
"reason",
"failoverTime",
"originalClusters"
"startTime",
"clustersBeforeFailover",
"clustersAfterFailover"
],
"properties": {
"failoverTime": {
"description": "StartTime is the timestamp of when the failover occurred.",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
},
"originCluster": {
"description": "OriginCluster is the name of the cluster from which the application migrated.",
"type": "string",
"default": ""
"clustersAfterFailover": {
"description": "ClustersAfterFailover records the clusters where the application is running after failover.",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.TargetCluster"
}
},
"originalClusters": {
"description": "ClustersBeforeFailover records the clusters where running the application before failover.",
"clustersBeforeFailover": {
"description": "ClustersBeforeFailover records the clusters where the application was running prior to failover.",
"type": "array",
"items": {
"type": "string",
"default": ""
"default": {},
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.TargetCluster"
}
},
"fromCluster": {
"description": "FromCluster which cluster the eviction perform from.",
"type": "string",
"default": ""
},
"preservedLabelState": {
"description": "PreservedLabelState represents the application state information collected from the original cluster, and it will be injected into the new cluster in the form of application labels.",
"type": "object",
Expand All @@ -20062,13 +20067,9 @@
"type": "string",
"default": ""
},
"targetClusters": {
"description": "ClustersAfterFailover records the clusters where running the application after failover.",
"type": "array",
"items": {
"type": "string",
"default": ""
}
"startTime": {
"description": "StartTime is the timestamp of when the failover occurred.",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1346,21 +1346,46 @@ spec:
description: FailoverHistoryItem represents either a failover event
in the history.
properties:
failoverTime:
description: StartTime is the timestamp of when the failover
occurred.
format: date-time
type: string
originCluster:
description: OriginCluster is the name of the cluster from which
the application migrated.
type: string
originalClusters:
clustersAfterFailover:
description: ClustersAfterFailover records the clusters where
the application is running after failover.
items:
description: TargetCluster represents the identifier of a
member cluster.
properties:
name:
description: Name of target cluster.
type: string
replicas:
description: Replicas in target cluster
format: int32
type: integer
required:
- name
type: object
type: array
clustersBeforeFailover:
description: ClustersBeforeFailover records the clusters where
running the application before failover.
the application was running prior to failover.
items:
type: string
description: TargetCluster represents the identifier of a
member cluster.
properties:
name:
description: Name of target cluster.
type: string
replicas:
description: Replicas in target cluster
format: int32
type: integer
required:
- name
type: object
type: array
fromCluster:
description: FromCluster which cluster the eviction perform
from.
type: string
preservedLabelState:
additionalProperties:
type: string
Expand All @@ -1371,17 +1396,17 @@ spec:
reason:
description: Reason denotes the type of failover.
type: string
targetClusters:
description: ClustersAfterFailover records the clusters where
running the application after failover.
items:
type: string
type: array
startTime:
description: StartTime is the timestamp of when the failover
occurred.
format: date-time
type: string
required:
- failoverTime
- originCluster
- originalClusters
- clustersAfterFailover
- clustersBeforeFailover
- fromCluster
- reason
- startTime
type: object
type: array
lastScheduledTime:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1346,21 +1346,46 @@ spec:
description: FailoverHistoryItem represents either a failover event
in the history.
properties:
failoverTime:
description: StartTime is the timestamp of when the failover
occurred.
format: date-time
type: string
originCluster:
description: OriginCluster is the name of the cluster from which
the application migrated.
type: string
originalClusters:
clustersAfterFailover:
description: ClustersAfterFailover records the clusters where
the application is running after failover.
items:
description: TargetCluster represents the identifier of a
member cluster.
properties:
name:
description: Name of target cluster.
type: string
replicas:
description: Replicas in target cluster
format: int32
type: integer
required:
- name
type: object
type: array
clustersBeforeFailover:
description: ClustersBeforeFailover records the clusters where
running the application before failover.
the application was running prior to failover.
items:
type: string
description: TargetCluster represents the identifier of a
member cluster.
properties:
name:
description: Name of target cluster.
type: string
replicas:
description: Replicas in target cluster
format: int32
type: integer
required:
- name
type: object
type: array
fromCluster:
description: FromCluster which cluster the eviction perform
from.
type: string
preservedLabelState:
additionalProperties:
type: string
Expand All @@ -1371,17 +1396,17 @@ spec:
reason:
description: Reason denotes the type of failover.
type: string
targetClusters:
description: ClustersAfterFailover records the clusters where
running the application after failover.
items:
type: string
type: array
startTime:
description: StartTime is the timestamp of when the failover
occurred.
format: date-time
type: string
required:
- failoverTime
- originCluster
- originalClusters
- clustersAfterFailover
- clustersBeforeFailover
- fromCluster
- reason
- startTime
type: object
type: array
lastScheduledTime:
Expand Down
18 changes: 9 additions & 9 deletions pkg/apis/work/v1alpha2/binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ type ResourceBindingStatus struct {
AggregatedStatus []AggregatedStatusItem `json:"aggregatedStatus,omitempty"`

// FailoverHistory represents the history of the failover of the resource
// + optional
// +optional
FailoverHistory []FailoverHistoryItem `json:"failoverHistory,omitempty"`
}

Expand Down Expand Up @@ -368,25 +368,25 @@ type AggregatedStatusItem struct {

// FailoverHistoryItem represents either a failover event in the history.
type FailoverHistoryItem struct {
// OriginCluster is the name of the cluster from which the application migrated.
// FromCluster which cluster the eviction perform from.
// +required
OriginCluster string `json:"originCluster"`
FromCluster string `json:"fromCluster"`

// Reason denotes the type of failover.
// +required
Reason FailoverReason `json:"reason"`

// StartTime is the timestamp of when the failover occurred.
// +required
StartTime metav1.Time `json:"failoverTime"`
StartTime metav1.Time `json:"startTime"`

// ClustersBeforeFailover records the clusters where running the application before failover.
// ClustersBeforeFailover records the clusters where the application was running prior to failover.
// +required
ClustersBeforeFailover []string `json:"originalClusters"`
ClustersBeforeFailover []TargetCluster `json:"clustersBeforeFailover"`

// ClustersAfterFailover records the clusters where running the application after failover.
// +optional
ClustersAfterFailover []string `json:"targetClusters,omitempty"`
// ClustersAfterFailover records the clusters where the application is running after failover.
// +required
ClustersAfterFailover []TargetCluster `json:"clustersAfterFailover"`

// PreservedLabelState represents the application state information collected from the original cluster,
// and it will be injected into the new cluster in the form of application labels.
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/work/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/controllers/binding/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func Test_mergeLabel(t *testing.T) {
},
},
},
binding: &workv1alpha2.ClusterResourceBinding{
binding: &workv1alpha2.ResourceBinding{
ObjectMeta: metav1.ObjectMeta{
Name: bindingName,
Namespace: namespace,
Expand Down
Loading

0 comments on commit db2babb

Please sign in to comment.