Skip to content

Commit 929a98b

Browse files
committed
Binding bucket logging pvc and path to core and endpoint pods and exporting GUARANTEED_LOGS_PATH as
environment variable Signed-off-by: Aayush Chouhan <[email protected]>
1 parent 6aec8cd commit 929a98b

File tree

6 files changed

+57
-3
lines changed

6 files changed

+57
-3
lines changed

deploy/internal/deployment-endpoint.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ spec:
109109
- name: LOCAL_N2N_AGENT
110110
- name: NOOBAA_ROOT_SECRET
111111
- name: NODE_EXTRA_CA_CERTS
112+
- name: GUARANTEED_LOGS_PATH
112113
- name: CONTAINER_CPU_REQUEST
113114
valueFrom:
114115
resourceFieldRef:

deploy/internal/statefulset-core.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ spec:
100100
- name: POSTGRES_CONNECTION_STRING
101101
- name: POSTGRES_SSL_REQUIRED
102102
- name: POSTGRES_SSL_UNAUTHORIZED
103+
- name: GUARANTEED_LOGS_PATH
103104
- name: DB_TYPE
104105
value: postgres
105106
- name: CONTAINER_PLATFORM

pkg/bundle/deploy.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -3852,7 +3852,7 @@ data:
38523852
shared_preload_libraries = 'pg_stat_statements'
38533853
`
38543854

3855-
const Sha256_deploy_internal_deployment_endpoint_yaml = "92e43b6069c5c28ee7c9efe9fc64d641d35f9e12e53773630ebfedd4685aeb88"
3855+
const Sha256_deploy_internal_deployment_endpoint_yaml = "846a11f2ff8035ee4beb2dff72339f4cd946b05827c76489a44e921be2c34f48"
38563856

38573857
const File_deploy_internal_deployment_endpoint_yaml = `apiVersion: apps/v1
38583858
kind: Deployment
@@ -3965,6 +3965,7 @@ spec:
39653965
- name: LOCAL_N2N_AGENT
39663966
- name: NOOBAA_ROOT_SECRET
39673967
- name: NODE_EXTRA_CA_CERTS
3968+
- name: GUARANTEED_LOGS_PATH
39683969
- name: CONTAINER_CPU_REQUEST
39693970
valueFrom:
39703971
resourceFieldRef:
@@ -4899,7 +4900,7 @@ spec:
48994900
noobaa-s3-svc: "true"
49004901
`
49014902

4902-
const Sha256_deploy_internal_statefulset_core_yaml = "7b00c7a0e22fe28cb0827a696381b78c2bd79812a7dacbaa51cfe243e91f4f99"
4903+
const Sha256_deploy_internal_statefulset_core_yaml = "0e7e90edc6c96f93cbdbdcc6aa6b64f05a98a88b181d94780d9a97fb2fcecd07"
49034904

49044905
const File_deploy_internal_statefulset_core_yaml = `apiVersion: apps/v1
49054906
kind: StatefulSet
@@ -5003,6 +5004,7 @@ spec:
50035004
- name: POSTGRES_CONNECTION_STRING
50045005
- name: POSTGRES_SSL_REQUIRED
50055006
- name: POSTGRES_SSL_UNAUTHORIZED
5007+
- name: GUARANTEED_LOGS_PATH
50065008
- name: DB_TYPE
50075009
value: postgres
50085010
- name: CONTAINER_PLATFORM

pkg/system/phase2_creating.go

