Skip to content

Commit

Permalink
feat: make cpu and memory resources requests configurable in operator (
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-nicolas authored Sep 21, 2023
1 parent a0ce047 commit b046c20
Show file tree
Hide file tree
Showing 32 changed files with 658 additions and 56 deletions.
4 changes: 3 additions & 1 deletion components/operator/apis/stack/v1beta3/auth_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ type AuthSpec struct {

// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}
12 changes: 12 additions & 0 deletions components/operator/apis/stack/v1beta3/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ type DevProperties struct {
Dev bool `json:"dev"`
}

type resource struct {
Cpu string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
}

type ResourceProperties struct {
// +optional
Request *resource `json:"request,omitempty"`
// +optional
Limits *resource `json:"limits,omitempty"`
}

type CommonServiceProperties struct {
DevProperties `json:",inline"`
// +optional
Expand Down
4 changes: 3 additions & 1 deletion components/operator/apis/stack/v1beta3/control_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ package v1beta3
type ControlSpec struct {
// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}
2 changes: 2 additions & 0 deletions components/operator/apis/stack/v1beta3/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package v1beta3

// +kubebuilder:object:generate=true
type GatewaySpec struct {
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
// +optional
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}
4 changes: 3 additions & 1 deletion components/operator/apis/stack/v1beta3/ledger_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ type LedgerSpec struct {
AllowPastTimestamps bool `json:"allowPastTimestamps"`
// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}

type ServiceSpec struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ type OrchestrationSpec struct {
Postgres PostgresConfig `json:"postgres"`
// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}
4 changes: 3 additions & 1 deletion components/operator/apis/stack/v1beta3/payments_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ type PaymentsSpec struct {

// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}
6 changes: 5 additions & 1 deletion components/operator/apis/stack/v1beta3/search_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ type SearchSpec struct {

// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
SearchResourceProperties *ResourceProperties `json:"searchResourceProperties,omitempty"`
// +optional
BenthosResourceProperties *ResourceProperties `json:"benthosResourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}

const DefaultESIndex = "stacks"
4 changes: 3 additions & 1 deletion components/operator/apis/stack/v1beta3/stargate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ package v1beta3
type StargateSpec struct {
// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}
4 changes: 3 additions & 1 deletion components/operator/apis/stack/v1beta3/wallets_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ package v1beta3
type WalletsSpec struct {
// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}
4 changes: 3 additions & 1 deletion components/operator/apis/stack/v1beta3/webhooks_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ type WebhooksSpec struct {
Postgres PostgresConfig `json:"postgres"`
// +optional
DevProperties `json:",inline"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
// +optional
ResourceProperties *ResourceProperties `json:"resourceProperties,omitempty"`
Annotations AnnotationsServicesSpec `json:"annotations,omitempty"`
}
80 changes: 80 additions & 0 deletions components/operator/apis/stack/v1beta3/zz_generated.deepcopy.go

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

Loading

1 comment on commit b046c20

@vercel
Copy link

@vercel vercel bot commented on b046c20 Sep 21, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.