Skip to content

Commit

Permalink
Merge pull request #62 from nb-ohad/api-renames-and-rules
Browse files Browse the repository at this point in the history
API renames and validation rules
  • Loading branch information
Madhu-1 authored Jul 30, 2024
2 parents cd73054 + 69af8e6 commit 60794b7
Show file tree
Hide file tree
Showing 23 changed files with 336 additions and 235 deletions.
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"`

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

0 comments on commit 60794b7

Please sign in to comment.