github.com/kubewharf/katalyst-core@v0.5.3/pkg/config/webhook/webhook_base.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 webhook
    18  
    19  import (
    20  	"k8s.io/apiserver/pkg/server"
    21  )
    22  
    23  type GenericWebhookConfiguration struct {
    24  	// Webhooks is the list of webhooks to enable or disable
    25  	// '*' means "all enabled by default webhooks"
    26  	// 'foo' means "enable 'foo'"
    27  	// '-foo' means "disable 'foo'"
    28  	// first item for a particular name wins
    29  	Webhooks []string
    30  
    31  	// A selector to restrict the list of returned objects by their labels. this selector is
    32  	// used in informer factory.
    33  	LabelSelector string
    34  
    35  	// ServerPort indicates the insecure port that webhook implementation is listening on
    36  	ServerPort string
    37  
    38  	SecureServing *server.SecureServingInfo
    39  
    40  	DynamicGVResources []string
    41  }
    42  
    43  type WebhooksConfiguration struct {
    44  	*VPAConfig
    45  	*PodConfig
    46  }
    47  
    48  func NewGenericWebhookConfiguration() *GenericWebhookConfiguration {
    49  	return &GenericWebhookConfiguration{}
    50  }
    51  
    52  func NewWebhooksConfiguration() *WebhooksConfiguration {
    53  	return &WebhooksConfiguration{
    54  		VPAConfig: NewVPAConfig(),
    55  		PodConfig: NewPodConfig(),
    56  	}
    57  }