-
Notifications
You must be signed in to change notification settings - Fork 463
/
types.go
143 lines (128 loc) · 6.95 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1alpha1
import (
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
)
const (
// SameRegion Strategy determines a seed candidate for a shoot only if the cloud profile and region are identical
SameRegion CandidateDeterminationStrategy = "SameRegion"
// MinimalDistance Strategy determines a seed candidate for a shoot if the cloud profile are identical. Then chooses the seed with the minimal distance to the shoot.
MinimalDistance CandidateDeterminationStrategy = "MinimalDistance"
// Default Strategy is the default strategy to use when there is no configuration provided
Default CandidateDeterminationStrategy = SameRegion
// SchedulerDefaultLockObjectNamespace is the default lock namespace for leader election.
SchedulerDefaultLockObjectNamespace = "garden"
// SchedulerDefaultLockObjectName is the default lock name for leader election.
SchedulerDefaultLockObjectName = "gardener-scheduler-leader-election"
// SchedulerDefaultConfigurationConfigMapNamespace is the namespace of the scheduler configuration config map
SchedulerDefaultConfigurationConfigMapNamespace = "garden"
// SchedulerDefaultConfigurationConfigMapName is the name of the scheduler configuration config map
SchedulerDefaultConfigurationConfigMapName = "gardener-scheduler-configmap"
// DefaultDiscoveryTTL is the default ttl for the cached discovery client.
DefaultDiscoveryTTL = 10 * time.Second
)
// Strategies defines all currently implemented SeedCandidateDeterminationStrategies
var Strategies = []CandidateDeterminationStrategy{SameRegion, MinimalDistance}
// CandidateDeterminationStrategy defines how seeds for shoots, that do not specify a seed explicitly, are being determined
type CandidateDeterminationStrategy string
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// SchedulerConfiguration provides the configuration for the SeedManager admission plugin.
type SchedulerConfiguration struct {
metav1.TypeMeta `json:",inline"`
// ClientConnection specifies the kubeconfig file and client connection
// settings for the proxy server to use when communicating with the apiserver.
ClientConnection componentbaseconfigv1alpha1.ClientConnectionConfiguration `json:"clientConnection,omitempty"`
// LeaderElection defines the configuration of leader election client.
LeaderElection LeaderElectionConfiguration `json:"leaderElection,omitempty"`
// Discovery defines the configuration of the discovery client.
Discovery DiscoveryConfiguration `json:"discovery,omitempty"`
// LogLevel is the level/severity for the logs. Must be one of [info,debug,error].
LogLevel string `json:"logLevel,omitempty"`
// Server defines the configuration of the HTTP server.
Server ServerConfiguration `json:"server,omitempty"`
// Scheduler defines the configuration of the schedulers.
Schedulers SchedulerControllerConfiguration `json:"schedulers"`
}
// SchedulerControllerConfiguration defines the configuration of the controllers.
type SchedulerControllerConfiguration struct {
// BackupBucket defines the configuration of the BackupBucket controller.
// +optional
BackupBucket *BackupBucketSchedulerConfiguration `json:"backupBucket,omitempty"`
// Shoot defines the configuration of the Shoot controller.
// +optional
Shoot *ShootSchedulerConfiguration `json:"shoot,omitempty"`
}
// BackupBucketSchedulerConfiguration defines the configuration of the BackupBucket to Seed
// scheduler.
type BackupBucketSchedulerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
ConcurrentSyncs int `json:"concurrentSyncs"`
// RetrySyncPeriod is the duration how fast BackupBuckets with an errornous operation are
// re-added to the queue so that the operation can be retried. Defaults to 15s.
// +optional
RetrySyncPeriod metav1.Duration `json:"retrySyncPeriod,omitempty"`
}
// ShootSchedulerConfiguration defines the configuration of the Shoot to Seed
// scheduler.
type ShootSchedulerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
ConcurrentSyncs int `json:"concurrentSyncs"`
// RetrySyncPeriod is the duration how fast Shoots with an errornous operation are
// re-added to the queue so that the operation can be retried. Defaults to 15s.
// +optional
RetrySyncPeriod metav1.Duration `json:"retrySyncPeriod,omitempty"`
// Strategy defines how seeds for shoots, that do not specify a seed explicitly, are being determined
Strategy CandidateDeterminationStrategy `json:"candidateDeterminationStrategy"`
}
// DiscoveryConfiguration defines the configuration of how to discover API groups.
// It allows to set where to store caching data and to specify the TTL of that data.
type DiscoveryConfiguration struct {
// DiscoveryCacheDir is the directory to store discovery cache information.
// If unset, the discovery client will use the current working directory.
// +optional
DiscoveryCacheDir *string `json:"discoveryCacheDir,omitempty"`
// HTTPCacheDir is the directory to store discovery HTTP cache information.
// If unset, no HTTP caching will be done.
// +optional
HTTPCacheDir *string `json:"httpCacheDir,omitempty"`
// TTL is the ttl how long discovery cache information shall be valid.
// +optional
TTL *metav1.Duration `json:"ttl,omitempty"`
}
// LeaderElectionConfiguration defines the configuration of leader election
// clients for components that can run with leader election enabled.
type LeaderElectionConfiguration struct {
componentbaseconfigv1alpha1.LeaderElectionConfiguration `json:",inline"`
// LockObjectNamespace defines the namespace of the lock object.
LockObjectNamespace string `json:"lockObjectNamespace"`
// LockObjectName defines the lock object name.
LockObjectName string `json:"lockObjectName"`
}
// ServerConfiguration contains details for the HTTP(S) servers.
type ServerConfiguration struct {
// HTTP is the configuration for the HTTP server.
HTTP Server `json:"http"`
}
// Server contains information for HTTP(S) server configuration.
type Server struct {
// BindAddress is the IP address on which to listen for the specified port.
BindAddress string `json:"bindAddress"`
// Port is the port on which to serve unsecured, unauthenticated access.
Port int `json:"port"`
}