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

Add listmap for list structs #102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
@@ -164,6 +164,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
registrations:
description: registrations is the conifigurations for the addon agent
to register to hub. It should be set by each addon controller on
6 changes: 3 additions & 3 deletions addon/v1alpha1/types_managedclusteraddon.go
Original file line number Diff line number Diff line change
@@ -78,10 +78,10 @@ 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
// +listMapKey:=type
// +listType:=map
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
Conditions []metav1.Condition `json:"conditions,omitempty"`

// relatedObjects is a list of objects that are "interesting" or related to this operator. Common uses are:
// 1. the detailed resource driving the operator
Original file line number Diff line number Diff line change
@@ -153,6 +153,9 @@ spec:
type: string
maxLength: 1024
minLength: 1
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
conditions:
description: Conditions contains the different condition statuses
for this managed cluster.
@@ -224,6 +227,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
version:
description: Version represents the kubernetes version of the managed
cluster.
4 changes: 4 additions & 0 deletions cluster/v1/types.go
Original file line number Diff line number Diff line change
@@ -84,6 +84,8 @@ type ClientConfig struct {
// ManagedClusterStatus represents the current status of joined managed cluster.
type ManagedClusterStatus struct {
// Conditions contains the different condition statuses for this managed cluster.
// +listMapKey:=type
// +listType:=map
Conditions []metav1.Condition `json:"conditions"`

// Capacity represents the total resource capacity from all nodeStatuses
@@ -101,6 +103,8 @@ type ManagedClusterStatus struct {
// (kubeversion.open-cluster-management.io). They are written from the managed
// cluster. The set of claims is not uniform across a fleet, some claims can be
// vendor or version specific and may not be included from all managed clusters.
// +listMapKey:=name
// +listType:=map
// +optional
ClusterClaims []ManagedClusterClaim `json:"clusterClaims,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -200,6 +200,7 @@ spec:
type: object
properties:
configurations:
description: Configurations deinfes a list of prioritizer configurations
type: array
items:
description: PrioritizerConfig represents the configuration
@@ -228,6 +229,9 @@ spec:
default: 1
maximum: 10
minimum: 0
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
mode:
description: Mode is either Exact, Additive, "" where "" is Additive
by default. In Additive mode, any prioritizer not explicitly
@@ -316,6 +320,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
numberOfSelectedClusters:
description: NumberOfSelectedClusters represents the number of selected
ManagedClusters
Original file line number Diff line number Diff line change
@@ -64,6 +64,9 @@ spec:
description: Reason represents the reason why the ManagedCluster
is selected.
type: string
x-kubernetes-list-map-keys:
- clusterName
x-kubernetes-list-type: map
served: true
storage: true
subresources:
7 changes: 7 additions & 0 deletions cluster/v1alpha1/types.go
Original file line number Diff line number Diff line change
@@ -286,7 +286,10 @@ type PrioritizerPolicy struct {
// +optional
Mode PrioritizerPolicyModeType `json:"mode,omitempty"`

// Configurations deinfes a list of prioritizer configurations
// +optional
// +listMapKey:=name
// +listType:=map
Configurations []PrioritizerConfig `json:"configurations,omitempty"`
}

@@ -327,6 +330,8 @@ type PlacementStatus struct {
NumberOfSelectedClusters int32 `json:"numberOfSelectedClusters"`

// Conditions contains the different condition statuses for this Placement.
// +listMapKey:=type
// +listType:=map
// +optional
Conditions []metav1.Condition `json:"conditions"`
}
@@ -386,6 +391,8 @@ type PlacementDecisionStatus struct {
// Decisions is a slice of decisions according to a placement
// The number of decisions should not be larger than 100
// +kubebuilder:validation:Required
// +listMapKey:=clusterName
// +listType:=map
// +required
Decisions []ClusterDecision `json:"decisions"`
}
5 changes: 3 additions & 2 deletions cluster/v1alpha1/zz_generated.swagger_doc_generated.go

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

Original file line number Diff line number Diff line change
@@ -243,6 +243,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
served: true
storage: true
subresources:
3 changes: 3 additions & 0 deletions cluster/v1beta1/types.go
Original file line number Diff line number Diff line change
@@ -43,6 +43,9 @@ type ManagedClusterSetSpec struct {
// ManagedClusterSetStatus represents the current status of the ManagedClusterSet.
type ManagedClusterSetStatus struct {
// Conditions contains the different condition statuses for this ManagedClusterSet.
// +listMapKey:=type
// +listType:=map
// +optional
Conditions []metav1.Condition `json:"conditions"`
}

Original file line number Diff line number Diff line change
@@ -212,6 +212,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
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.
Original file line number Diff line number Diff line change
@@ -186,6 +186,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
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.
Original file line number Diff line number Diff line change
@@ -209,6 +209,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
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.
4 changes: 4 additions & 0 deletions operator/v1/types.go
Original file line number Diff line number Diff line change
@@ -60,6 +60,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.
// +listMapKey:=type
// +listType:=map
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.
@@ -225,6 +227,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.
// +listMapKey:=type
// +listType:=map
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.
Original file line number Diff line number Diff line change
@@ -183,6 +183,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
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 managed cluster. The Klusterlet agent
@@ -283,6 +286,9 @@ spec:
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
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.
4 changes: 4 additions & 0 deletions work/v1/types.go
Original file line number Diff line number Diff line change
@@ -175,6 +175,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.
// +listMapKey:=type
// +listType:=map
Conditions []metav1.Condition `json:"conditions,omitempty"`

// ResourceStatus represents the status of each resource in manifestwork deployed on a
@@ -219,6 +221,8 @@ type ManifestCondition struct {
ResourceMeta ManifestResourceMeta `json:"resourceMeta"`

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