diff --git a/.chainsaw.yaml b/.chainsaw.yaml index 53f95aa..b6a97d8 100644 --- a/.chainsaw.yaml +++ b/.chainsaw.yaml @@ -6,12 +6,12 @@ spec: # namespace: chainsaw timeouts: apply: 300s - assert: 300s + assert: 600s cleanup: 120s delete: 120s error: 180s exec: 300s - # skipDelete: false + # skipDelete: true failFast: true forceTerminationGracePeriod: 10s parallel: 1 diff --git a/api/v1alpha1/master_types.go b/api/v1alpha1/master_types.go index 1a3ff9a..c08c46c 100644 --- a/api/v1alpha1/master_types.go +++ b/api/v1alpha1/master_types.go @@ -43,7 +43,7 @@ type MasterConfigSpec struct { GracefulShutdownTimeout *string `json:"gracefulShutdownTimeout,omitempty"` // +kubebuilder:validation:Optional - Logging *commonsv1alpha1.LoggingConfigSpec `json:"logging,omitempty"` + Logging *LoggingSpec `json:"logging,omitempty"` // +kubebuilder:validation:Optional Resources *commonsv1alpha1.ResourcesSpec `json:"resources,omitempty"` diff --git a/api/v1alpha1/productlogging.go b/api/v1alpha1/productlogging.go new file mode 100644 index 0000000..c444bc4 --- /dev/null +++ b/api/v1alpha1/productlogging.go @@ -0,0 +1,10 @@ +package v1alpha1 + +import commonsv1alpha1 "github.com/zncdatadev/operator-go/pkg/apis/commons/v1alpha1" + +type LoggingSpec struct { + // +kubebuilder:validation:Optional + EnableVectorAgent bool `json:"enableVectorAgent,omitempty"` + // +kubebuilder:validation:Optional + Containers map[string]*commonsv1alpha1.LoggingConfigSpec `json:"containers,omitempty"` +} diff --git a/api/v1alpha1/regionserver_types.go b/api/v1alpha1/regionserver_types.go index 4d1ff45..9901d01 100644 --- a/api/v1alpha1/regionserver_types.go +++ b/api/v1alpha1/regionserver_types.go @@ -42,7 +42,7 @@ type RegionConfigSpec struct { GracefulShutdownTimeout *string `json:"gracefulShutdownTimeout,omitempty"` // +kubebuilder:validation:Optional - Logging *commonsv1alpha1.LoggingConfigSpec `json:"logging,omitempty"` + Logging *LoggingSpec `json:"logging,omitempty"` // +kubebuilder:validation:Optional Resources *commonsv1alpha1.ResourcesSpec `json:"resources,omitempty"` diff --git a/api/v1alpha1/restserver_types.go b/api/v1alpha1/restserver_types.go index 19effbf..bc29a71 100644 --- a/api/v1alpha1/restserver_types.go +++ b/api/v1alpha1/restserver_types.go @@ -43,7 +43,7 @@ type RestServerConfigSpec struct { GracefulShutdownTimeout *string `json:"gracefulShutdownTimeout,omitempty"` // +kubebuilder:validation:Optional - Logging *commonsv1alpha1.LoggingConfigSpec `json:"logging,omitempty"` + Logging *LoggingSpec `json:"logging,omitempty"` // +kubebuilder:validation:Optional Resources *commonsv1alpha1.ResourcesSpec `json:"resources,omitempty"` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 4a56ac0..271bf88 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -223,6 +223,37 @@ func (in *ImageSpec) DeepCopy() *ImageSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoggingSpec) DeepCopyInto(out *LoggingSpec) { + *out = *in + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make(map[string]*commonsv1alpha1.LoggingConfigSpec, len(*in)) + for key, val := range *in { + var outVal *commonsv1alpha1.LoggingConfigSpec + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(commonsv1alpha1.LoggingConfigSpec) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingSpec. +func (in *LoggingSpec) DeepCopy() *LoggingSpec { + if in == nil { + return nil + } + out := new(LoggingSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MasterConfigOverrideSpec) DeepCopyInto(out *MasterConfigOverrideSpec) { *out = *in @@ -265,7 +296,7 @@ func (in *MasterConfigSpec) DeepCopyInto(out *MasterConfigSpec) { } if in.Logging != nil { in, out := &in.Logging, &out.Logging - *out = new(commonsv1alpha1.LoggingConfigSpec) + *out = new(LoggingSpec) (*in).DeepCopyInto(*out) } if in.Resources != nil { @@ -448,7 +479,7 @@ func (in *RegionConfigSpec) DeepCopyInto(out *RegionConfigSpec) { } if in.Logging != nil { in, out := &in.Logging, &out.Logging - *out = new(commonsv1alpha1.LoggingConfigSpec) + *out = new(LoggingSpec) (*in).DeepCopyInto(*out) } if in.Resources != nil { @@ -611,7 +642,7 @@ func (in *RestServerConfigSpec) DeepCopyInto(out *RestServerConfigSpec) { } if in.Logging != nil { in, out := &in.Logging, &out.Logging - *out = new(commonsv1alpha1.LoggingConfigSpec) + *out = new(LoggingSpec) (*in).DeepCopyInto(*out) } if in.Resources != nil { diff --git a/config/crd/bases/hbase.zncdata.dev_hbaseclusters.yaml b/config/crd/bases/hbase.zncdata.dev_hbaseclusters.yaml index 6a35078..296ae88 100644 --- a/config/crd/bases/hbase.zncdata.dev_hbaseclusters.yaml +++ b/config/crd/bases/hbase.zncdata.dev_hbaseclusters.yaml @@ -1056,89 +1056,96 @@ spec: type: string logging: properties: - console: - description: |- - LogLevelSpec - level mapping example: + containers: + additionalProperties: + properties: + console: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - file: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + file: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - loggers: - additionalProperties: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + loggers: + additionalProperties: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + type: object type: object type: object + enableVectorAgent: + type: boolean type: object podDisruptionBudget: properties: @@ -2199,89 +2206,96 @@ spec: type: string logging: properties: - console: - description: |- - LogLevelSpec - level mapping example: + containers: + additionalProperties: + properties: + console: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - file: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + file: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - loggers: - additionalProperties: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + loggers: + additionalProperties: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + type: object type: object type: object + enableVectorAgent: + type: boolean type: object podDisruptionBudget: properties: @@ -11496,89 +11510,96 @@ spec: type: string logging: properties: - console: - description: |- - LogLevelSpec - level mapping example: + containers: + additionalProperties: + properties: + console: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - file: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + file: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - loggers: - additionalProperties: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + loggers: + additionalProperties: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + type: object type: object type: object + enableVectorAgent: + type: boolean type: object podDisruptionBudget: properties: @@ -12614,114 +12635,121 @@ spec: namespaces specifies a static list of namespace names that the term applies to. The term is applied to the union of the namespaces listed in this field and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - x-kubernetes-list-type: atomic - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - x-kubernetes-list-type: atomic - type: object - type: object - gracefulShutdownTimeout: - description: Use time.ParseDuration to parse the string - type: string - logging: - properties: - console: - description: |- - LogLevelSpec - level mapping example: - - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - file: - description: |- - LogLevelSpec - level mapping example: - - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic type: object - loggers: + type: object + gracefulShutdownTimeout: + description: Use time.ParseDuration to parse the string + type: string + logging: + properties: + containers: additionalProperties: - description: |- - LogLevelSpec - level mapping example: - - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string + console: + description: |- + LogLevelSpec + level mapping example: + + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + file: + description: |- + LogLevelSpec + level mapping example: + + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + loggers: + additionalProperties: + description: |- + LogLevelSpec + level mapping example: + + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + type: object type: object type: object + enableVectorAgent: + type: boolean type: object podDisruptionBudget: properties: @@ -21934,89 +21962,96 @@ spec: type: string logging: properties: - console: - description: |- - LogLevelSpec - level mapping example: + containers: + additionalProperties: + properties: + console: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - file: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + file: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - loggers: - additionalProperties: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + loggers: + additionalProperties: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + type: object type: object type: object + enableVectorAgent: + type: boolean type: object podDisruptionBudget: properties: @@ -23077,89 +23112,96 @@ spec: type: string logging: properties: - console: - description: |- - LogLevelSpec - level mapping example: + containers: + additionalProperties: + properties: + console: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - file: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + file: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string - type: object - loggers: - additionalProperties: - description: |- - LogLevelSpec - level mapping example: + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + loggers: + additionalProperties: + description: |- + LogLevelSpec + level mapping example: - |---------------------|-----------------| - | App log level | kds log level | - |---------------------|-----------------| - | CRITICAL | FATAL | - | ERROR | ERROR | - | WARNING | WARN | - | INFO | INFO | - | DEBUG | DEBUG | - | DEBUG | TRACE | - |---------------------|-----------------| - properties: - level: - default: INFO - enum: - - FATAL - - ERROR - - WARN - - INFO - - DEBUG - - TRACE - type: string + |---------------------|-----------------| + | App log level | kds log level | + |---------------------|-----------------| + | CRITICAL | FATAL | + | ERROR | ERROR | + | WARNING | WARN | + | INFO | INFO | + | DEBUG | DEBUG | + | DEBUG | TRACE | + |---------------------|-----------------| + properties: + level: + default: INFO + enum: + - FATAL + - ERROR + - WARN + - INFO + - DEBUG + - TRACE + type: string + type: object + type: object type: object type: object + enableVectorAgent: + type: boolean type: object podDisruptionBudget: properties: diff --git a/internal/controller/common/configmap.go b/internal/controller/common/configmap.go index f9c5143..c382ffb 100644 --- a/internal/controller/common/configmap.go +++ b/internal/controller/common/configmap.go @@ -3,15 +3,16 @@ package common import ( "context" "fmt" - "path" "strings" corev1 "k8s.io/api/core/v1" ctrl "sigs.k8s.io/controller-runtime" + commonsv1alpha1 "github.com/zncdatadev/operator-go/pkg/apis/commons/v1alpha1" "github.com/zncdatadev/operator-go/pkg/builder" "github.com/zncdatadev/operator-go/pkg/client" "github.com/zncdatadev/operator-go/pkg/config/xml" + "github.com/zncdatadev/operator-go/pkg/productlogging" "github.com/zncdatadev/operator-go/pkg/reconciler" "github.com/zncdatadev/operator-go/pkg/util" @@ -35,6 +36,9 @@ var _ builder.ConfigBuilder = &ConfigMapBuilder{} type ConfigMapBuilder struct { builder.ConfigMapBuilder + LoggingConfig *commonsv1alpha1.LoggingConfigSpec + VectorConfigMapName string + ClusterName string RoleName string RolegroupName string @@ -45,6 +49,8 @@ type ConfigMapBuilder struct { func NewConfigMapBuilder( client *client.Client, name string, + loggingConfig *commonsv1alpha1.LoggingConfigSpec, + vectorConfigMapName string, krb5SecretClass string, tlsSecretClass string, options builder.Options, @@ -69,10 +75,12 @@ func NewConfigMapBuilder( options.Labels, options.Annotations, ), - ClusterName: options.ClusterName, - RoleName: options.RoleName, - RolegroupName: options.RoleGroupName, - krb5Config: krb5Config, + ClusterName: options.ClusterName, + RoleName: options.RoleName, + RolegroupName: options.RoleGroupName, + krb5Config: krb5Config, + LoggingConfig: loggingConfig, + VectorConfigMapName: vectorConfigMapName, } } @@ -103,26 +111,17 @@ func (b *ConfigMapBuilder) getJVMOPTS() string { return fmt.Sprintf(`export HBASE_%s_OPTS="$HBASE_OPTS %s"`, b.RoleName, strings.Join(opts, " ")) } -func (b *ConfigMapBuilder) AddLog4jProperties() error { - log4j := ` -log4j.rootLogger=INFO, CONSOLE, FILE - -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.Threshold=INFO -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2}: %.1000m%n - -log4j.appender.FILE=org.apache.log4j.RollingFileAppender -log4j.appender.FILE.Threshold=INFO -log4j.appender.FILE.File=` + path.Join(HBaseConfigDir, "hbase.log4j.xml") + ` -log4j.appender.FILE.MaxFileSize=5MB -log4j.appender.FILE.MaxBackupIndex=1 -log4j.appender.FILE.layout=org.apache.log4j.xml.XMLLayout - -` - b.AddData(map[string]string{LogKey: util.IndentTab4Spaces(log4j)}) - logger.V(15).Info("Log4j", "log4j", log4j, "clusterName", b.ClusterName, "roleName", b.RoleName, "roleGroupName", b.RolegroupName) - return nil +func (b *ConfigMapBuilder) AddLog4jProperties() { + l := productlogging.NewLog4jConfigGenerator( + b.LoggingConfig, + b.RoleName, + "%d{ISO8601} %-5p [%t] %c{2}: %.1000m%n", + nil, + "hbase.log4j.xml", + "", + ) + s := l.Generate() + b.AddItem(LogKey, s) } func (b *ConfigMapBuilder) AddSSLClientXML() error { @@ -191,6 +190,27 @@ func (b *ConfigMapBuilder) AddHbaseSite(znode *ZnodeConfiguration) error { return nil } +func (b *ConfigMapBuilder) AddVectorConfig(ctx context.Context) error { + if b.VectorConfigMapName == "" { + return nil + } + s, err := productlogging.MakeVectorYaml( + ctx, + b.Client.Client, + b.Client.GetOwnerNamespace(), + b.ClusterName, + b.RoleName, + b.RolegroupName, + b.VectorConfigMapName, + ) + if err != nil { + return err + } + + b.AddItem(builder.VectorConfigFile, s) + return nil +} + var _ reconciler.ResourceReconciler[*ConfigMapBuilder] = &ConfigMapReconciler[reconciler.AnySpec]{} type ConfigMapReconciler[T reconciler.AnySpec] struct { @@ -224,9 +244,7 @@ func (r *ConfigMapReconciler[T]) Reconcile(ctx context.Context) (ctrl.Result, er return ctrl.Result{}, err } - if err := builder.AddLog4jProperties(); err != nil { - return ctrl.Result{}, err - } + builder.AddLog4jProperties() if err := builder.AddSSLClientXML(); err != nil { return ctrl.Result{}, err @@ -236,6 +254,10 @@ func (r *ConfigMapReconciler[T]) Reconcile(ctx context.Context) (ctrl.Result, er return ctrl.Result{}, err } + if err := builder.AddVectorConfig(ctx); err != nil { + return ctrl.Result{}, err + } + resource, err := builder.Build(ctx) if err != nil { @@ -248,6 +270,7 @@ func (r *ConfigMapReconciler[T]) Reconcile(ctx context.Context) (ctrl.Result, er func NewConfigMapReconciler[T reconciler.AnySpec]( client *client.Client, clusterConfig *hbasev1alph1.ClusterConfigSpec, + loggingConfig *commonsv1alpha1.LoggingConfigSpec, options reconciler.RoleGroupInfo, spec T, ) *ConfigMapReconciler[T] { @@ -261,6 +284,8 @@ func NewConfigMapReconciler[T reconciler.AnySpec]( cmBuilder := NewConfigMapBuilder( client, options.GetFullName(), + loggingConfig, + clusterConfig.VectorAggregatorConfigMapName, krb5SecretClass, tlsSecretClass, builder.Options{ diff --git a/internal/controller/common/statefulset.go b/internal/controller/common/statefulset.go index 1a6ced4..7742333 100644 --- a/internal/controller/common/statefulset.go +++ b/internal/controller/common/statefulset.go @@ -29,6 +29,9 @@ var ( HDFSConfigDir = path.Join(constants.KubedoopConfigDir) HBaseMountConfigDir = path.Join(constants.KubedoopConfigDirMount, "hbase") HDFSMountConfigDir = path.Join(constants.KubedoopConfigDirMount, "hdfs") + + HHbaseConfigVolumeName = "hbase-config" + HbaseLogVolumeName = "log" ) var _ builder.StatefulSetBuilder = &StatefulSetBuilder{} @@ -343,7 +346,25 @@ func (b *StatefulSetBuilder) Build(ctx context.Context) (ctrlclient.Object, erro b.AddContainer(oidcContainer) } - return b.GetObject() + obj, err := b.GetObject() + if err != nil { + return nil, err + } + + if b.ClusterConfig.VectorAggregatorConfigMapName != "" { + d := builder.NewVectorDecorator( + obj, + b.GetImage(), + HbaseLogVolumeName, + HHbaseConfigVolumeName, + b.ClusterConfig.VectorAggregatorConfigMapName, + ) + if err := d.Decorate(); err != nil { + return nil, err + } + } + + return obj, nil } var _ reconciler.Reconciler = &StatefulSetReconciler{} diff --git a/internal/controller/master/role.go b/internal/controller/master/role.go index a9efba9..2ac4e43 100644 --- a/internal/controller/master/role.go +++ b/internal/controller/master/role.go @@ -4,13 +4,15 @@ import ( "context" "time" - hbasev1alph1 "github.com/zncdatadev/hbase-operator/api/v1alpha1" - "github.com/zncdatadev/hbase-operator/internal/controller/common" + commonsv1alpha1 "github.com/zncdatadev/operator-go/pkg/apis/commons/v1alpha1" "github.com/zncdatadev/operator-go/pkg/builder" "github.com/zncdatadev/operator-go/pkg/client" "github.com/zncdatadev/operator-go/pkg/reconciler" "github.com/zncdatadev/operator-go/pkg/util" ctrl "sigs.k8s.io/controller-runtime" + + hbasev1alph1 "github.com/zncdatadev/hbase-operator/api/v1alpha1" + "github.com/zncdatadev/hbase-operator/internal/controller/common" ) var ( @@ -72,6 +74,11 @@ func (r *Reconciler) RegisterResources(ctx context.Context) error { func (r *Reconciler) RegisterResourceWithRoleGroup(_ context.Context, info reconciler.RoleGroupInfo, roleGroupSpec any) ([]reconciler.Reconciler, error) { spec := roleGroupSpec.(*hbasev1alph1.MasterRoleGroupSpec) var reconcilers []reconciler.Reconciler + var loggingConfig *commonsv1alpha1.LoggingConfigSpec + + if spec.Config != nil && spec.Config.Logging != nil { + loggingConfig = spec.Config.Logging.Containers[info.RoleName] + } options := builder.WorkloadOptions{ Options: builder.Options{ @@ -137,6 +144,7 @@ func (r *Reconciler) RegisterResourceWithRoleGroup(_ context.Context, info recon configMapReconciler := common.NewConfigMapReconciler( r.GetClient(), r.ClusterConfig, + loggingConfig, info, roleGroupSpec.(*hbasev1alph1.MasterRoleGroupSpec), ) diff --git a/internal/controller/regionserver/role.go b/internal/controller/regionserver/role.go index fdb5d1b..0bcfa15 100644 --- a/internal/controller/regionserver/role.go +++ b/internal/controller/regionserver/role.go @@ -4,13 +4,15 @@ import ( "context" "time" - hbasev1alph1 "github.com/zncdatadev/hbase-operator/api/v1alpha1" - "github.com/zncdatadev/hbase-operator/internal/controller/common" + commonsv1alpha1 "github.com/zncdatadev/operator-go/pkg/apis/commons/v1alpha1" "github.com/zncdatadev/operator-go/pkg/builder" "github.com/zncdatadev/operator-go/pkg/client" "github.com/zncdatadev/operator-go/pkg/reconciler" "github.com/zncdatadev/operator-go/pkg/util" ctrl "sigs.k8s.io/controller-runtime" + + hbasev1alph1 "github.com/zncdatadev/hbase-operator/api/v1alpha1" + "github.com/zncdatadev/hbase-operator/internal/controller/common" ) var ( @@ -73,6 +75,11 @@ func (r *Reconciler) RegisterResources(ctx context.Context) error { func (r *Reconciler) RegisterResourceWithRoleGroup(_ context.Context, info reconciler.RoleGroupInfo, roleGroupSpec any) ([]reconciler.Reconciler, error) { spec := roleGroupSpec.(*hbasev1alph1.RegionServerRoleGroupSpec) var reconcilers []reconciler.Reconciler + var loggingConfig *commonsv1alpha1.LoggingConfigSpec + + if spec.Config != nil && spec.Config.Logging != nil { + loggingConfig = spec.Config.Logging.Containers[info.RoleName] + } options := builder.WorkloadOptions{ Options: builder.Options{ @@ -138,6 +145,7 @@ func (r *Reconciler) RegisterResourceWithRoleGroup(_ context.Context, info recon configMapReconciler := common.NewConfigMapReconciler( r.GetClient(), r.ClusterConfig, + loggingConfig, info, roleGroupSpec.(*hbasev1alph1.RegionServerRoleGroupSpec), ) diff --git a/internal/controller/restserver/role.go b/internal/controller/restserver/role.go index b1e2dc3..3da0f84 100644 --- a/internal/controller/restserver/role.go +++ b/internal/controller/restserver/role.go @@ -4,13 +4,15 @@ import ( "context" "time" - hbasev1alph1 "github.com/zncdatadev/hbase-operator/api/v1alpha1" - "github.com/zncdatadev/hbase-operator/internal/controller/common" + commonsv1alpha1 "github.com/zncdatadev/operator-go/pkg/apis/commons/v1alpha1" "github.com/zncdatadev/operator-go/pkg/builder" "github.com/zncdatadev/operator-go/pkg/client" "github.com/zncdatadev/operator-go/pkg/reconciler" "github.com/zncdatadev/operator-go/pkg/util" ctrl "sigs.k8s.io/controller-runtime" + + hbasev1alph1 "github.com/zncdatadev/hbase-operator/api/v1alpha1" + "github.com/zncdatadev/hbase-operator/internal/controller/common" ) var ( @@ -72,6 +74,11 @@ func (r *Reconciler) RegisterResources(ctx context.Context) error { func (r *Reconciler) RegisterResourceWithRoleGroup(_ context.Context, info reconciler.RoleGroupInfo, roleGroupSpec any) ([]reconciler.Reconciler, error) { spec := roleGroupSpec.(*hbasev1alph1.RestServerRoleGroupSpec) var reconcilers []reconciler.Reconciler + var loggingConfig *commonsv1alpha1.LoggingConfigSpec + + if spec.Config != nil && spec.Config.Logging != nil { + loggingConfig = spec.Config.Logging.Containers[info.RoleName] + } options := builder.WorkloadOptions{ Options: builder.Options{ @@ -137,6 +144,7 @@ func (r *Reconciler) RegisterResourceWithRoleGroup(_ context.Context, info recon configMapReconciler := common.NewConfigMapReconciler( r.GetClient(), r.ClusterConfig, + loggingConfig, info, roleGroupSpec.(*hbasev1alph1.RestServerRoleGroupSpec), ) diff --git a/test/e2e/kerberos/chainsaw-test.yaml b/test/e2e/kerberos/chainsaw-test.yaml index aa27c1f..38a6f34 100644 --- a/test/e2e/kerberos/chainsaw-test.yaml +++ b/test/e2e/kerberos/chainsaw-test.yaml @@ -168,3 +168,6 @@ spec: - podLogs: selector: app.kubernetes.io/instance=krb5-hbase tail: -1 + - podLogs: + selector: app.kubenetes.io/name=secret-csi + tail: -1