-
Notifications
You must be signed in to change notification settings - Fork 297
/
types.go
165 lines (143 loc) · 6.6 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
Copyright 2018 The Kubernetes Authors.
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 v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:openapi-gen=true
type BackendConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BackendConfigSpec `json:"spec,omitempty"`
Status BackendConfigStatus `json:"status,omitempty"`
}
// BackendConfigSpec is the spec for a BackendConfig resource
// +k8s:openapi-gen=true
type BackendConfigSpec struct {
Iap *IAPConfig `json:"iap,omitempty"`
Cdn *CDNConfig `json:"cdn,omitempty"`
SecurityPolicy *SecurityPolicyConfig `json:"securityPolicy,omitempty"`
TimeoutSec *int64 `json:"timeoutSec,omitempty"`
ConnectionDraining *ConnectionDrainingConfig `json:"connectionDraining,omitempty"`
SessionAffinity *SessionAffinityConfig `json:"sessionAffinity,omitempty"`
CustomRequestHeaders *CustomRequestHeadersConfig `json:"customRequestHeaders,omitempty"`
HealthCheck *HealthCheckConfig `json:"healthCheck,omitempty"`
}
// BackendConfigStatus is the status for a BackendConfig resource
type BackendConfigStatus struct {
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// BackendConfigList is a list of BackendConfig resources
type BackendConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []BackendConfig `json:"items"`
}
// IAPConfig contains configuration for IAP-enabled backends.
// +k8s:openapi-gen=true
type IAPConfig struct {
Enabled bool `json:"enabled"`
// +optional
OAuthClientCredentials *OAuthClientCredentials `json:"oauthclientCredentials"`
}
// OAuthClientCredentials contains credentials for a single IAP-enabled backend.
// +k8s:openapi-gen=true
type OAuthClientCredentials struct {
// The name of a k8s secret which stores the OAuth client id & secret.
SecretName string `json:"secretName"`
// Direct reference to OAuth client id.
ClientID string `json:"clientID,omitempty"`
// Direct reference to OAuth client secret.
ClientSecret string `json:"clientSecret,omitempty"`
}
// CDNConfig contains configuration for CDN-enabled backends.
// +k8s:openapi-gen=true
type CDNConfig struct {
Enabled bool `json:"enabled"`
CachePolicy *CacheKeyPolicy `json:"cachePolicy,omitempty"`
}
// CacheKeyPolicy contains configuration for how requests to a CDN-enabled backend are cached.
// +k8s:openapi-gen=true
type CacheKeyPolicy struct {
// If true, requests to different hosts will be cached separately.
IncludeHost bool `json:"includeHost,omitempty"`
// If true, http and https requests will be cached separately.
IncludeProtocol bool `json:"includeProtocol,omitempty"`
// If true, query string parameters are included in the cache key
// according to QueryStringBlacklist and QueryStringWhitelist.
// If neither is set, the entire query string is included and if false
// the entire query string is excluded.
IncludeQueryString bool `json:"includeQueryString,omitempty"`
// Names of query strint parameters to exclude from cache keys. All other
// parameters are included. Either specify QueryStringBlacklist or
// QueryStringWhitelist, but not both.
QueryStringBlacklist []string `json:"queryStringBlacklist,omitempty"`
// Names of query string parameters to include in cache keys. All other
// parameters are excluded. Either specify QueryStringBlacklist or
// QueryStringWhitelist, but not both.
QueryStringWhitelist []string `json:"queryStringWhitelist,omitempty"`
}
// SecurityPolicyConfig contains configuration for CloudArmor-enabled backends.
// If not specified, the controller will not reconcile the security policy
// configuration. In other words, users can make changes in GCE without the
// controller overwriting them.
// +k8s:openapi-gen=true
type SecurityPolicyConfig struct {
// Name of the security policy that should be associated. If set to empty, the
// existing security policy on the backend will be removed.
Name string `json:"name"`
}
// ConnectionDrainingConfig contains configuration for connection draining.
// For now the draining timeout. May manage more settings in the future.
// +k8s:openapi-gen=true
type ConnectionDrainingConfig struct {
// Draining timeout in seconds.
DrainingTimeoutSec int64 `json:"drainingTimeoutSec,omitempty"`
}
// SessionAffinityConfig contains configuration for stickiness parameters.
// +k8s:openapi-gen=true
type SessionAffinityConfig struct {
AffinityType string `json:"affinityType,omitempty"`
AffinityCookieTtlSec *int64 `json:"affinityCookieTtlSec,omitempty"`
}
// CustomRequestHeadersConfig contains configuration for custom request headers
// +k8s:openapi-gen=true
type CustomRequestHeadersConfig struct {
Headers []string `json:"headers,omitempty"`
}
// HealthCheckConfig contains configuration for the health check.
// +k8s:openapi-gen=true
type HealthCheckConfig struct {
// CheckIntervalSec is a health check parameter. See
// https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks.
CheckIntervalSec *int64 `json:"checkIntervalSec,omitempty"`
// TimeoutSec is a health check parameter. See
// https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks.
TimeoutSec *int64 `json:"timeoutSec,omitempty"`
// HealthyThreshold is a health check parameter. See
// https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks.
HealthyThreshold *int64 `json:"healthyThreshold,omitempty"`
// UnhealthyThreshold is a health check parameter. See
// https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks.
UnhealthyThreshold *int64 `json:"unhealthyThreshold,omitempty"`
// Type is a health check parameter. See
// https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks.
Type *string `json:"type,omitempty"`
Port *int64 `json:"port,omitempty"`
// RequestPath is a health check parameter. See
// https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks.
RequestPath *string `json:"requestPath,omitempty"`
}