...

Source file src/k8s.io/component-base/logs/api/v1/kube_features.go

Documentation: k8s.io/component-base/logs/api/v1

     1  /*
     2  Copyright 2022 The Kubernetes Authors.
     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  	"k8s.io/component-base/featuregate"
    21  )
    22  
    23  const (
    24  	// owner: @pohly
    25  	// kep: https://kep.k8s.io/3077
    26  	// alpha: v1.24
    27  	// beta: v1.30
    28  	//
    29  	// Enables looking up a logger from a context.Context instead of using
    30  	// the global fallback logger and manipulating the logger that is
    31  	// used by a call chain.
    32  	ContextualLogging featuregate.Feature = "ContextualLogging"
    33  
    34  	// contextualLoggingDefault is now true because the feature reached beta
    35  	// and performance comparisons showed no relevant degradation when
    36  	// enabling it.
    37  	contextualLoggingDefault = true
    38  
    39  	// Allow fine-tuning of experimental, alpha-quality logging options.
    40  	//
    41  	// Per https://groups.google.com/g/kubernetes-sig-architecture/c/Nxsc7pfe5rw/m/vF2djJh0BAAJ
    42  	// we want to avoid a proliferation of feature gates. This feature gate:
    43  	// - will guard *a group* of logging options whose quality level is alpha.
    44  	// - will never graduate to beta or stable.
    45  	LoggingAlphaOptions featuregate.Feature = "LoggingAlphaOptions"
    46  
    47  	// Allow fine-tuning of experimental, beta-quality logging options.
    48  	//
    49  	// Per https://groups.google.com/g/kubernetes-sig-architecture/c/Nxsc7pfe5rw/m/vF2djJh0BAAJ
    50  	// we want to avoid a proliferation of feature gates. This feature gate:
    51  	// - will guard *a group* of logging options whose quality level is beta.
    52  	// - is thus *introduced* as beta
    53  	// - will never graduate to stable.
    54  	LoggingBetaOptions featuregate.Feature = "LoggingBetaOptions"
    55  
    56  	// Stable logging options. Always enabled.
    57  	LoggingStableOptions featuregate.Feature = "LoggingStableOptions"
    58  )
    59  
    60  func featureGates() map[featuregate.Feature]featuregate.FeatureSpec {
    61  	return map[featuregate.Feature]featuregate.FeatureSpec{
    62  		ContextualLogging: {Default: contextualLoggingDefault, PreRelease: featuregate.Beta},
    63  
    64  		LoggingAlphaOptions: {Default: false, PreRelease: featuregate.Alpha},
    65  		LoggingBetaOptions:  {Default: true, PreRelease: featuregate.Beta},
    66  	}
    67  }
    68  
    69  // AddFeatureGates adds all feature gates used by this package.
    70  func AddFeatureGates(mutableFeatureGate featuregate.MutableFeatureGate) error {
    71  	return mutableFeatureGate.Add(featureGates())
    72  }
    73  

View as plain text