Skip to content

Commit f745270

Browse files
committed
Add more config options; make optional config to pointer; add defaults for new options
1 parent a3b7560 commit f745270

File tree

7 files changed

+275
-28
lines changed

7 files changed

+275
-28
lines changed

pkg/apis/audit/types.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type AuditBackendClusterForwarding struct {
6969
Enabled bool
7070

7171
// FilesystemBufferSize is the maximum disk space for the fluent-bit file system buffer.
72+
// +optional
7273
FilesystemBufferSize *string
7374
}
7475

@@ -77,6 +78,7 @@ type AuditBackendSplunk struct {
7778
Enabled bool
7879

7980
// FilesystemBufferSize is the maximum disk space for the fluent-bit file system buffer.
81+
// +optional
8082
FilesystemBufferSize *string
8183

8284
// Index is the splunk index that should be used.
@@ -111,6 +113,7 @@ type AuditBackendS3 struct {
111113
Enabled bool
112114

113115
// FilesystemBufferSize is the maximum disk space for the fluent-bit file system buffer.
116+
// +optional
114117
FilesystemBufferSize *string
115118

116119
// Bucket is the S3 bucket name where audit logs will be stored.
@@ -119,9 +122,13 @@ type AuditBackendS3 struct {
119122
// Region is the AWS region where the bucket is located.
120123
Region string
121124

122-
// Prefix is the prefix (folder path) where audit logs will be stored in the bucket.
125+
// Prefix is the prefix (folder path) where audit logs will be stored in the bucket. Defaults to "/audit-logs".
123126
// +optional
124-
Prefix string
127+
Prefix *string
128+
129+
// S3KeyFormat is the folder structure in which the audit logs will be stored in the bucket. Defaults to "/%Y/%m/%d/%H/%M/%S/$UUID".
130+
// +optional
131+
S3KeyFormat *string
125132

126133
// SecretResourceName is a reference under Shoot.spec.resources to the secret used to authenticate against AWS.
127134
// The referenced secret must contain:
@@ -131,9 +138,21 @@ type AuditBackendS3 struct {
131138

132139
// Endpoint is the custom S3 endpoint URL (optional, for S3-compatible storage).
133140
// +optional
134-
Endpoint string
141+
Endpoint *string
135142

136143
// TlsEnabled determines whether TLS should be used to communicate with S3.
137144
// +optional
138-
TlsEnabled bool
145+
TlsEnabled *bool
146+
147+
// TotalFileSize specify file size in S3. Minimum size is 1M, maximum size is 1G. Defaults to 100M.
148+
// +optional
149+
TotalFileSize *string
150+
151+
// UploadTimeout specify the amount of time in which the logs are uploaded and creates a new file in S3. Defaults to 10m.
152+
// +optional
153+
UploadTimeout *string
154+
155+
// UseCompression enables gzip compression for the S3 objects.
156+
// +optional
157+
UseCompression *bool
139158
}

pkg/apis/audit/v1alpha1/defaults.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,24 @@ func defaultBackendS3(backend *AuditBackendS3) {
6565
if backend.FilesystemBufferSize == nil {
6666
backend.FilesystemBufferSize = pointer.Pointer("900M")
6767
}
68+
69+
if backend.TlsEnabled == nil {
70+
backend.TlsEnabled = pointer.Pointer(true)
71+
}
72+
73+
if backend.TotalFileSize == nil {
74+
backend.TotalFileSize = pointer.Pointer("100M")
75+
}
76+
77+
if backend.UploadTimeout == nil {
78+
backend.UploadTimeout = pointer.Pointer("10m")
79+
}
80+
81+
if backend.Prefix == nil {
82+
backend.Prefix = pointer.Pointer("/audit-logs")
83+
}
84+
85+
if backend.S3KeyFormat == nil {
86+
backend.S3KeyFormat = pointer.Pointer("/%Y/%m/%d/%H/%M/%S/$UUID")
87+
}
6888
}

pkg/apis/audit/v1alpha1/types.go

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ type AuditBackendClusterForwarding struct {
9292
Enabled bool `json:"enabled"`
9393

9494
// FilesystemBufferSize is the maximum disk space for the fluent-bit file system buffer.
95+
// +optional
9596
FilesystemBufferSize *string `json:"bufferSize,omitempty"`
9697
}
9798
type AuditBackendSplunk struct {
9899
// Enabled allows to turn this backend on.
99100
Enabled bool `json:"enabled"`
100101

101102
// FilesystemBufferSize is the maximum disk space for the fluent-bit file system buffer.
103+
// +optional
102104
FilesystemBufferSize *string `json:"bufferSize,omitempty"`
103105

104106
// Index is the splunk index that should be used.
@@ -134,6 +136,7 @@ type AuditBackendS3 struct {
134136
Enabled bool `json:"enabled"`
135137

136138
// FilesystemBufferSize is the maximum disk space for the fluent-bit file system buffer.
139+
// +optional
137140
FilesystemBufferSize *string `json:"bufferSize,omitempty"`
138141

139142
// Bucket is the S3 bucket name where audit logs will be stored.
@@ -142,9 +145,13 @@ type AuditBackendS3 struct {
142145
// Region is the AWS region where the bucket is located.
143146
Region string `json:"region"`
144147

145-
// Prefix is the prefix (folder path) where audit logs will be stored in the bucket.
148+
// Prefix is the prefix (folder path) where audit logs will be stored in the bucket. Defaults to "/audit-logs".
146149
// +optional
147-
Prefix string `json:"prefix,omitempty"`
150+
Prefix *string `json:"prefix,omitempty"`
151+
152+
// S3KeyFormat is the folder structure in which the audit logs will be stored in the bucket. Defaults to "/%Y/%m/%d/%H/%M/%S/$UUID".
153+
// +optional
154+
S3KeyFormat *string `json:"s3KeyFormat,omitempty"`
148155

149156
// SecretResourceName is a reference under Shoot.spec.resources to the secret used to authenticate against AWS.
150157
// The referenced secret must contain:
@@ -154,9 +161,21 @@ type AuditBackendS3 struct {
154161

155162
// Endpoint is the custom S3 endpoint URL (optional, for S3-compatible storage).
156163
// +optional
157-
Endpoint string `json:"endpoint,omitempty"`
164+
Endpoint *string `json:"endpoint,omitempty"`
165+
166+
// TlsEnabled determines whether TLS should be used to communicate with S3. Defaults to "true".
167+
// +optional
168+
TlsEnabled *bool `json:"tlsEnabled,omitempty"`
169+
170+
// TotalFileSize specify file size in S3. Minimum size is 1M, maximum size is 1G. Defaults to 100M.
171+
// +optional
172+
TotalFileSize *string `json:"totalFileSize,omitempty"`
173+
174+
// UploadTimeout specify the amount of time in which the logs are uploaded and creates a new file in S3. Defaults to 10m.
175+
// +optional
176+
UploadTimeout *string `json:"uploadTimeout,omitempty"`
158177

159-
// TlsEnabled determines whether TLS should be used to communicate with S3.
178+
// UseCompression enables gzip compression for the S3 objects.
160179
// +optional
161-
TlsEnabled bool `json:"tlsEnabled,omitempty"`
180+
UseCompression *bool `json:"useCompression,omitempty"`
162181
}

pkg/apis/audit/v1alpha1/zz_generated.conversion.go

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/audit/v1alpha1/zz_generated.deepcopy.go

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/audit/zz_generated.deepcopy.go

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)