Skip to content

Commit

Permalink
Fix: run make update fail because deepcopy doesn't support generic …
Browse files Browse the repository at this point in the history
…type. (#288)

Signed-off-by: xuezhaojun <[email protected]>
  • Loading branch information
xuezhaojun authored Oct 18, 2023
1 parent c2e638b commit ae208c8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
1 change: 0 additions & 1 deletion cluster/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=open-cluster-management.io/api/cluster
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
Expand Down
2 changes: 2 additions & 0 deletions cluster/v1alpha1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
)

// ClusterRolloutStatus holds the rollout status information for a cluster.
// +k8s:deepcopy-gen=true
type ClusterRolloutStatus struct {
// cluster name
ClusterName string
Expand All @@ -53,6 +54,7 @@ type ClusterRolloutStatus struct {
}

// RolloutResult contains list of clusters that are timeOut, removed and required to rollOut
// +k8s:deepcopy-gen=true
type RolloutResult struct {
// ClustersToRollout is a slice of ClusterRolloutStatus that will be rolled out.
ClustersToRollout []ClusterRolloutStatus
Expand Down
3 changes: 3 additions & 0 deletions cluster/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen=true
// +kubebuilder:resource:scope="Cluster"

// ClusterClaim represents cluster information that a managed cluster claims
Expand All @@ -25,6 +26,7 @@ type ClusterClaim struct {
Spec ClusterClaimSpec `json:"spec,omitempty"`
}

// +k8s:deepcopy-gen=true
type ClusterClaimSpec struct {
// Value is a claim-dependent string
// +kubebuilder:validation:MaxLength=1024
Expand All @@ -33,6 +35,7 @@ type ClusterClaimSpec struct {
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen=true

// ClusterClaimList is a collection of ClusterClaim.
type ClusterClaimList struct {
Expand Down
4 changes: 4 additions & 0 deletions cluster/v1alpha1/types_addonplacementscore.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen=true
// +kubebuilder:resource:scope="Namespaced"
// +kubebuilder:subresource:status

Expand All @@ -21,6 +22,7 @@ type AddOnPlacementScore struct {
}

// AddOnPlacementScoreStatus represents the current status of AddOnPlacementScore.
// +k8s:deepcopy-gen=true
type AddOnPlacementScoreStatus struct {
// Conditions contain the different condition statuses for this AddOnPlacementScore.
// +patchMergeKey=type
Expand All @@ -46,6 +48,7 @@ type AddOnPlacementScoreStatus struct {
}

// AddOnPlacementScoreItem represents the score name and value.
// +k8s:deepcopy-gen=true
type AddOnPlacementScoreItem struct {
// Name is the name of the score
// +kubebuilder:validation:Required
Expand All @@ -61,6 +64,7 @@ type AddOnPlacementScoreItem struct {
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen=true

// AddOnPlacementScoreList is a collection of AddOnPlacementScore.
type AddOnPlacementScoreList struct {
Expand Down
7 changes: 7 additions & 0 deletions cluster/v1alpha1/types_rolloutstrategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
)

// Rollout strategy to apply workload to the selected clusters by Placement and DecisionStrategy.
// +k8s:deepcopy-gen=true
type RolloutStrategy struct {
// Rollout strategy Types are All, Progressive and ProgressivePerGroup
// 1) All means apply the workload to all clusters in the decision groups at once.
Expand All @@ -42,6 +43,7 @@ type RolloutStrategy struct {
}

// Timeout to consider while applying the workload.
// +k8s:deepcopy-gen=true
type Timeout struct {
// Timeout define how long workload applier controller will wait till workload reach successful state in the cluster.
// Timeout default value is None meaning the workload applier will not proceed apply workload to other clusters if did not reach the successful state.
Expand All @@ -54,6 +56,7 @@ type Timeout struct {

// MandatoryDecisionGroup set the decision group name or group index.
// GroupName is considered first to select the decisionGroups then GroupIndex.
// +k8s:deepcopy-gen=true
type MandatoryDecisionGroup struct {
// GroupName of the decision group should match the placementDecisions label value with label key cluster.open-cluster-management.io/decision-group-name
// +optional
Expand All @@ -65,6 +68,7 @@ type MandatoryDecisionGroup struct {
}

// MandatoryDecisionGroups
// +k8s:deepcopy-gen=true
type MandatoryDecisionGroups struct {
// List of the decision groups names or indexes to apply the workload first and fail if workload did not reach successful state.
// GroupName or GroupIndex must match with the decisionGroups defined in the placement's decisionStrategy
Expand All @@ -73,12 +77,14 @@ type MandatoryDecisionGroups struct {
}

// RolloutAll is a RolloutStrategy Type
// +k8s:deepcopy-gen=true
type RolloutAll struct {
// +optional
Timeout `json:",inline"`
}

// RolloutProgressivePerGroup is a RolloutStrategy Type
// +k8s:deepcopy-gen=true
type RolloutProgressivePerGroup struct {
// +optional
MandatoryDecisionGroups `json:",inline"`
Expand All @@ -88,6 +94,7 @@ type RolloutProgressivePerGroup struct {
}

// RolloutProgressive is a RolloutStrategy Type
// +k8s:deepcopy-gen=true
type RolloutProgressive struct {
// +optional
MandatoryDecisionGroups `json:",inline"`
Expand Down
15 changes: 11 additions & 4 deletions cluster/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit ae208c8

Please sign in to comment.