Skip to content

Commit

Permalink
feat(rds): Add family selector to DBClusterParameterGroup (#1274)
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Blatt <maximilian.blatt-extern@deutschebahn.com>
(external expert on behalf of DB Netz AG)
  • Loading branch information
MisterMX committed May 8, 2022
1 parent de41888 commit c7d2dff
Show file tree
Hide file tree
Showing 15 changed files with 367 additions and 141 deletions.
4 changes: 4 additions & 0 deletions apis/rds/generator-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ ignore:
- ModifyDBInstanceInput.DBSecurityGroups
- ModifyDBInstanceInput.DBSubnetGroupName # this is immutable
- CreateDBParameterGroupInput.DBParameterGroupName
- CreateDBParameterGroupInput.DBParameterGroupFamily
- DeleteDBParameterGroupInput.DBParameterGroupName
- ModifyDBParameterGroupInput.DBParameterGroupName
- ModifyDBParameterGroupInput.DBParameterGroupFamily
- DescribeDBParameterGroupsInput.DBParameterGroupName
- CreateDBClusterParameterGroupInput.DBClusterParameterGroupName
- CreateDBClusterParameterGroupInput.DBParameterGroupFamily
- DeleteDBClusterParameterGroupInput.DBClusterParameterGroupName
- ModifyDBClusterParameterGroupInput.DBClusterParameterGroupName
- ModifyDBClusterParameterGroupInput.DBParameterGroupFamily
- DescribeDBClusterParameterGroupsInput.DBClusterParameterGroupName
- DescribeGlobalClustersInput.GlobalClusterIdentifier
- ModifyGlobalClusterInput.GlobalClusterIdentifier
Expand Down
125 changes: 125 additions & 0 deletions apis/rds/v1alpha1/custom_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,138 @@ type CustomDBParameterGroupParameters struct {
// A list of parameters to associate with this DB parameter group
// +optional
Parameters []Parameter `json:"parameters,omitempty"`

// The DB parameter group family name. A DB parameter group can be associated
// with one and only one DB parameter group family, and can be applied only
// to a DB instance running a database engine and engine version compatible
// with that DB parameter group family.
//
// To list all of the available parameter group families for a DB engine, use
// the following command:
//
// aws rds describe-db-engine-versions --query "DBEngineVersions[].DBParameterGroupFamily"
// --engine <engine>
//
// For example, to list all of the available parameter group families for the
// MySQL DB engine, use the following command:
//
// aws rds describe-db-engine-versions --query "DBEngineVersions[].DBParameterGroupFamily"
// --engine mysql
//
// The output contains duplicates.
//
// The following are the valid DB engine values:
//
// * aurora (for MySQL 5.6-compatible Aurora)
//
// * aurora-mysql (for MySQL 5.7-compatible Aurora)
//
// * aurora-postgresql
//
// * mariadb
//
// * mysql
//
// * oracle-ee
//
// * oracle-ee-cdb
//
// * oracle-se2
//
// * oracle-se2-cdb
//
// * postgres
//
// * sqlserver-ee
//
// * sqlserver-se
//
// * sqlserver-ex
//
// * sqlserver-web
//
// One of DBParameterGroupFamily or DBParameterGroupFamilySelector is required.
//
// +optional
DBParameterGroupFamily *string `json:"dbParameterGroupFamily,omitempty"`

// DBParameterGroupFamilySelector determines DBParameterGroupFamily from
// the engine and engine version.
//
// One of DBParameterGroupFamily or DBParameterGroupFamilySelector is required.
//
// Will not be used if DBParameterGroupFamily is already set.
// +optional
DBParameterGroupFamilySelector *DBParameterGroupFamilyNameSelector `json:"dbParameterGroupFamilySelector,omitempty"`
}

// CustomDBClusterParameterGroupParameters are custom parameters for DBClusterParameterGroup
type CustomDBClusterParameterGroupParameters struct {
// A list of parameters to associate with this DB cluster parameter group
// +optional
Parameters []Parameter `json:"parameters,omitempty"`

// The DB cluster parameter group family name. A DB cluster parameter group
// can be associated with one and only one DB cluster parameter group family,
// and can be applied only to a DB cluster running a database engine and engine
// version compatible with that DB cluster parameter group family.
//
// Aurora MySQL
//
// Example: aurora5.6, aurora-mysql5.7
//
// Aurora PostgreSQL
//
// Example: aurora-postgresql9.6
//
// To list all of the available parameter group families for a DB engine, use
// the following command:
//
// aws rds describe-db-engine-versions --query "DBEngineVersions[].DBParameterGroupFamily"
// --engine <engine>
//
// For example, to list all of the available parameter group families for the
// Aurora PostgreSQL DB engine, use the following command:
//
// aws rds describe-db-engine-versions --query "DBEngineVersions[].DBParameterGroupFamily"
// --engine aurora-postgresql
//
// The output contains duplicates.
//
// The following are the valid DB engine values:
//
// * aurora (for MySQL 5.6-compatible Aurora)
//
// * aurora-mysql (for MySQL 5.7-compatible Aurora)
//
// * aurora-postgresql
//
// One of DBParameterGroupFamily or DBParameterGroupFamilySelector is required.
//
// +optional
DBParameterGroupFamily *string `json:"dbParameterGroupFamily"`

// DBParameterGroupFamilySelector determines DBParameterGroupFamily from
// the engine and engine version.
//
// One of DBParameterGroupFamily or DBParameterGroupFamilySelector is required.
//
// Will not be used if DBParameterGroupFamily is already set.
// +optional
DBParameterGroupFamilySelector *DBParameterGroupFamilyNameSelector `json:"dbParameterGroupFamilySelector,omitempty"`
}

// DBParameterGroupFamilyNameSelector allows determining the family name from the
// database engine and engine version.
type DBParameterGroupFamilyNameSelector struct {
// Engine is the name of the database engine.
// +kubebuilder:validation:Required
Engine string `json:"engine"`

// EngineVersion is the version of the database engine.
// If it is nil, the default engine version given by AWS will be used.
// +optional
EngineVersion *string `json:"engineVersion,omitempty"`
}

// CustomDBClusterParameters are custom parameters for DBCluster
Expand Down
39 changes: 3 additions & 36 deletions apis/rds/v1alpha1/zz_db_cluster_parameter_group.go

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

53 changes: 3 additions & 50 deletions apis/rds/v1alpha1/zz_db_parameter_group.go

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

60 changes: 50 additions & 10 deletions apis/rds/v1alpha1/zz_generated.deepcopy.go

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

3 changes: 2 additions & 1 deletion examples/rds/db-aurora-clusterparametergroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ metadata:
spec:
forProvider:
region: us-east-1
dbParameterGroupFamily: aurora-mysql5.7
dbParameterGroupFamilySelector:
engine: aurora-mysql
description: example
tags:
- key: created-by
Expand Down
Loading

0 comments on commit c7d2dff

Please sign in to comment.