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

feat(crd): add missing listType #6108

Open
wants to merge 1 commit into
base: feature/v2
Choose a base branch
from
Open
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: 4 additions & 0 deletions api/core/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ type ClusterSpec struct {
// +kubebuilder:validation:Minimum=0
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`

// +listType=map
// +listMapKey=name
FeatureGates []meta.FeatureGate `json:"featureGates,omitempty"`
}

Expand Down Expand Up @@ -148,6 +150,8 @@ type ClusterStatus struct {
PD string `json:"pd,omitempty"`

// FeatureGates of this cluster
// +listType=map
// +listMapKey=name
FeatureGates []meta.FeatureGateStatus `json:"featureGates,omitempty"`
}

Expand Down
18 changes: 14 additions & 4 deletions api/core/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,22 @@ type Topology map[string]string
// Overlay defines some templates of k8s native resources.
// Users can specify this field to overlay the spec of managed resources(pod, pvcs, ...).
type Overlay struct {
Pod *PodOverlay `json:"pod,omitempty"`
PersistentVolumeClaims []PersistentVolumeClaimOverlay `json:"volumeClaims,omitempty"`
Pod *PodOverlay `json:"pod,omitempty"`
// +listType=map
// +listMapKey=name
Comment on lines +162 to +163
Copy link
Member

Choose a reason for hiding this comment

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

Why empty line here?

PersistentVolumeClaims []NamedPersistentVolumeClaimOverlay `json:"volumeClaims,omitempty"`
}

type PodOverlay struct {
ObjectMeta `json:"metadata,omitempty"`
Spec *corev1.PodSpec `json:"spec,omitempty"`
}

type NamedPersistentVolumeClaimOverlay struct {
Name string `json:"name"`
PersistentVolumeClaim PersistentVolumeClaimOverlay `json:"volumeClaim"`
}

type PersistentVolumeClaimOverlay struct {
ObjectMeta `json:"metadata,omitempty"`
Spec *corev1.PersistentVolumeClaimSpec `json:"spec,omitempty"`
Expand All @@ -179,10 +186,11 @@ type ConfigFile string
// For example, a volume can be mounted for both data and raft log.
type Volume struct {
// Name is volume name.
// If not specified, the PVC name will be "{component}-{podName}"
Name string `json:"name,omitempty"`
Name string `json:"name"`

// Mounts defines mount infos of this volume
// NOTE(liubo02): it cannot be a list map because the key is "type" or "mountPath" which is not supported
// +listType=atomic
Mounts []VolumeMount `json:"mounts"`

// Storage defines the request size of this volume
Expand Down Expand Up @@ -257,6 +265,8 @@ type ResourceRequirements struct {
// CommonStatus defines common status fields for instances and groups managed by TiDB Operator.
type CommonStatus struct {
// Conditions contain details of the current state.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`

// ObservedGeneration is the most recent generation observed by the controller.
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha1/pd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ type PDTemplateSpec struct {
// Config defines config file of PD
Config ConfigFile `json:"config"`
// Volumes defines persistent volumes of PD
// +listType=map
// +listMapKey=name
Volumes []Volume `json:"volumes"`
// Overlay defines a k8s native resource template patch
// All resources(pod, pvcs, ...) managed by PD can be overlayed by this field
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha1/ticdc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ type TiCDCTemplateSpec struct {

// Volumes defines persistent volumes of TiCDC, it is optional.
// If you want to use ephemeral storage or mount sink TLS certs, you can use "overlay" instead.
// +listType=map
// +listMapKey=name
Volumes []Volume `json:"volumes,omitempty"`
// Overlay defines a k8s native resource template patch
// All resources(pod, pvcs, ...) managed by TiCDC can be overlayed by this field
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha1/tidb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ type TiDBTemplateSpec struct {

Security *TiDBSecurity `json:"security,omitempty"`
// Volumes defines data volume of TiDB, it is optional.
// +listType=map
// +listMapKey=name
Volumes []Volume `json:"volumes,omitempty"`

// SlowLog defines the separate slow log configuration for TiDB.
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha1/tiflash_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ type TiFlashTemplateSpec struct {
ProxyConfig ConfigFile `json:"proxyConfig,omitempty"`

// Volumes defines data volume of TiFlash
// +listType=map
// +listMapKey=name
Volumes []Volume `json:"volumes"`

// LogTailer defines the sidercar log tailer config of TiFlash.
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha1/tikv_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ type TiKVTemplateSpec struct {
Config ConfigFile `json:"config"`
UpdateStrategy UpdateStrategy `json:"updateStrategy,omitempty"`
// Volumes defines data volume of TiKV
// +listType=map
// +listMapKey=name
Volumes []Volume `json:"volumes"`

// PreStop defines preStop config
Expand Down
6 changes: 6 additions & 0 deletions manifests/crd/core.pingcap.com_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ spec:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
paused:
description: Paused specifies whether to pause the reconciliation
loop for all components of the cluster.
Expand Down Expand Up @@ -238,6 +241,9 @@ spec:
- stage
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
id:
description: ID is the cluster id.
type: string
Expand Down
Loading
Loading