From cd58b2c7b070b633a8fe5eaf87d51609b632c19f Mon Sep 17 00:00:00 2001 From: Aayush Chouhan Date: Tue, 21 May 2024 18:52:22 +0530 Subject: [PATCH] Added BucketLogging type to enable different types of bucket logging Signed-off-by: Aayush Chouhan --- deploy/crds/noobaa.io_noobaas.yaml | 16 ++++++++++ pkg/apis/noobaa/v1alpha1/noobaa_types.go | 31 +++++++++++++++++++ .../noobaa/v1alpha1/zz_generated.deepcopy.go | 22 +++++++++++++ pkg/bundle/deploy.go | 18 ++++++++++- 4 files changed, 86 insertions(+), 1 deletion(-) diff --git a/deploy/crds/noobaa.io_noobaas.yaml b/deploy/crds/noobaa.io_noobaas.yaml index 1068aaef9..643921950 100644 --- a/deploy/crds/noobaa.io_noobaas.yaml +++ b/deploy/crds/noobaa.io_noobaas.yaml @@ -976,6 +976,22 @@ spec: description: Prometheus namespace that scrap metrics from noobaa type: string type: object + bucketLogging: + description: BucketLogging sets the configuration for bucket logging + properties: + bucketLoggingStorageClass: + description: |- + BucketLoggingStorageClass (optional) specifies the type of storage class that will be used to create a + PVC(Persistent Volume Claim) for guaranteed logging, if enabled. + type: string + loggingType: + description: |- + LoggingType specifies the type of logging for the bucket + There are two types available: best-effort and guaranteed logging + - best-effort(default) - less immune to failures but with better performance + - guaranteed - much more reliable but need to provide a storage class that supports RWX PVs + type: string + type: object cleanupPolicy: description: CleanupPolicy (optional) Indicates user's policy for deletion diff --git a/pkg/apis/noobaa/v1alpha1/noobaa_types.go b/pkg/apis/noobaa/v1alpha1/noobaa_types.go index 92e11460c..09e558357 100644 --- a/pkg/apis/noobaa/v1alpha1/noobaa_types.go +++ b/pkg/apis/noobaa/v1alpha1/noobaa_types.go @@ -223,6 +223,10 @@ type NooBaaSpec struct { // DenyHTTP (optional) if given will deny access to the NooBaa S3 service using HTTP (only HTTPS) // +optional DenyHTTP bool `json:"denyHTTP,omitempty"` + + // BucketLogging sets the configuration for bucket logging + // +optional + BucketLogging BucketLoggingSpec `json:"bucketLogging,omitempty"` } // AutoscalerSpec defines different actoscaling spec such as autoscaler type and prometheus namespace @@ -237,6 +241,21 @@ type AutoscalerSpec struct { PrometheusNamespace string `json:"prometheusNamespace,omitempty"` } +// BucketLoggingSpec defines the bucket logging configuration +type BucketLoggingSpec struct { + // LoggingType specifies the type of logging for the bucket + // There are two types available: best-effort and guaranteed logging + // - best-effort(default) - less immune to failures but with better performance + // - guaranteed - much more reliable but need to provide a storage class that supports RWX PVs + // +optional + LoggingType BucketLoggingTypes `json:"loggingType,omitempty"` + + // BucketLoggingStorageClass (optional) specifies the type of storage class that will be used to create a + // PVC(Persistent Volume Claim) for guaranteed logging, if enabled. + // +optional + BucketLoggingStorageClass *string `json:"bucketLoggingStorageClass,omitempty"` +} + // LoadBalancerSourceSubnetSpec defines the subnets that will be allowed to access the NooBaa services type LoadBalancerSourceSubnetSpec struct { // S3 is a list of subnets that will be allowed to access the Noobaa S3 service @@ -539,3 +558,15 @@ const ( // AutoscalerTypeHPAV2 is hpav2 AutoscalerTypeHPAV2 AutoscalerTypes = "hpav2" ) + +// BucketLoggingTypes is a string enum type for specifying the types of bucketlogging supported. +type BucketLoggingTypes string + +// These are the valid BucketLoggingTypes types: +const ( + // BucketLoggingTypeBestEffort is best-effort + BucketLoggingTypeBestEffort BucketLoggingTypes = "best-effort" + + // BucketLoggingTypeGuaranteed is guaranteed + BucketLoggingTypeGuaranteed BucketLoggingTypes = "guaranteed" +) diff --git a/pkg/apis/noobaa/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/noobaa/v1alpha1/zz_generated.deepcopy.go index 33327bf44..e7da65889 100644 --- a/pkg/apis/noobaa/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/noobaa/v1alpha1/zz_generated.deepcopy.go @@ -439,6 +439,27 @@ func (in *BucketClassStatus) DeepCopy() *BucketClassStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BucketLoggingSpec) DeepCopyInto(out *BucketLoggingSpec) { + *out = *in + if in.BucketLoggingStorageClass != nil { + in, out := &in.BucketLoggingStorageClass, &out.BucketLoggingStorageClass + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BucketLoggingSpec. +func (in *BucketLoggingSpec) DeepCopy() *BucketLoggingSpec { + if in == nil { + return nil + } + out := new(BucketLoggingSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CacheNamespacePolicy) DeepCopyInto(out *CacheNamespacePolicy) { *out = *in @@ -1205,6 +1226,7 @@ func (in *NooBaaSpec) DeepCopyInto(out *NooBaaSpec) { } in.LoadBalancerSourceSubnets.DeepCopyInto(&out.LoadBalancerSourceSubnets) out.Autoscaler = in.Autoscaler + in.BucketLogging.DeepCopyInto(&out.BucketLogging) return } diff --git a/pkg/bundle/deploy.go b/pkg/bundle/deploy.go index 558a612e6..0d4068417 100644 --- a/pkg/bundle/deploy.go +++ b/pkg/bundle/deploy.go @@ -1483,7 +1483,7 @@ spec: status: {} ` -const Sha256_deploy_crds_noobaa_io_noobaas_yaml = "0c697107c4b9d4781dfff92f8e29a95ed22d26c43b8208f39daea0a6674672df" +const Sha256_deploy_crds_noobaa_io_noobaas_yaml = "9fc4f547417125d6ad6246a27690a88fbbb054ffb7e318ed7cf9e21ca2c707ef" const File_deploy_crds_noobaa_io_noobaas_yaml = `--- apiVersion: apiextensions.k8s.io/v1 @@ -2463,6 +2463,22 @@ spec: description: Prometheus namespace that scrap metrics from noobaa type: string type: object + bucketLogging: + description: BucketLogging sets the configuration for bucket logging + properties: + bucketLoggingStorageClass: + description: |- + BucketLoggingStorageClass (optional) specifies the type of storage class that will be used to create a + PVC(Persistent Volume Claim) for guaranteed logging, if enabled. + type: string + loggingType: + description: |- + LoggingType specifies the type of logging for the bucket + There are two types available: best-effort and guaranteed logging + - best-effort(default) - less immune to failures but with better performance + - guaranteed - much more reliable but need to provide a storage class that supports RWX PVs + type: string + type: object cleanupPolicy: description: CleanupPolicy (optional) Indicates user's policy for deletion