k8c.io/api/v3@v3.0.0-20230904060738-b0a93889c0b6/pkg/apis/ee.kubermatic/v1/audit_logging.go (about)

     1  /*
     2  Copyright 2023 The Kubermatic Kubernetes Platform contributors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1
    18  
    19  import (
    20  	corev1 "k8s.io/api/core/v1"
    21  )
    22  
    23  // +kubebuilder:validation:Enum=metadata;recommended;minimal
    24  
    25  // AuditPolicyPreset refers to a pre-defined set of audit policy rules. Supported values
    26  // are `metadata`, `recommended` and `minimal`. See KKP documentation for what each policy preset includes.
    27  type AuditPolicyPreset string
    28  
    29  const (
    30  	AuditPolicyMetadata    AuditPolicyPreset = "metadata"
    31  	AuditPolicyRecommended AuditPolicyPreset = "recommended"
    32  	AuditPolicyMinimal     AuditPolicyPreset = "minimal"
    33  )
    34  
    35  // AuditLoggingSettings configures audit logging functionality.
    36  type AuditLoggingSettings struct {
    37  	// Enabled will enable or disable audit logging.
    38  	Enabled bool `json:"enabled,omitempty"`
    39  	// Optional: PolicyPreset can be set to utilize a pre-defined set of audit policy rules.
    40  	PolicyPreset AuditPolicyPreset `json:"policyPreset,omitempty"`
    41  	// Optional: Configures the fluent-bit sidecar deployed alongside kube-apiserver.
    42  	SidecarSettings *AuditSidecarSettings `json:"sidecar,omitempty"`
    43  }
    44  
    45  type AuditSidecarSettings struct {
    46  	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
    47  	Config    *AuditSidecarConfiguration   `json:"config,omitempty"`
    48  }
    49  
    50  // AuditSidecarConfiguration defines custom configuration for the fluent-bit sidecar deployed with a kube-apiserver.
    51  // Also see https://docs.fluentbit.io/manual/v/1.8/administration/configuring-fluent-bit/configuration-file.
    52  type AuditSidecarConfiguration struct {
    53  	Service map[string]string   `json:"service,omitempty"`
    54  	Filters []map[string]string `json:"filters,omitempty"`
    55  	Outputs []map[string]string `json:"outputs,omitempty"`
    56  }