github.com/kubewharf/katalyst-core@v0.5.3/pkg/config/config.go (about)

     1  /*
     2  Copyright 2022 The Katalyst 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 config is the package that contains those important configurations
    18  // for all running components, including Manager, eviction manager and external
    19  // controller.
    20  package config // import "github.com/kubewharf/katalyst-core/pkg/config"
    21  
    22  import (
    23  	"github.com/kubewharf/katalyst-core/pkg/config/agent"
    24  	"github.com/kubewharf/katalyst-core/pkg/config/controller"
    25  	"github.com/kubewharf/katalyst-core/pkg/config/generic"
    26  	"github.com/kubewharf/katalyst-core/pkg/config/metric"
    27  	"github.com/kubewharf/katalyst-core/pkg/config/webhook"
    28  )
    29  
    30  // Configuration stores all the configurations needed by core katalyst components,
    31  // both for static config (only support to be modified by flag) and dynamic config
    32  type Configuration struct {
    33  	// those configurations for multi components
    34  	*generic.GenericConfiguration
    35  
    36  	// those configurations are used by controllers
    37  	*webhook.GenericWebhookConfiguration
    38  	*webhook.WebhooksConfiguration
    39  
    40  	// those configurations are used by controllers
    41  	*controller.GenericControllerConfiguration
    42  	*controller.ControllersConfiguration
    43  
    44  	// those configurations are used by metric
    45  	*metric.GenericMetricConfiguration
    46  	*metric.CustomMetricConfiguration
    47  
    48  	*agent.AgentConfiguration
    49  }
    50  
    51  func NewConfiguration() *Configuration {
    52  	return &Configuration{
    53  		GenericConfiguration:           generic.NewGenericConfiguration(),
    54  		GenericWebhookConfiguration:    webhook.NewGenericWebhookConfiguration(),
    55  		WebhooksConfiguration:          webhook.NewWebhooksConfiguration(),
    56  		GenericControllerConfiguration: controller.NewGenericControllerConfiguration(),
    57  		ControllersConfiguration:       controller.NewControllersConfiguration(),
    58  		GenericMetricConfiguration:     metric.NewGenericMetricConfiguration(),
    59  		CustomMetricConfiguration:      metric.NewCustomMetricConfiguration(),
    60  		AgentConfiguration:             agent.NewAgentConfiguration(),
    61  	}
    62  }