+23
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,10 @@ func (r *Reconciler) setDesiredCoreEnv(c *corev1.Container) {
427427
c.Env[j].Value = r.SecretRootMasterKey
428428
case "NODE_EXTRA_CA_CERTS":
429429
c.Env[j].Value = r.ApplyCAsToPods
430+
case "GUARANTEED_LOGS_PATH":
431+
if r.NooBaa.Spec.BucketLogging.LoggingType == nbv1.BucketLoggingTypeGuaranteed {
432+
c.Env[j].Value = r.BucketLoggingVolumeMount
433+
}
430434
}
431435
}
432436
}
@@ -484,6 +488,13 @@ func (r *Reconciler) SetDesiredCoreApp() error {
484488
}}
485489
util.MergeVolumeMountList(&c.VolumeMounts, &secretVolumeMounts)
486490
}
491+
if r.NooBaa.Spec.BucketLogging.LoggingType == nbv1.BucketLoggingTypeGuaranteed {
492+
bucketLogVolumeMounts := []corev1.VolumeMount{{
493+
Name: r.BucketLoggingVolume,
494+
MountPath: r.BucketLoggingVolumeMount,
495+
}}
496+
util.MergeVolumeMountList(&c.VolumeMounts, &bucketLogVolumeMounts)
497+
}
487498
case "noobaa-log-processor":
488499
if c.Image != r.NooBaa.Status.ActualImage {
489500
coreImageChanged = true
@@ -580,6 +591,18 @@ func (r *Reconciler) SetDesiredCoreApp() error {
580591
}}
581592
util.MergeVolumeList(&podSpec.Volumes, &secretVolumes)
582593
}
594+
595+
if r.NooBaa.Spec.BucketLogging.LoggingType == nbv1.BucketLoggingTypeGuaranteed {
596+
bucketLogVolumes := []corev1.Volume{{
597+
Name: r.BucketLoggingVolume,
598+
VolumeSource: corev1.VolumeSource{
599+
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
600+
ClaimName: r.BucketLoggingPVC.Name,
601+
},
602+
},
603+
}}
604+
util.MergeVolumeList(&podSpec.Volumes, &bucketLogVolumes)
605+
}
583606
return nil
584607
}
585608

pkg/system/phase4_configuring.go

+22-1
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,12 @@ func (r *Reconciler) SetDesiredDeploymentEndpoint() error {
403403
} else {
404404
c.Env[j].Value = ""
405405
}
406-
407406
case "NODE_EXTRA_CA_CERTS":
408407
c.Env[j].Value = r.ApplyCAsToPods
408+
case "GUARANTEED_LOGS_PATH":
409+
if r.NooBaa.Spec.BucketLogging.LoggingType == nbv1.BucketLoggingTypeGuaranteed {
410+
c.Env[j].Value = r.BucketLoggingVolumeMount
411+
}
409412
}
410413
}
411414

@@ -526,6 +529,24 @@ func (r *Reconciler) setDesiredEndpointMounts(podSpec *corev1.PodSpec, container
526529
util.MergeVolumeMountList(&container.VolumeMounts, &secretVolumeMounts)
527530
}
528531

532+
if r.NooBaa.Spec.BucketLogging.LoggingType == nbv1.BucketLoggingTypeGuaranteed {
533+
bucketLogVolumes := []corev1.Volume{{
534+
Name: r.BucketLoggingVolume,
535+
VolumeSource: corev1.VolumeSource{
536+
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
537+
ClaimName: r.BucketLoggingPVC.Name,
538+
},
539+
},
540+
}}
541+
util.MergeVolumeList(&podSpec.Volumes, &bucketLogVolumes)
542+
543+
bucketLogVolumeMounts := []corev1.VolumeMount{{
544+
Name: r.BucketLoggingVolume,
545+
MountPath: r.BucketLoggingVolumeMount,
546+
}}
547+
util.MergeVolumeMountList(&container.VolumeMounts, &bucketLogVolumeMounts)
548+
}
549+
529550
r.setDesiredRootMasterKeyMounts(podSpec, container)
530551

531552
for _, nsStore := range namespaceStoreList.Items {

pkg/system/reconciler.go

+6
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ type Reconciler struct {
102102
DefaultNsfsPvc *corev1.PersistentVolumeClaim
103103
OBCStorageClass *storagev1.StorageClass
104104
BucketLoggingPVC *corev1.PersistentVolumeClaim
105+
BucketLoggingVolume string
106+
BucketLoggingVolumeMount string
105107
PrometheusRule *monitoringv1.PrometheusRule
106108
ServiceMonitorMgmt *monitoringv1.ServiceMonitor
107109
ServiceMonitorS3 *monitoringv1.ServiceMonitor
@@ -295,6 +297,10 @@ func NewReconciler(
295297
// Setting default AWS STS cluster as false
296298
r.IsAWSSTSCluster = false
297299

300+
// Set bucket logging volume mount name and path
301+
r.BucketLoggingVolume = r.Request.Name + "-bucket-logging-volume"
302+
r.BucketLoggingVolumeMount = "etc/logs/bucket-logs"
303+
298304
r.DefaultCoreApp = r.CoreApp.Spec.Template.Spec.Containers[0].DeepCopy()
299305
r.DefaultDeploymentEndpoint = r.DeploymentEndpoint.Spec.Template.Spec.DeepCopy()
300306

0 commit comments

Comments
 (0)