-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nicolas Bigler <[email protected]>
- Loading branch information
Showing
5 changed files
with
559 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package v1 | ||
|
||
type AwsDBaaSServiceSpec struct { | ||
// +kubebuilder:validation:Enum=us-east-2;us-east-1;us-west-1;us-west-2;af-south-1;ap-east-1;ap-south-2;ap-southeast-3;ap-southeast-4;ap-south-1;ap-northeast-3;ap-northeast-2;ap-southeast-1;ap-southeast-2;ap-northeast-1;ca-central-1;eu-central-1;eu-west-1;eu-west-2;eu-south-1;eu-west-3;eu-south-2;eu-north-1;eu-central-2;il-central-1;me-south-1;me-central-1;sa-east-us-east-2;us-east-1;us-west-1;us-west-2;af-south-1;ap-east-1;ap-south-2;ap-southeast-3;ap-southeast-4;ap-south-1;ap-northeast-3;ap-northeast-2;ap-southeast-1;ap-southeast-2;ap-northeast-1;ca-central-1;eu-central-1;eu-west-1;eu-west-2;eu-south-1;eu-west-3;eu-south-2;eu-north-1;eu-central-2;il-central-1;me-south-1;me-central-1;sa-east-11 | ||
// +kubebuilder:default="eu-central-1" | ||
|
||
// Region is the datacenter identifier in which the instance runs in. | ||
Region string `json:"region,omitempty"` | ||
} | ||
|
||
type AwsDBaaSMaintenanceScheduleSpec struct { | ||
// +kubebuilder:default="Wed:00:00-Wed:03:00" | ||
|
||
// The window to perform maintenance in. | ||
// Syntax: "ddd:hh24:mi-ddd:hh24:mi". Eg: "Mon:00:00-Mon:03:00". See RDS | ||
// Maintenance Window | ||
// docs | ||
// for more information. | ||
MaintenanceWindow string `json:"maintenanceWindow,omitempty"` | ||
} | ||
|
||
type AwsDBaaSSizeSpec struct { | ||
// +kubebuilder:default="db.t3.micro" | ||
|
||
// Plan is the name of the resource plan that defines the compute resources. | ||
Plan string `json:"plan,omitempty"` | ||
|
||
// +kubebuilder:default=10 | ||
|
||
// StorageSize is the size of the storage in GB. | ||
StorageSize int `json:"storageSize,omitempty"` | ||
|
||
// +kubebuilder:default="gp2" | ||
|
||
// StorageType is the storage type to use. | ||
StorageType string `json:"storageType,omitempty"` | ||
} | ||
|
||
type AwsDBaaSBackupSpec struct { | ||
// +kubebuilder:validation:Pattern="^([0-1]?[0-9]|2[0-3]):([0-5][0-9])-([0-1]?[0-9]|2[0-3]):([0-5][0-9])$" | ||
// +kubebuilder:default="21:30-22:00" | ||
|
||
// BackupWindow for doing daily backups, in UTC. | ||
// Format: "hh:mm:ss". | ||
BackupWindow string `json:"backupWindow,omitempty"` | ||
|
||
// RetentionPeriod is the number of days to retain backups for. | ||
RetentionPeriod int `json:"retentionPeriod,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package v1 | ||
|
||
import ( | ||
v1 "github.com/vshn/appcat/v4/apis/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
// Workaround to make nested defaulting work. | ||
// kubebuilder is unable to set a {} default | ||
//go:generate yq -i e ../../generated/aws.appcat.vshn.io_awsrds.yaml --expression "with(.spec.versions[]; .schema.openAPIV3Schema.properties.spec.properties.parameters.default={})" | ||
//go:generate yq -i e ../../generated/aws.appcat.vshn.io_awsrds.yaml --expression "with(.spec.versions[]; .schema.openAPIV3Schema.properties.spec.properties.parameters.properties.maintenance.default={})" | ||
//go:generate yq -i e ../../generated/aws.appcat.vshn.io_awsrds.yaml --expression "with(.spec.versions[]; .schema.openAPIV3Schema.properties.spec.properties.parameters.properties.backup.default={})" | ||
//go:generate yq -i e ../../generated/aws.appcat.vshn.io_awsrds.yaml --expression "with(.spec.versions[]; .schema.openAPIV3Schema.properties.spec.properties.parameters.properties.service.default={})" | ||
//go:generate yq -i e ../../generated/aws.appcat.vshn.io_awsrds.yaml --expression "with(.spec.versions[]; .schema.openAPIV3Schema.properties.spec.properties.parameters.properties.size.default={})" | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:printcolumn:name="Plan",type="string",JSONPath=".spec.parameters.size.plan" | ||
// +kubebuilder:printcolumn:name="Region",type="string",JSONPath=".spec.parameters.service.region" | ||
|
||
// AwsRds is the API for creating RDS instances on AWS. | ||
type AwsRds struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Spec defines the desired state of a AwsRds. | ||
Spec AwsRdsSpec `json:"spec,omitempty"` | ||
// Status reflects the observed state of a AwsRds. | ||
Status AwsRdsStatus `json:"status,omitempty"` | ||
} | ||
|
||
type AwsRdsSpec struct { | ||
// Parameters are the configurable fields of a AwsRds. | ||
Parameters AwsRdsParameters `json:"parameters,omitempty"` | ||
|
||
// WriteConnectionSecretToRef references a secret to which the connection details will be written. | ||
WriteConnectionSecretToRef v1.LocalObjectReference `json:"writeConnectionSecretToRef,omitempty"` | ||
} | ||
|
||
type AwsRdsParameters struct { | ||
// Service contains AWS RDS DBaaS specific properties | ||
Service AwsRdsServiceSpec `json:"service,omitempty"` | ||
|
||
// Maintenance contains settings to control the maintenance of an instance. | ||
Maintenance AwsDBaaSMaintenanceScheduleSpec `json:"maintenance,omitempty"` | ||
|
||
// Size contains settings to control the sizing of a service. | ||
Size AwsDBaaSSizeSpec `json:"size,omitempty"` | ||
|
||
// Backup contains settings to control the backups of an instance. | ||
Backup AwsDBaaSBackupSpec `json:"backup,omitempty"` | ||
} | ||
|
||
type AwsRdsServiceSpec struct { | ||
AwsDBaaSServiceSpec `json:",inline"` | ||
|
||
// +kubebuilder:validation:Enum=aurora-mysql;aurora-postgresql;custom-oracle-ee;custom-oracle-ee-cdb;custom-sqlserver-ee;custom-sqlserver-se;custom-sqlserver-web;mariadb;mysql;oracle-ee;oracle-ee-cdb;oracle-se2;oracle-se2-cdb;postgres;sqlserver-ee;sqlserver-se;sqlserver-ex;sqlserver-web | ||
// +kubebuilder:default="mysql" | ||
|
||
// Engine contains the type of the DB instance class. | ||
Engine string `json:"engine,omitempty"` | ||
|
||
// +kubebuilder:default="8.0" | ||
|
||
// MajorVersion contains the major version for the instance. | ||
// Depends on the chosen engine. | ||
MajorVersion string `json:"majorVersion,omitempty"` | ||
|
||
// RdsSettings contains additional settings for the RDS instance. | ||
RdsSettings runtime.RawExtension `json:"rdsSettings,omitempty"` | ||
|
||
// RdsOptions contains additional options for the RDS instance. | ||
RdsOptions runtime.RawExtension `json:"rdsOptions,omitempty"` | ||
|
||
// +kubebuilder:default="adminUser" | ||
|
||
// AdminUser contains the username for the admin user. | ||
AdminUser string `json:"adminUser,omitempty"` | ||
|
||
// DBName contains the name of the database to create. | ||
DBName string `json:"dbName,omitempty"` | ||
} | ||
|
||
type AwsRdsStatus struct { | ||
// RdsConditions contains the status conditions of the backing object. | ||
RdsConditions []v1.Condition `json:"rdsConditions,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// +kubebuilder:object:generate=true | ||
// +groupName=aws.appcat.vshn.io | ||
// +versionName=v1 | ||
|
||
package v1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.