Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(database): revert breaking field removal part of #1835 #1845

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
26 changes: 26 additions & 0 deletions apis/database/v1beta1/rdsinstance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ type ProcessorFeature struct {
Value string `json:"value"`
}

// CloudwatchLogsExportConfiguration is the configuration setting for the log types to be enabled for export to CloudWatch
// Logs for a specific DB instance or DB cluster.
// The EnableLogTypes and DisableLogTypes arrays determine which logs will be
// exported (or not exported) to CloudWatch Logs. The values within these arrays
// depend on the DB engine being used. For more information, see Publishing
// Database Logs to Amazon CloudWatch Logs (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch)
// in the Amazon RDS User Guide.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CloudwatchLogsExportConfiguration
type CloudwatchLogsExportConfiguration struct {
// DisableLogTypes is the list of log types to disable.
// +immutable
DisableLogTypes []string `json:"disableLogTypes,omitempty"`

// EnableLogTypes is the list of log types to enable.
// +immutable
EnableLogTypes []string `json:"enableLogTypes,omitempty"`
} // TODO: remove deprecated field + code. Mapping to EnableCloudwatchLogsExports while in deprecation.

// ScalingConfiguration contains the scaling configuration of an Aurora Serverless DB cluster.
// For more information, see Using Amazon Aurora Serverless (http://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html)
// in the Amazon Aurora User Guide.
Expand Down Expand Up @@ -774,6 +792,14 @@ type RDSInstanceParameters struct {
// +optional
ApplyModificationsImmediately *bool `json:"applyModificationsImmediately,omitempty"`

// Deprecated: This field will be removed. Use `enableCloudwatchLogsExports` instead.
// CloudwatchLogsExportConfiguration is the configuration setting for the log types to be enabled for export to CloudWatch
// Logs for a specific DB instance.
// +immutable
// +optional
CloudwatchLogsExportConfiguration *CloudwatchLogsExportConfiguration `json:"cloudwatchLogsExportConfiguration,omitempty"`
// TODO: remove deprecated field + code. Mapping to EnableCloudwatchLogsExports while in deprecation.

// DBParameterGroupName is the name of the DB parameter group to associate with this DB instance. If
// this argument is omitted, the default DBParameterGroup for the specified
// engine is used.
Expand Down
30 changes: 30 additions & 0 deletions apis/database/v1beta1/zz_generated.deepcopy.go

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

17 changes: 17 additions & 0 deletions package/crds/database.aws.crossplane.io_rdsinstances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@ spec:
engines, Amazon Aurora Not applicable. The character set is
managed by the DB cluster. For more information, see CreateDBCluster.
type: string
cloudwatchLogsExportConfiguration:
description: 'Deprecated: This field will be removed. Use `enableCloudwatchLogsExports`
instead. CloudwatchLogsExportConfiguration is the configuration
setting for the log types to be enabled for export to CloudWatch
Logs for a specific DB instance.'
properties:
disableLogTypes:
description: DisableLogTypes is the list of log types to disable.
items:
type: string
type: array
enableLogTypes:
description: EnableLogTypes is the list of log types to enable.
items:
type: string
type: array
type: object
copyTagsToSnapshot:
description: CopyTagsToSnapshot should be true to copy all tags
from the DB instance to snapshots of the DB instance, and otherwise
Expand Down
7 changes: 7 additions & 0 deletions pkg/clients/database/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,11 @@ func LateInitialize(in *v1beta1.RDSInstanceParameters, db *rdstypes.DBInstance)
}
}
}
// TODO: remove deprecated field + code. Mapping to EnableCloudwatchLogsExports while in deprecation.
// nolint:staticcheck
if len(in.EnableCloudwatchLogsExports) == 0 && in.CloudwatchLogsExportConfiguration != nil {
in.EnableCloudwatchLogsExports = in.CloudwatchLogsExportConfiguration.EnableLogTypes
}
}

// IsUpToDate checks whether there is a change in any of the modifiable fields.
Expand All @@ -676,6 +681,8 @@ func IsUpToDate(ctx context.Context, kube client.Client, r *v1beta1.RDSInstance,
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "MasterPasswordSecretRef"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "OptionGroupName"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "EnableCloudwatchLogsExports"),
// TODO: remove deprecated field + code. Mapping to EnableCloudwatchLogsExports while in deprecation.
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "CloudwatchLogsExportConfiguration"),
)

engineVersionChanged := !isEngineVersionUpToDate(r, db)
Expand Down
Loading