-
Notifications
You must be signed in to change notification settings - Fork 450
/
types.go
149 lines (135 loc) · 7.21 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
144
145
146
147
148
149
// Copyright 2022 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 (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
gardenletv1alpha1 "github.com/gardener/gardener/pkg/gardenlet/apis/config/v1alpha1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// OperatorConfiguration defines the configuration for the Gardener operator.
type OperatorConfiguration struct {
metav1.TypeMeta `json:",inline"`
// RuntimeClientConnection specifies the kubeconfig file and the client connection settings for the proxy server to
// use when communicating with the kube-apiserver of the runtime cluster.
RuntimeClientConnection componentbaseconfigv1alpha1.ClientConnectionConfiguration `json:"runtimeClientConnection"`
// VirtualClientConnection specifies the kubeconfig file and the client connection settings for the proxy server to
// use when communicating with the kube-apiserver of the virtual cluster.
VirtualClientConnection componentbaseconfigv1alpha1.ClientConnectionConfiguration `json:"virtualClientConnection"`
// LeaderElection defines the configuration of leader election client.
LeaderElection componentbaseconfigv1alpha1.LeaderElectionConfiguration `json:"leaderElection"`
// LogLevel is the level/severity for the logs. Must be one of [info,debug,error].
LogLevel string `json:"logLevel"`
// LogFormat is the output format for the logs. Must be one of [text,json].
LogFormat string `json:"logFormat"`
// Server defines the configuration of the HTTP server.
Server ServerConfiguration `json:"server"`
// Debugging holds configuration for Debugging related features.
// +optional
Debugging *componentbaseconfigv1alpha1.DebuggingConfiguration `json:"debugging,omitempty"`
// FeatureGates is a map of feature names to bools that enable or disable alpha/experimental features. This field
// modifies piecemeal the built-in default values from "github.com/gardener/gardener/pkg/operator/features/features.go".
// Default: nil
// +optional
FeatureGates map[string]bool `json:"featureGates,omitempty"`
// Controllers defines the configuration of the controllers.
Controllers ControllerConfiguration `json:"controllers"`
// NodeToleration contains optional settings for default tolerations.
// +optional
NodeToleration *NodeTolerationConfiguration `json:"nodeToleration,omitempty"`
}
// ConditionThreshold defines the threshold of the given condition type.
type ConditionThreshold struct {
// Type is the type of the condition to define the threshold for.
Type string `json:"type"`
// Duration is the duration how long the condition can stay in the progressing state.
Duration metav1.Duration `json:"duration"`
}
// ControllerConfiguration defines the configuration of the controllers.
type ControllerConfiguration struct {
// Garden is the configuration for the garden controller.
Garden GardenControllerConfig `json:"garden"`
// GardenCare is the configuration for the garden care controller
GardenCare GardenCareControllerConfiguration `json:"gardenCare"`
// NetworkPolicy is the configuration for the NetworkPolicy controller.
NetworkPolicy NetworkPolicyControllerConfiguration `json:"networkPolicy"`
}
// GardenCareControllerConfiguration defines the configuration of the GardenCare controller.
type GardenCareControllerConfiguration struct {
// SyncPeriod is the duration how often the existing resources are reconciled (how
// often the health check is performed).
// +optional
SyncPeriod *metav1.Duration `json:"syncPeriod,omitempty"`
// ConditionThresholds defines the condition threshold per condition type.
// +optional
ConditionThresholds []ConditionThreshold `json:"conditionThresholds,omitempty"`
}
// GardenControllerConfig is the configuration for the garden controller.
type GardenControllerConfig struct {
// ConcurrentSyncs is the number of concurrent worker routines for this controller.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// SyncPeriod is the duration how often the controller performs its reconciliation.
// +optional
SyncPeriod *metav1.Duration `json:"syncPeriod,omitempty"`
// ETCDConfig contains an optional configuration for the
// backup compaction feature of ETCD backup-restore functionality.
// +optional
ETCDConfig *gardenletv1alpha1.ETCDConfig `json:"etcdConfig,omitempty"`
}
// NetworkPolicyControllerConfiguration defines the configuration of the NetworkPolicy controller.
type NetworkPolicyControllerConfiguration struct {
// ConcurrentSyncs is the number of concurrent worker routines for this controller.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// AdditionalNamespaceSelectors is a list of label selectors for additional namespaces that should be considered by
// the controller.
// +optional
AdditionalNamespaceSelectors []metav1.LabelSelector `json:"additionalNamespaceSelectors,omitempty"`
}
// ServerConfiguration contains details for the HTTP(S) servers.
type ServerConfiguration struct {
// Webhooks is the configuration for the HTTPS webhook server.
Webhooks Server `json:"webhooks"`
// HealthProbes is the configuration for serving the healthz and readyz endpoints.
// +optional
HealthProbes *Server `json:"healthProbes,omitempty"`
// Metrics is the configuration for serving the metrics endpoint.
// +optional
Metrics *Server `json:"metrics,omitempty"`
}
// 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 requests.
Port int `json:"port"`
}
// NodeTolerationConfiguration contains information about node toleration options.
type NodeTolerationConfiguration struct {
// DefaultNotReadyTolerationSeconds specifies the seconds for the `node.kubernetes.io/not-ready` toleration that
// should be added to pods not already tolerating this taint.
// +optional
DefaultNotReadyTolerationSeconds *int64 `json:"defaultNotReadyTolerationSeconds,omitempty"`
// DefaultUnreachableTolerationSeconds specifies the seconds for the `node.kubernetes.io/unreachable` toleration that
// should be added to pods not already tolerating this taint.
// +optional
DefaultUnreachableTolerationSeconds *int64 `json:"defaultUnreachableTolerationSeconds,omitempty"`
}
const (
// DefaultLockObjectNamespace is the default lock namespace for leader election.
DefaultLockObjectNamespace = "garden"
// DefaultLockObjectName is the default lock name for leader election.
DefaultLockObjectName = "gardener-operator-leader-election"
)