Skip to content

Commit c3ddab5

Browse files
authored
Merge pull request #24 from linuxfoundation/andrest50/settings
[LFXV2-953] Add mailing list settings support with writers/auditors
2 parents 2f96a40 + f0c9752 commit c3ddab5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+10389
-2106
lines changed

charts/lfx-v2-mailing-list-service/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ spec:
3636
{{- toYaml $config.valueFrom | nindent 16 }}
3737
{{- end }}
3838
{{- end }}
39+
{{- if .Values.externalSecretsOperator.enabled }}
3940
envFrom:
4041
- secretRef:
4142
name: {{ .Chart.Name }}
43+
{{- end }}
4244
ports:
4345
- containerPort: {{.Values.service.port}}
4446
name: web

charts/lfx-v2-mailing-list-service/templates/nats-kv-buckets.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ spec:
1919
maxBytes: {{ .Values.nats.groupsio_services_kv_bucket.maxBytes }}
2020
compression: {{ .Values.nats.groupsio_services_kv_bucket.compression }}
2121
{{- end }}
22+
{{- if .Values.nats.groupsio_service_settings_kv_bucket.creation }}
23+
---
24+
apiVersion: jetstream.nats.io/v1beta2
25+
kind: KeyValue
26+
metadata:
27+
name: {{ .Values.nats.groupsio_service_settings_kv_bucket.name }}
28+
namespace: {{ .Release.Namespace }}
29+
{{- if .Values.nats.groupsio_service_settings_kv_bucket.keep }}
30+
annotations:
31+
"helm.sh/resource-policy": keep
32+
{{- end }}
33+
spec:
34+
bucket: {{ .Values.nats.groupsio_service_settings_kv_bucket.name }}
35+
history: {{ .Values.nats.groupsio_service_settings_kv_bucket.history }}
36+
storage: {{ .Values.nats.groupsio_service_settings_kv_bucket.storage }}
37+
maxValueSize: {{ .Values.nats.groupsio_service_settings_kv_bucket.maxValueSize }}
38+
maxBytes: {{ .Values.nats.groupsio_service_settings_kv_bucket.maxBytes }}
39+
compression: {{ .Values.nats.groupsio_service_settings_kv_bucket.compression }}
40+
{{- end }}
2241
{{- if .Values.nats.groupsio_mailing_lists_kv_bucket.creation }}
2342
---
2443
apiVersion: jetstream.nats.io/v1beta2
@@ -38,6 +57,25 @@ spec:
3857
maxBytes: {{ .Values.nats.groupsio_mailing_lists_kv_bucket.maxBytes }}
3958
compression: {{ .Values.nats.groupsio_mailing_lists_kv_bucket.compression }}
4059
{{- end }}
60+
{{- if .Values.nats.groupsio_mailing_list_settings_kv_bucket.creation }}
61+
---
62+
apiVersion: jetstream.nats.io/v1beta2
63+
kind: KeyValue
64+
metadata:
65+
name: {{ .Values.nats.groupsio_mailing_list_settings_kv_bucket.name }}
66+
namespace: {{ .Release.Namespace }}
67+
{{- if .Values.nats.groupsio_mailing_list_settings_kv_bucket.keep }}
68+
annotations:
69+
"helm.sh/resource-policy": keep
70+
{{- end }}
71+
spec:
72+
bucket: {{ .Values.nats.groupsio_mailing_list_settings_kv_bucket.name }}
73+
history: {{ .Values.nats.groupsio_mailing_list_settings_kv_bucket.history }}
74+
storage: {{ .Values.nats.groupsio_mailing_list_settings_kv_bucket.storage }}
75+
maxValueSize: {{ .Values.nats.groupsio_mailing_list_settings_kv_bucket.maxValueSize }}
76+
maxBytes: {{ .Values.nats.groupsio_mailing_list_settings_kv_bucket.maxBytes }}
77+
compression: {{ .Values.nats.groupsio_mailing_list_settings_kv_bucket.compression }}
78+
{{- end }}
4179
{{- if .Values.nats.groupsio_members_kv_bucket.creation }}
4280
---
4381
apiVersion: jetstream.nats.io/v1beta2

