1 // Copyright 2020 Datawire. All rights reserved 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 /////////////////////////////////////////////////////////////////////////// 16 // Important: Run "make generate-fast" to regenerate code after modifying 17 // this file. 18 /////////////////////////////////////////////////////////////////////////// 19 20 package v3alpha1 21 22 import ( 23 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 24 ) 25 26 // RateLimitServiceSpec defines the desired state of RateLimitService 27 type RateLimitServiceSpec struct { 28 // Common to all Ambassador objects. 29 AmbassadorID AmbassadorID `json:"ambassador_id,omitempty"` 30 31 // +kubebuilder:validation:Required 32 Service string `json:"service,omitempty"` 33 Timeout *MillisecondDuration `json:"timeout_ms,omitempty"` 34 Domain string `json:"domain,omitempty"` 35 TLS string `json:"tls,omitempty"` 36 37 // ProtocolVersion is the envoy api transport protocol version 38 // 39 // +kubebuilder:validation:Enum={"v2","v3"} 40 ProtocolVersion string `json:"protocol_version,omitempty"` 41 StatsName string `json:"stats_name,omitempty"` 42 43 // FailureModeDeny when set to true, envoy will deny traffic if it 44 // is unable to communicate with the rate limit service. 45 FailureModeDeny bool `json:"failure_mode_deny,omitempty"` 46 47 V2ExplicitTLS *V2ExplicitTLS `json:"v2ExplicitTLS,omitempty"` 48 } 49 50 // RateLimitService is the Schema for the ratelimitservices API 51 // 52 // +kubebuilder:object:root=true 53 type RateLimitService struct { 54 metav1.TypeMeta `json:""` 55 metav1.ObjectMeta `json:"metadata,omitempty"` 56 57 Spec RateLimitServiceSpec `json:"spec,omitempty"` 58 } 59 60 // RateLimitServiceList contains a list of RateLimitServices. 61 // 62 // +kubebuilder:object:root=true 63 type RateLimitServiceList struct { 64 metav1.TypeMeta `json:""` 65 metav1.ListMeta `json:"metadata,omitempty"` 66 Items []RateLimitService `json:"items"` 67 } 68 69 func init() { 70 SchemeBuilder.Register(&RateLimitService{}, &RateLimitServiceList{}) 71 } 72