Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: configReferences is a list of current add-on configuration
references.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: |-
configReferences is a list of current add-on configuration references.
Expand Down
4 changes: 2 additions & 2 deletions addon/v1alpha1/types_clustermanagementaddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ type InstallProgression struct {
ConfigReferences []InstallConfigReference `json:"configReferences,omitempty"`

// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}
Expand Down
4 changes: 2 additions & 2 deletions addon/v1alpha1/types_managedclusteraddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ type Subject struct {
// +k8s:deepcopy-gen=true
type ManagedClusterAddOnStatus struct {
// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
Comment on lines +104 to 107
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove deprecated struct tag markers.

The struct field still contains the deprecated patchStrategy:"merge" and patchMergeKey:"type" in the struct tag. Since you've added the new kubebuilder markers (+listType=map and +listMapKey=type), the old struct tag markers should be removed for consistency.

🔎 Proposed fix
 // conditions describe the state of the managed and monitored components for the operator.
 // +listType=map
 // +listMapKey=type
 // +optional
-Conditions []metav1.Condition `json:"conditions,omitempty"  patchStrategy:"merge" patchMergeKey:"type"`
+Conditions []metav1.Condition `json:"conditions,omitempty"`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
🤖 Prompt for AI Agents
In @addon/v1alpha1/types_managedclusteraddon.go around lines 104-107, The
Conditions field still includes deprecated struct tags patchStrategy:"merge" and
patchMergeKey:"type"; remove those two tags from the Conditions field tag so it
only keeps json:"conditions,omitempty" (and any other non-deprecated tags),
while leaving the kubebuilder markers (+listType=map and +listMapKey=type) above
the field intact; update the struct field declaration for Conditions in
types_managedclusteraddon.go accordingly.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: configReferences is a list of current add-on configuration
references.
Expand Down Expand Up @@ -1098,6 +1101,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: configReferences is a list of current add-on configuration
references.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: |-
configReferences is a list of current add-on configuration references.
Expand Down Expand Up @@ -545,6 +548,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: |-
configReferences is a list of current add-on configuration references.
Expand Down
4 changes: 2 additions & 2 deletions addon/v1beta1/types_clustermanagementaddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ type InstallProgression struct {
ConfigReferences []InstallConfigReference `json:"configReferences,omitempty"`

// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
Comment on lines +175 to 178
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for other Conditions fields in the codebase to check the pattern
rg -n -A1 -B1 'Conditions\s+\[\]metav1\.Condition' --type=go

Repository: open-cluster-management-io/api

Length of output: 3360


Remove old struct tags now that new markers are in place.

The new markers +listType=map and +listMapKey=type have been added, but the old struct tags patchStrategy:"merge" patchMergeKey:"type" remain. This file is the only one in the codebase mixing both approaches. The rest of the codebase uses only the new markers (e.g., work/v1, operator/v1, cluster/v1) or only the old tags (other addon files not yet migrated). Remove the old struct tags to align with the modern Kubernetes API conventions and complete the migration to the new markers.

🤖 Prompt for AI Agents
In @addon/v1beta1/types_clustermanagementaddon.go around lines 175-178, The
Conditions field on the Clustermanagementaddon type still has legacy struct
tags; remove the old patchStrategy:"merge" and patchMergeKey:"type" tags from
the Conditions []metav1.Condition `json:"conditions,omitempty" 
patchStrategy:"merge" patchMergeKey:"type"` declaration so only the new markers
(+listType=map and +listMapKey=type) and the json tag remain; update the
Conditions field signature to use `json:"conditions,omitempty"` (keeping the
existing markers above the field) to complete the migration.

}
Expand Down
4 changes: 2 additions & 2 deletions addon/v1beta1/types_managedclusteraddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ type Subject struct {
// +k8s:deepcopy-gen=true
type ManagedClusterAddOnStatus struct {
// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
managedNamespaces:
description: |-
managedNamespaces are a list of namespaces managed by the clustersets the
Expand Down Expand Up @@ -330,6 +333,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
name:
description: name is the name of the namespace.
maxLength: 63
Expand Down
4 changes: 4 additions & 0 deletions cluster/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ const (
// ManagedClusterStatus represents the current status of joined managed cluster.
type ManagedClusterStatus struct {
// conditions contains the different condition statuses for this managed cluster.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions"`

// capacity represents the total resource capacity from all nodeStatuses
Expand Down Expand Up @@ -214,6 +216,8 @@ type ClusterSetManagedNamespaceConfig struct {
ClusterSet string `json:"clusterSet"`

// conditions are the status conditions of the managed namespace
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

Expand Down
2 changes: 0 additions & 2 deletions cluster/v1alpha1/types_addonplacementscore.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ type AddOnPlacementScore struct {
// AddOnPlacementScoreStatus represents the current status of AddOnPlacementScore.
type AddOnPlacementScoreStatus struct {
// Conditions contain the different condition statuses for this AddOnPlacementScore.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
decisionGroups:
description: List of decision groups determined by the placement and
DecisionStrategy.
Expand Down
2 changes: 2 additions & 0 deletions cluster/v1beta1/types_placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ type PlacementStatus struct {
DecisionGroups []DecisionGroupStatus `json:"decisionGroups"`

// Conditions contains the different condition status for this Placement.
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.
Expand Down
2 changes: 2 additions & 0 deletions operator/v1/types_clustermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ type ClusterManagerStatus struct {
// Progressing: Components in hub are in a transitioning state.
// Degraded: Components in hub do not match the desired configuration and only provide
// degraded service.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions"`

// Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction.
Expand Down
2 changes: 2 additions & 0 deletions operator/v1/types_klusterlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ type KlusterletStatus struct {
// Progressing: Components in the managed cluster are in a transitioning state.
// Degraded: Components in the managed cluster do not match the desired configuration and only provide
// degraded service.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions"`

// Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
resourceStatus:
description: |-
ResourceStatus represents the status of each resource in manifestwork deployed on a
Expand Down Expand Up @@ -532,6 +535,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
resourceMeta:
description: ResourceMeta represents the group, version,
kind, name and namespace of a resoure.
Expand Down
4 changes: 4 additions & 0 deletions work/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ type ManifestWorkStatus struct {
// 3. Available represents workload in ManifestWork exists on the managed cluster.
// 4. Degraded represents the current state of workload does not match the desired
// state for a certain period.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`

// ResourceStatus represents the status of each resource in manifestwork deployed on a
Expand Down Expand Up @@ -538,6 +540,8 @@ type ManifestCondition struct {

// Conditions represents the conditions of this resource on a managed cluster.
// +required
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
placementSummary:
description: PlacementRef Summary
items:
Expand Down
2 changes: 2 additions & 0 deletions work/v1alpha1/types_manifestworkreplicaset.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ type ManifestWorkReplicaSetStatus struct {
// Valid condition types are:
// 1. AppliedManifestWorks represents ManifestWorks have been distributed as per placement All, Partial, None, Problem
// 2. PlacementRefValid
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`

// Summary totals of resulting ManifestWorks for all placements
Expand Down