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
38 changes: 9 additions & 29 deletions api/v1alpha1/branch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ type BranchSpec struct {

// BranchStatus defines the observed state of Branch.
type BranchStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty,omitzero"`
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

Phase string `json:"phase,omitempty"`
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

const (
BranchPhaseCreating = "Creating"
BranchPhaseReady = "Ready"
BranchPhaseCannotCreateResources = "CannotCreateResources"
BranchPhaseTimelineCreationFailed = "TimelineCreationFailed"
)

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=".status.conditions[?(@.type==\"Available\")].status"
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=".status.conditions[?(@.type==\"Progressing\")].status"
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp"

// Branch is the Schema for the branches API
type Branch struct {
Expand Down Expand Up @@ -79,26 +79,6 @@ type BranchList struct {
Items []Branch `json:"items"`
}

// GetConditions returns the conditions for the branch status
func (b *BranchStatus) GetConditions() []metav1.Condition {
return b.Conditions
}

// SetConditions sets the conditions for the branch status
func (b *BranchStatus) SetConditions(conditions []metav1.Condition) {
b.Conditions = conditions
}

// GetPhase returns the phase for the branch status
func (b *BranchStatus) GetPhase() string {
return b.Phase
}

// SetPhase sets the phase for the branch status
func (b *BranchStatus) SetPhase(phase string) {
b.Phase = phase
}

func init() {
SchemeBuilder.Register(&Branch{}, &BranchList{})
}
46 changes: 7 additions & 39 deletions api/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,20 @@ type ClusterSpec struct {

// ClusterStatus defines the observed state of Cluster.
type ClusterStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`

// +optional
StorageBrokerStatus StorageBrokerStatus `json:"storageBrokerStatus,omitzero"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// +optional
Phase string `json:"phase,omitempty"`

// +optional
PhaseReason string `json:"phaseReason,omitempty"`
}

const (
ClusterPhaseCreating = "Creating cluster"
ClusterPhaseReady = "Ready"
ClusterPhaseCannotCreateClusterResources = "Unable to create all necessary cluster resources"
)

// Represents the current state of the storage broker.
type StorageBrokerStatus struct {
// Total number of ready Storage Brokers instances in the cluster.
ReadyInstances int32 `json:"readyInstances"`
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=".status.conditions[?(@.type==\"Available\")].status"
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=".status.conditions[?(@.type==\"Progressing\")].status"
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp"

// Cluster is the Schema for the clusters API
type Cluster struct {
Expand Down Expand Up @@ -99,26 +87,6 @@ type ClusterList struct {
Items []Cluster `json:"items"`
}

// GetConditions returns the conditions for the cluster status
func (c *ClusterStatus) GetConditions() []metav1.Condition {
return c.Conditions
}

// SetConditions sets the conditions for the cluster status
func (c *ClusterStatus) SetConditions(conditions []metav1.Condition) {
c.Conditions = conditions
}

// GetPhase returns the phase for the cluster status
func (c *ClusterStatus) GetPhase() string {
return c.Phase
}

// SetPhase sets the phase for the cluster status
func (c *ClusterStatus) SetPhase(phase string) {
c.Phase = phase
}

func init() {
SchemeBuilder.Register(&Cluster{}, &ClusterList{})
}
39 changes: 9 additions & 30 deletions api/v1alpha1/pageserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,41 +39,20 @@ type PageserverSpec struct {

// PageserverStatus defines the observed state of Pageserver.
type PageserverStatus struct {
Conditions []metav1.Condition `json:"conditions"`

Phase string `json:"phase"`
PhaseReason string `json:"phaseReason,omitempty"`
}

// GetConditions returns the conditions for the pageserver status
func (b *PageserverStatus) GetConditions() []metav1.Condition {
return b.Conditions
}

// SetConditions sets the conditions for the pageserver status
func (b *PageserverStatus) SetConditions(conditions []metav1.Condition) {
b.Conditions = conditions
}

// GetPhase returns the phase for the pageserver status
func (b *PageserverStatus) GetPhase() string {
return b.Phase
}
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// SetPhase sets the phase for the pageserver status
func (b *PageserverStatus) SetPhase(phase string) {
b.Phase = phase
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

const (
PageserverPhaseCreating = "Creating pageserver"
PageserverPhaseReady = "Ready"
PageserverPhaseInvalidSpec = "Invalid spec"
PageserverPhaseCannotCreateResources = "Unable to create all necessary pageserver resources"
)

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=".status.conditions[?(@.type==\"Available\")].status"
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=".status.conditions[?(@.type==\"Progressing\")].status"
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp"

// Pageserver is the Schema for the pageservers API
type Pageserver struct {
Expand Down
39 changes: 9 additions & 30 deletions api/v1alpha1/project_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,20 @@ type ProjectSpec struct {

// ProjectStatus defines the observed state of Project.
type ProjectStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty,omitzero"`
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

Phase string `json:"phase,omitempty"`
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

const (
ProjectPhasePending = "Pending"
ProjectPhaseCreating = "Creating"
ProjectPhaseReady = "Ready"
ProjectPhaseTenantCreationFailed = "TenantCreationFailed"
ProjectPhasePageserverConnectionError = "PageserverConnectionError"
)

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=".status.conditions[?(@.type==\"Available\")].status"
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=".status.conditions[?(@.type==\"Progressing\")].status"
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp"

// Project is the Schema for the projects API
type Project struct {
Expand Down Expand Up @@ -79,26 +78,6 @@ type ProjectList struct {
Items []Project `json:"items"`
}

// GetConditions returns the conditions for the project status
func (p *ProjectStatus) GetConditions() []metav1.Condition {
return p.Conditions
}

// SetConditions sets the conditions for the project status
func (p *ProjectStatus) SetConditions(conditions []metav1.Condition) {
p.Conditions = conditions
}

// GetPhase returns the phase for the project status
func (p *ProjectStatus) GetPhase() string {
return p.Phase
}

// SetPhase sets the phase for the project status
func (p *ProjectStatus) SetPhase(phase string) {
p.Phase = phase
}

func init() {
SchemeBuilder.Register(&Project{}, &ProjectList{})
}
39 changes: 9 additions & 30 deletions api/v1alpha1/safekeeper_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,20 @@ type SafekeeperSpec struct {

// SafekeeperStatus defines the observed state of Safekeeper.
type SafekeeperStatus struct {
Conditions []metav1.Condition `json:"conditions"`
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

Phase string `json:"phase"`
PhaseReason string `json:"phaseReason,omitempty"`
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

const (
SafekeeperPhaseCreating = "Creating safekeeper"
SafekeeperPhaseReady = "Ready"
SafekeeperPhaseInvalidSpec = "Invalid spec"
SafekeeperPhaseCannotCreateResources = "Unable to create all necessary safekeeper resources"
)

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=".status.conditions[?(@.type==\"Available\")].status"
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=".status.conditions[?(@.type==\"Progressing\")].status"
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp"

// Safekeeper is the Schema for the safekeepers API
type Safekeeper struct {
Expand All @@ -78,26 +77,6 @@ type Safekeeper struct {
Status SafekeeperStatus `json:"status,omitzero"`
}

// GetConditions returns the conditions for the safekeeper status
func (b *SafekeeperStatus) GetConditions() []metav1.Condition {
return b.Conditions
}

// SetConditions sets the conditions for the safekeeper status
func (b *SafekeeperStatus) SetConditions(conditions []metav1.Condition) {
b.Conditions = conditions
}

// GetPhase returns the phase for the safekeeper status
func (b *SafekeeperStatus) GetPhase() string {
return b.Phase
}

// SetPhase sets the phase for the safekeeper status
func (b *SafekeeperStatus) SetPhase(phase string) {
b.Phase = phase
}

// +kubebuilder:object:root=true

// SafekeeperList contains a list of Safekeeper
Expand Down
51 changes: 51 additions & 0 deletions api/v1alpha1/status_funcs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

func (c *Cluster) StatusValue() any { return c.Status }
func (c *Cluster) StatusConditions() *[]metav1.Condition { return &c.Status.Conditions }
func (c *Cluster) SetObservedGeneration(g int64) { c.Status.ObservedGeneration = g }
func (c *Cluster) AssignStatusFrom(o client.Object) {
if other, ok := o.(*Cluster); ok {
c.Status = other.Status
}
}

func (p *Project) StatusValue() any { return p.Status }
func (p *Project) StatusConditions() *[]metav1.Condition { return &p.Status.Conditions }
func (p *Project) SetObservedGeneration(g int64) { p.Status.ObservedGeneration = g }
func (p *Project) AssignStatusFrom(o client.Object) {
if other, ok := o.(*Project); ok {
p.Status = other.Status
}
}

func (b *Branch) StatusValue() any { return b.Status }
func (b *Branch) StatusConditions() *[]metav1.Condition { return &b.Status.Conditions }
func (b *Branch) SetObservedGeneration(g int64) { b.Status.ObservedGeneration = g }
func (b *Branch) AssignStatusFrom(o client.Object) {
if other, ok := o.(*Branch); ok {
b.Status = other.Status
}
}

func (p *Pageserver) StatusValue() any { return p.Status }
func (p *Pageserver) StatusConditions() *[]metav1.Condition { return &p.Status.Conditions }
func (p *Pageserver) SetObservedGeneration(g int64) { p.Status.ObservedGeneration = g }
func (p *Pageserver) AssignStatusFrom(o client.Object) {
if other, ok := o.(*Pageserver); ok {
p.Status = other.Status
}
}

func (s *Safekeeper) StatusValue() any { return s.Status }
func (s *Safekeeper) StatusConditions() *[]metav1.Condition { return &s.Status.Conditions }
func (s *Safekeeper) SetObservedGeneration(g int64) { s.Status.ObservedGeneration = g }
func (s *Safekeeper) AssignStatusFrom(o client.Object) {
if other, ok := o.(*Safekeeper); ok {
s.Status = other.Status
}
}
16 changes: 0 additions & 16 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Loading
Loading