charts/lfx-v2-mailing-list-service/values.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,27 @@ nats:
8181
# compression is a boolean to determine if the KV bucket should be compressed
8282
compression: true
8383

84+
# groupsio_service_settings_kv_bucket is the configuration for the KV bucket for storing GroupsIO service settings
85+
groupsio_service_settings_kv_bucket:
86+
# creation is a boolean to determine if the KV bucket should be created via the helm chart.
87+
# set it to false if you want to use an existing KV bucket.
88+
creation: true
89+
# keep is a boolean to determine if the KV bucket should be preserved during helm uninstall
90+
# set it to false if you want the bucket to be deleted when the chart is uninstalled
91+
keep: true
92+
# name is the name of the KV bucket for storing GroupsIO service settings
93+
name: groupsio-service-settings
94+
# history is the number of history entries to keep for the KV bucket
95+
history: 20
96+
# storage is the storage type for the KV bucket
97+
storage: file
98+
# maxValueSize is the maximum size of a value in the KV bucket
99+
maxValueSize: 1048576 # 1MB
100+
# maxBytes is the maximum number of bytes in the KV bucket
101+
maxBytes: 104857600 # 100MB
102+
# compression is a boolean to determine if the KV bucket should be compressed
103+
compression: true
104+
84105
# groupsio_mailing_lists_kv_bucket is the configuration for the KV bucket for storing GroupsIO mailing lists
85106
groupsio_mailing_lists_kv_bucket:
86107
# creation is a boolean to determine if the KV bucket should be created via the helm chart.
@@ -102,6 +123,27 @@ nats:
102123
# compression is a boolean to determine if the KV bucket should be compressed
103124
compression: true
104125

126+
# groupsio_mailing_list_settings_kv_bucket is the configuration for the KV bucket for storing GroupsIO mailing list settings
127+
groupsio_mailing_list_settings_kv_bucket:
128+
# creation is a boolean to determine if the KV bucket should be created via the helm chart.
129+
# set it to false if you want to use an existing KV bucket.
130+
creation: true
131+
# keep is a boolean to determine if the KV bucket should be preserved during helm uninstall
132+
# set it to false if you want the bucket to be deleted when the chart is uninstalled
133+
keep: true
134+
# name is the name of the KV bucket for storing GroupsIO mailing list settings
135+
name: groupsio-mailing-list-settings
136+
# history is the number of history entries to keep for the KV bucket
137+
history: 20
138+
# storage is the storage type for the KV bucket
139+
storage: file
140+
# maxValueSize is the maximum size of a value in the KV bucket
141+
maxValueSize: 1048576 # 1MB
142+
# maxBytes is the maximum number of bytes in the KV bucket
143+
maxBytes: 104857600 # 100MB
144+
# compression is a boolean to determine if the KV bucket should be compressed
145+
compression: true
146+
105147
# groupsio_members_kv_bucket is the configuration for the KV bucket for storing GroupsIO members
106148
groupsio_members_kv_bucket:
107149
# creation is a boolean to determine if the KV bucket should be created via the helm chart.

cmd/mailing-list-api/design/mailing_list.go

Lines changed: 133 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ var _ = dsl.Service("mailing-list", func() {
132132
GrpsIOServiceUIDAttribute()
133133
GrpsIOServiceBaseAttributes()
134134

135-
WritersAttribute()
136-
AuditorsAttribute()
137-
138135
dsl.Required("type", "project_uid", "version")
139136
})
140137
dsl.Result(GrpsIOServiceWithReadonlyAttributes)
@@ -187,6 +184,72 @@ var _ = dsl.Service("mailing-list", func() {
187184
})
188185
})
189186

