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

API renames and validation rules #62

Merged
merged 5 commits into from
Jul 30, 2024
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
4 changes: 2 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resources:
namespaced: true
domain: ceph.io
group: csi
kind: CephCluster
kind: CephConnection
controller: true
path: github.com/ceph/ceph-csi-operator/api/v1alpha1
version: v1alpha1
Expand All @@ -39,7 +39,7 @@ resources:
namespaced: true
domain: ceph.io
group: csi
kind: Config
kind: ClientProfile
path: github.com/ceph/ceph-csi-operator/api/v1alpha1
version: v1alpha1
version: "3"
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,50 @@ import (

// ReadAffinitySpec capture Ceph CSI read affinity settings
type ReadAffinitySpec struct {
//+kubebuilder:validation:Required
//+kubebuilder:validation:MinItems:=1
CrushLocationLabels []string `json:"crushLocationLabels,omitempty"`
}

// CephClusterSpec defines the desired state of CephCluster
type CephClusterSpec struct {
Monitors []string `json:"monitors"`
ReadAffinity ReadAffinitySpec `json:"readAffinity,omitempty"`
RbdMirrorDaemonCount int `json:"rbdMirrorDaemonCount,omitempty"`
// CephConnectionSpec defines the desired state of CephConnection
type CephConnectionSpec struct {
//+kubebuilder:validation:Required
//+kubebuilder:validation:MinItems:=1
Monitors []string `json:"monitors"`

//+kubebuilder:validation:Optional
ReadAffinity ReadAffinitySpec `json:"readAffinity,omitempty"`

//+kubebuilder:validation:Optional
//+kubebuilder:validation:Minimum:=1
RbdMirrorDaemonCount int `json:"rbdMirrorDaemonCount,omitempty"`
}

// CephClusterStatus defines the observed state of CephCluster
type CephClusterStatus struct {
// CephConnectionStatus defines the observed state of CephConnection
type CephConnectionStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// CephCluster is the Schema for the cephclusters API
type CephCluster struct {
// CephConnection is the Schema for the cephconnections API
type CephConnection struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
nb-ohad marked this conversation as resolved.
Show resolved Hide resolved

Spec CephClusterSpec `json:"spec,omitempty"`
Status CephClusterStatus `json:"status,omitempty"`
Spec CephConnectionSpec `json:"spec,omitempty"`
Status CephConnectionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// CephClusterList contains a list of CephCluster
type CephClusterList struct {
// CephConnectionList contains a list of CephConnections
type CephConnectionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CephCluster `json:"items"`
Items []CephConnection `json:"items"`
}

func init() {
SchemeBuilder.Register(&CephCluster{}, &CephClusterList{})
SchemeBuilder.Register(&CephConnection{}, &CephConnectionList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,64 @@ import (

// CephFsConfigSpec defines the desired CephFs configuration
type CephFsConfigSpec struct {
//+kubebuilder:validation:Optional
SubVolumeGroup string `json:"subVolumeGroup,omitempty"`
}

// RbdConfigSpec defines the desired RBD configuration
type RbdConfigSpec struct {
//+kubebuilder:validation:Optional
RadosNamespace string `json:"radosNamespace,omitempty"`
}

// NfsConfigSpec cdefines the desired NFS configuration
type NfsConfigSpec struct {
}

// ConfigSpec defines the desired state of Config
type ConfigSpec struct {
CephClusterRef corev1.LocalObjectReference `json:"cephClusterRef"`
CephFs *CephFsConfigSpec `json:"cephFs,omitempty"`
Rbd *RbdConfigSpec `json:"rbd,omitempty"`
Nfs *NfsConfigSpec `json:"nfs,omitempty"`
// ClientProfileSpec defines the desired state of Ceph CSI
// configuration for volumes and snapshots configured to use
// this profile
type ClientProfileSpec struct {
//+kubebuilder:validation:Required
CephConnectionRef corev1.LocalObjectReference `json:"cephConnectionRef"`

//+kubebuilder:validation:Optional
CephFs *CephFsConfigSpec `json:"cephFs,omitempty"`

//+kubebuilder:validation:Optional
Rbd *RbdConfigSpec `json:"rbd,omitempty"`

//+kubebuilder:validation:Optional
Nfs *NfsConfigSpec `json:"nfs,omitempty"`
}

// ConfigStatus defines the observed state of Config
type ConfigStatus struct {
// ClientProfileStatus defines the observed state of Ceph CSI
// configuration for volumes and snapshots configured to use
// this profile
type ClientProfileStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// Config is the Schema for the configs API
type Config struct {
// ClientProfile is the Schema for the clientprofiles API
type ClientProfile struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ConfigSpec `json:"spec,omitempty"`
Status ConfigStatus `json:"status,omitempty"`
Spec ClientProfileSpec `json:"spec,omitempty"`
Status ClientProfileStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ConfigList contains a list of Config
type ConfigList struct {
// ClientProfileList contains a list of ClientProfile
type ClientProfileList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Config `json:"items"`
Items []ClientProfile `json:"items"`
}

func init() {
SchemeBuilder.Register(&Config{}, &ConfigList{})
SchemeBuilder.Register(&ClientProfile{}, &ClientProfileList{})
}
Loading
Loading