Skip to content

Commit

Permalink
Apply syntactic sugar for on line check for empty auditlog struct
Browse files Browse the repository at this point in the history
  • Loading branch information
koala7659 committed Dec 11, 2024
1 parent 56d7b58 commit bf788b0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/gardener/shoot/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ func NewConverterCreate(opts CreateOpts) Converter {
extendersForCreate = append(extendersForCreate,
extender2.NewKubernetesExtender(opts.Kubernetes.DefaultVersion, ""))

var zero auditlogs.AuditLogData
if opts.AuditLogData != zero {
if opts.AuditLogData != (auditlogs.AuditLogData{}) {
extendersForCreate = append(extendersForCreate,
auditlogs.NewAuditlogExtenderForCreate(
opts.AuditLog.PolicyConfigMapName,
Expand Down Expand Up @@ -101,10 +100,9 @@ func NewConverterPatch(opts PatchOpts) Converter {

extendersForPatch = append(extendersForPatch, extender2.NewKubernetesExtender(opts.Kubernetes.DefaultVersion, opts.ShootK8SVersion))

var zero auditlogs.AuditLogData
if opts.AuditLogData != zero {
if opts.AuditLogData != (auditlogs.AuditLogData{}) {
extendersForPatch = append(extendersForPatch,
auditlogs.NewAuditlogExtenderForPatch(opts.AuditLog.PolicyConfigMapName))
auditlogs.NewAuditlogExtenderForPatch(opts.ConverterConfig.AuditLog.PolicyConfigMapName))
}

return newConverter(opts.ConverterConfig, extendersForPatch...)
Expand Down

0 comments on commit bf788b0

Please sign in to comment.