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
3 changes: 3 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ resources:
- group: database
kind: Postgres
version: v1
- group: database
kind: PostgresProfile
version: v1
version: "2"
10 changes: 0 additions & 10 deletions api/v1/postgres_profile.go

This file was deleted.

37 changes: 29 additions & 8 deletions api/v1/postgres_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ type AccessList struct {

// Backup configure parametes of the database backup
type Backup struct {
// Retention defines how many backups will reside.
// FIXME check zalando CRD for other options, e.g. Days
// Retention defines how many days a backup will persist
Retention int32 `json:"retention,omitempty"`

// Schedule defines how often a backup should be made, in cron format
Schedule string `json:"schedule,omitempty"`
}

// Size defines the size aspects of the database
Expand All @@ -87,13 +89,32 @@ type Size struct {
StorageSize string `json:"storage_size,omitempty"`
}

// Maintenance configures automatic database maintenance
// Weekday defines a weekday or everyday
type Weekday int

const (
Sun Weekday = iota
Mon
Tue
Wed
Thu
Fri
Sat
All
)

// TimeWindow defines an interval in time
type TimeWindow struct {
Start metav1.Time `json:"start,omitempty"`
End metav1.Time `json:"end,omitempty"`
}

// Maintenance configures database maintenance
type Maintenance struct {
// Auto if set to true database maintenance is done by the operator
Auto bool `json:"auto,omitempty"`
// Window defines the time window where the maintenance will happen if Auto is set to true
// FIXME format
TimeWindow string `json:"time_window,omitempty"`
// Weekday defines when the operator is allowed to do maintenance
Weekday Weekday `json:"weekday,omitempty"`
// TimeWindow defines when the maintenance should happen
TimeWindow TimeWindow `json:"time_window,omitempty"`
}

// PostgresStatus defines the observed state of Postgres
Expand Down
78 changes: 78 additions & 0 deletions api/v1/postgresprofile_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// +kubebuilder:object:root=true

// PostgresProfile is the Schema for the postgresprofiles API
type PostgresProfile struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec PostgresProfileSpec `json:"spec,omitempty"`
Status PostgresProfileStatus `json:"status,omitempty"`
}

// PostgresProfileSpec defines the desired state of PostgresProfile
type PostgresProfileSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

NumberOfInstances []int `json:"number_of_instances,omitempty"`
Operators []Operator `json:"operators,omitempty"`
Sizes []Size `json:"sizes,omitempty"`
Versions []string `json:"versions,omitempty"`

DefaultBackup Backup `json:"default_backup,omitempty"`
DefaultMaintenance Maintenance `json:"default_maintenance,omitempty"`
DefaultNumberOfInstances int `json:"default_number_of_instances,omitempty"`
DefaultOperator Operator `json:"default_operator,omitempty"`
DefaultSize Size `json:"default_size,omitempty"`
DefaultVersion string `json:"default_version,omitempty"`
}

// Operator defines which provider of the operator should be used and its version
type Operator struct {
Provider string `json:"provider,omitempty"`
Version []string `json:"version,omitempty"`
}

// PostgresProfileStatus defines the observed state of PostgresProfile
type PostgresProfileStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}

// +kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&PostgresProfile{}, &PostgresProfileList{})
}
141 changes: 137 additions & 4 deletions api/v1/zz_generated.deepcopy.go

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

27 changes: 18 additions & 9 deletions config/crd/bases/database.fits.cloud_postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,34 @@ spec:
description: Backup parametes of the database backup
properties:
retention:
description: Retention defines how many backups will reside. FIXME
check zalando CRD for other options, e.g. Days
description: Retention defines how many days a backup will persist
format: int32
type: integer
schedule:
description: Schedule defines how often a backup should be made,
in cron format
type: string
type: object
description:
description: Description
type: string
maintenance:
description: Maintenance defines automatic maintenance of the database
properties:
auto:
description: Auto if set to true database maintenance is done by
the operator
type: boolean
time_window:
description: Window defines the time window where the maintenance
will happen if Auto is set to true FIXME format
type: string
description: TimeWindow defines when the maintenance should happen
properties:
end:
format: date-time
type: string
start:
format: date-time
type: string
type: object
weekday:
description: Weekday defines when the operator is allowed to do
maintenance
type: integer
type: object
number_of_instances:
description: NumberOfInstances number of replicas
Expand Down
Loading