1 /* 2 Copyright 2018 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 v1alpha1 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 ) 22 23 const EndpointsResourceLock = "endpoints" 24 25 // LeaderElectionConfiguration defines the configuration of leader election 26 // clients for components that can run with leader election enabled. 27 type LeaderElectionConfiguration struct { 28 // leaderElect enables a leader election client to gain leadership 29 // before executing the main loop. Enable this when running replicated 30 // components for high availability. 31 LeaderElect *bool `json:"leaderElect"` 32 // leaseDuration is the duration that non-leader candidates will wait 33 // after observing a leadership renewal until attempting to acquire 34 // leadership of a led but unrenewed leader slot. This is effectively the 35 // maximum duration that a leader can be stopped before it is replaced 36 // by another candidate. This is only applicable if leader election is 37 // enabled. 38 LeaseDuration metav1.Duration `json:"leaseDuration"` 39 // renewDeadline is the interval between attempts by the acting master to 40 // renew a leadership slot before it stops leading. This must be less 41 // than or equal to the lease duration. This is only applicable if leader 42 // election is enabled. 43 RenewDeadline metav1.Duration `json:"renewDeadline"` 44 // retryPeriod is the duration the clients should wait between attempting 45 // acquisition and renewal of a leadership. This is only applicable if 46 // leader election is enabled. 47 RetryPeriod metav1.Duration `json:"retryPeriod"` 48 // resourceLock indicates the resource object type that will be used to lock 49 // during leader election cycles. 50 ResourceLock string `json:"resourceLock"` 51 // resourceName indicates the name of resource object that will be used to lock 52 // during leader election cycles. 53 ResourceName string `json:"resourceName"` 54 // resourceName indicates the namespace of resource object that will be used to lock 55 // during leader election cycles. 56 ResourceNamespace string `json:"resourceNamespace"` 57 } 58 59 // DebuggingConfiguration holds configuration for Debugging related features. 60 type DebuggingConfiguration struct { 61 // enableProfiling enables profiling via web interface host:port/debug/pprof/ 62 EnableProfiling *bool `json:"enableProfiling,omitempty"` 63 // enableContentionProfiling enables block profiling, if 64 // enableProfiling is true. 65 EnableContentionProfiling *bool `json:"enableContentionProfiling,omitempty"` 66 } 67 68 // ClientConnectionConfiguration contains details for constructing a client. 69 type ClientConnectionConfiguration struct { 70 // kubeconfig is the path to a KubeConfig file. 71 Kubeconfig string `json:"kubeconfig"` 72 // acceptContentTypes defines the Accept header sent by clients when connecting to a server, overriding the 73 // default value of 'application/json'. This field will control all connections to the server used by a particular 74 // client. 75 AcceptContentTypes string `json:"acceptContentTypes"` 76 // contentType is the content type used when sending data to the server from this client. 77 ContentType string `json:"contentType"` 78 // qps controls the number of queries per second allowed for this connection. 79 QPS float32 `json:"qps"` 80 // burst allows extra queries to accumulate when a client is exceeding its rate. 81 Burst int32 `json:"burst"` 82 } 83