187+
dsl.Method("get-grpsio-service-settings", func() {
188+
dsl.Description("Get GroupsIO service settings (writers and auditors)")
189+
dsl.Security(JWTAuth)
190+
dsl.Payload(func() {
191+
BearerTokenAttribute()
192+
VersionAttribute()
193+
GrpsIOServiceUIDAttribute()
194+
})
195+
dsl.Result(func() {
196+
dsl.Attribute("service_settings", GrpsIOServiceSettings)
197+
ETagAttribute()
198+
dsl.Required("service_settings")
199+
})
200+
dsl.Error("BadRequest", BadRequestError, "Bad request")
201+
dsl.Error("NotFound", NotFoundError, "Service settings not found")
202+
dsl.Error("InternalServerError", InternalServerError, "Internal server error")
203+
dsl.Error("ServiceUnavailable", ServiceUnavailableError, "Service unavailable")
204+
dsl.HTTP(func() {
205+
dsl.GET("/groupsio/services/{uid}/settings")
206+
dsl.Param("version:v")
207+
dsl.Param("uid")
208+
dsl.Header("bearer_token:Authorization")
209+
dsl.Response(dsl.StatusOK, func() {
210+
dsl.Body("service_settings")
211+
dsl.Header("etag:ETag")
212+
})
213+
dsl.Response("BadRequest", dsl.StatusBadRequest)
214+
dsl.Response("NotFound", dsl.StatusNotFound)
215+
dsl.Response("InternalServerError", dsl.StatusInternalServerError)
216+
dsl.Response("ServiceUnavailable", dsl.StatusServiceUnavailable)
217+
})
218+
})
219+
220+
dsl.Method("update-grpsio-service-settings", func() {
221+
dsl.Description("Update GroupsIO service settings (writers and auditors)")
222+
dsl.Security(JWTAuth)
223+
dsl.Payload(func() {
224+
BearerTokenAttribute()
225+
VersionAttribute()
226+
IfMatchAttribute()
227+
GrpsIOServiceUIDAttribute()
228+
WritersAttribute()
229+
AuditorsAttribute()
230+
dsl.Required("version", "uid")
231+
})
232+
dsl.Result(GrpsIOServiceSettings)
233+
dsl.Error("BadRequest", BadRequestError, "Bad request")
234+
dsl.Error("NotFound", NotFoundError, "Service settings not found")
235+
dsl.Error("Conflict", ConflictError, "Conflict - ETag mismatch")
236+
dsl.Error("InternalServerError", InternalServerError, "Internal server error")
237+
dsl.Error("ServiceUnavailable", ServiceUnavailableError, "Service unavailable")
238+
dsl.HTTP(func() {
239+
dsl.PUT("/groupsio/services/{uid}/settings")
240+
dsl.Param("version:v")
241+
dsl.Param("uid")
242+
dsl.Header("bearer_token:Authorization")
243+
dsl.Header("if_match:If-Match")
244+
dsl.Response(dsl.StatusOK)
245+
dsl.Response("BadRequest", dsl.StatusBadRequest)
246+
dsl.Response("NotFound", dsl.StatusNotFound)
247+
dsl.Response("Conflict", dsl.StatusConflict)
248+
dsl.Response("InternalServerError", dsl.StatusInternalServerError)
249+
dsl.Response("ServiceUnavailable", dsl.StatusServiceUnavailable)
250+
})
251+
})
252+
190253
// Mailing List Management endpoints
191254
dsl.Method("create-grpsio-mailing-list", func() {
192255
dsl.Description("Create GroupsIO mailing list/subgroup with comprehensive validation")
@@ -197,6 +260,7 @@ var _ = dsl.Service("mailing-list", func() {
197260

198261
GrpsIOMailingListBaseAttributes()
199262

263+
// Settings fields (writers and auditors) for initial mailing list setup
200264
WritersAttribute()
201265
AuditorsAttribute()
202266

@@ -267,9 +331,6 @@ var _ = dsl.Service("mailing-list", func() {
267331
GrpsIOMailingListUIDAttribute()
268332
GrpsIOMailingListBaseAttributes()
269333

270-
WritersAttribute()
271-
AuditorsAttribute()
272-
273334
dsl.Required("group_name", "public", "type", "description", "title", "service_uid", "version")
274335
})
275336
dsl.Result(GrpsIOMailingListWithReadonlyAttributes)
@@ -322,6 +383,72 @@ var _ = dsl.Service("mailing-list", func() {
322383
})
323384
})
324385

386+
dsl.Method("get-grpsio-mailing-list-settings", func() {
387+
dsl.Description("Get GroupsIO mailing list settings (writers and auditors)")
388+
dsl.Security(JWTAuth)
389+
dsl.Payload(func() {
390+
BearerTokenAttribute()
391+
VersionAttribute()
392+
GrpsIOMailingListUIDAttribute()
393+
})
394+
dsl.Result(func() {
395+
dsl.Attribute("mailing_list_settings", GrpsIOMailingListSettings)
396+
ETagAttribute()
397+
dsl.Required("mailing_list_settings")
398+
})
399+
dsl.Error("BadRequest", BadRequestError, "Bad request")
400+
dsl.Error("NotFound", NotFoundError, "Mailing list settings not found")
401+
dsl.Error("InternalServerError", InternalServerError, "Internal server error")
402+
dsl.Error("ServiceUnavailable", ServiceUnavailableError, "Service unavailable")
403+
dsl.HTTP(func() {
404+
dsl.GET("/groupsio/mailing-lists/{uid}/settings")
405+
dsl.Param("version:v")
406+
dsl.Param("uid")
407+
dsl.Header("bearer_token:Authorization")
408+
dsl.Response(dsl.StatusOK, func() {
409+
dsl.Body("mailing_list_settings")
410+
dsl.Header("etag:ETag")
411+
})
412+
dsl.Response("BadRequest", dsl.StatusBadRequest)
413+
dsl.Response("NotFound", dsl.StatusNotFound)
414+
dsl.Response("InternalServerError", dsl.StatusInternalServerError)
415+
dsl.Response("ServiceUnavailable", dsl.StatusServiceUnavailable)
416+
})
417+
})
418+
419+
dsl.Method("update-grpsio-mailing-list-settings", func() {
420+
dsl.Description("Update GroupsIO mailing list settings (writers and auditors)")
421+
dsl.Security(JWTAuth)
422+
dsl.Payload(func() {
423+
BearerTokenAttribute()
424+
VersionAttribute()
425+
IfMatchAttribute()
426+
GrpsIOMailingListUIDAttribute()
427+
WritersAttribute()
428+
AuditorsAttribute()
429+
dsl.Required("version", "uid")
430+
})
431+
dsl.Result(GrpsIOMailingListSettings)
432+
dsl.Error("BadRequest", BadRequestError, "Bad request")
433+
dsl.Error("NotFound", NotFoundError, "Mailing list settings not found")
434+
dsl.Error("Conflict", ConflictError, "Conflict - ETag mismatch")
435+
dsl.Error("InternalServerError", InternalServerError, "Internal server error")
436+
dsl.Error("ServiceUnavailable", ServiceUnavailableError, "Service unavailable")
437+
dsl.HTTP(func() {
438+
dsl.PUT("/groupsio/mailing-lists/{uid}/settings")
439+
dsl.Param("version:v")
440+
dsl.Param("uid")
441+
dsl.Header("bearer_token:Authorization")
442+
dsl.Header("if_match:If-Match")
443+
dsl.Response(dsl.StatusOK)
444+
dsl.Response("BadRequest", dsl.StatusBadRequest)
445+
dsl.Response("NotFound", dsl.StatusNotFound)
446+
dsl.Response("Conflict", dsl.StatusConflict)
447+
dsl.Response("InternalServerError", dsl.StatusInternalServerError)
448+
dsl.Response("ServiceUnavailable", dsl.StatusServiceUnavailable)
449+
})
450+
})
451+
325452
// Member management endpoints
326453
dsl.Method("create-grpsio-mailing-list-member", func() {
327454
dsl.Description("Create a new member for a GroupsIO mailing list")

0 commit comments

Comments
 (0)