diff --git a/Makefile b/Makefile index 21839d83..138d96c5 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 0.18.0-alpha.4 +VERSION ?= 0.18.0-alpha.8 # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") diff --git a/api/v1alpha1/marin3r_types.go b/api/v1alpha1/marin3r_types.go index 19d95e61..3a1f0e23 100644 --- a/api/v1alpha1/marin3r_types.go +++ b/api/v1alpha1/marin3r_types.go @@ -2,9 +2,11 @@ package v1alpha1 import ( "reflect" + "sort" + envoyconfig "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" + runtime "k8s.io/apimachinery/pkg/runtime" ) // SidecarPort defines port for the Marin3r sidecar container @@ -57,7 +59,7 @@ type Marin3rSidecarSpec struct { // in the cluster. // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional - EnvoyDynamicConfig []EnvoyDynamicConfig `json:"dynamicConfigs,omitempty"` + EnvoyDynamicConfig MapOfEnvoyDynamicConfig `json:"dynamicConfigs,omitempty"` } type defaultMarin3rSidecarSpec struct { @@ -107,9 +109,37 @@ func InitializeMarin3rSidecarSpec(spec *Marin3rSidecarSpec, def defaultMarin3rSi return spec } -// +kubebuilder:validation:MinProperties:=1 -// +kubebuilder:validation:MaxProperties:=1 +type MapOfEnvoyDynamicConfig map[string]EnvoyDynamicConfig + +// AsList transforms from the map in the external API to the list of elements +// that the internal API expects. +func (mapofconfs MapOfEnvoyDynamicConfig) AsList() []envoyconfig.EnvoyDynamicConfigDescriptor { + + list := make([]envoyconfig.EnvoyDynamicConfigDescriptor, 0, len(mapofconfs)) + + for name, conf := range mapofconfs { + list = append(list, conf.DeepCopy().AsEnvoyDynamicConfigDescriptor(name)) + } + + // ensure consistent order of configs + sort.Slice(list, func(a, b int) bool { + return list[a].GetName() < list[b].GetName() + }) + + return list +} + +// +kubebuilder:validation:MinProperties:=2 +// +kubebuilder:validation:MaxProperties:=2 type EnvoyDynamicConfig struct { + // unexported, hidden field + name string `json:"-"` + // GeneratorVersion specifies the version of a given template. + // "v1" is the default. + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +kubebuilder:default:=v1 + // +optional + GeneratorVersion *string `json:"generatorVersion,omitempty"` // ListenerHttp contains options for an HTTP/HTTPS listener // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional @@ -127,56 +157,53 @@ type EnvoyDynamicConfig struct { // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional Runtime *Runtime `json:"runtime,omitempty"` -} - -type EnvoyDynamicConfigMeta struct { - // The name of the configuration/resource. The name is what - // allows a configuration to be used from wihin other configuration. // +operator-sdk:csv:customresourcedefinitions:type=spec - Name string `json:"name"` - // GeneratorVersion specifies the version of a given template. - // "v1" is the default. - // +operator-sdk:csv:customresourcedefinitions:type=spec - // +kubebuilder:default:=v1 // +optional - GeneratorVersion *string `json:"generatorVersion,omitempty"` + RawConfig *RawConfig `json:"rawConfig,omitempty"` } -// GetName returns the name -func (meta *EnvoyDynamicConfigMeta) GetName() string { - return meta.Name +// AsEnvoyDynamicConfigDescriptor converts the external API type into the internal EnvoyDynamicConfigDescriptor +// interface. The name field is populated with the parameter passed to the function. +func (config *EnvoyDynamicConfig) AsEnvoyDynamicConfigDescriptor(name string) envoyconfig.EnvoyDynamicConfigDescriptor { + config.name = name + return config } -// GetGeneratorVersion returns the template's version -func (meta *EnvoyDynamicConfigMeta) GetGeneratorVersion() string { - return *meta.GeneratorVersion +func (config *EnvoyDynamicConfig) GetName() string { + return config.name } -// EnvoyDynamicConfigRaw is a struct with methods to manage a -// configuration defined using directly the Envoy config API -type EnvoyDynamicConfigRaw struct { - // +operator-sdk:csv:customresourcedefinitions:type=spec - // +optional - // Allows defining configuration using directly envoy's config API. - // WARNING: no validation of this field's value is performed before - // writting the custom resource to etcd. - RawConfig *runtime.RawExtension `json:"rawConfig,omitempty"` +// GetGeneratorVersion returns the template's version +func (config *EnvoyDynamicConfig) GetGeneratorVersion() string { + return *config.GeneratorVersion } -func (raw *EnvoyDynamicConfigRaw) GetRawConfig() []byte { - if raw != nil && raw.RawConfig != nil && raw.RawConfig.Raw != nil { - return raw.RawConfig.Raw +func (config *EnvoyDynamicConfig) GetOptions() interface{} { + if config.ListenerHttp != nil { + return config.ListenerHttp + } else if config.RouteConfiguration != nil { + return config.RouteConfiguration + } else if config.Cluster != nil { + return config.Cluster + } else if config.Runtime != nil { + return config.Runtime + } else if config.RawConfig != nil { + return config.RawConfig } + return nil } // ListenerHttp contains options for an HTTP/HTTPS listener type ListenerHttp struct { - EnvoyDynamicConfigMeta `json:",inline"` - EnvoyDynamicConfigRaw `json:",inline"` // The port where the listener listens for new connections // +operator-sdk:csv:customresourcedefinitions:type=spec Port uint32 `json:"port"` + // Whether proxy protocol should be enabled or not. Defaults to true. + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +kubebuilder:default:=true + // +optional + ProxyProtocol *bool `json:"proxyProtocol,omitempty"` // The name of the RouteConfiguration to use in the listener // +operator-sdk:csv:customresourcedefinitions:type=spec RouteConfigName string `json:"routeConfigName"` @@ -235,8 +262,6 @@ type RateLimitOptions struct { // Cluster contains options for an Envoy cluster protobuffer message type Cluster struct { - EnvoyDynamicConfigMeta `json:",inline"` - EnvoyDynamicConfigRaw `json:",inline"` // The upstream host // +operator-sdk:csv:customresourcedefinitions:type=spec Host string `json:"host"` @@ -253,8 +278,6 @@ type Cluster struct { // RouteConfiguration contains options for an Envoy route_configuration // protobuffer message type RouteConfiguration struct { - EnvoyDynamicConfigMeta `json:",inline"` - EnvoyDynamicConfigRaw `json:",inline"` // The virtual_hosts definitions for this route configuration. // Virtual hosts must be specified using directly Envoy's API // +operator-sdk:csv:customresourcedefinitions:type=spec @@ -263,9 +286,21 @@ type RouteConfiguration struct { // Runtime contains options for an Envoy runtime protobuffer message type Runtime struct { - EnvoyDynamicConfigMeta `json:",inline"` - EnvoyDynamicConfigRaw `json:",inline"` // The list of listeners to apply overload protection limits to // +operator-sdk:csv:customresourcedefinitions:type=spec ListenerNames []string `json:"listenerNames"` } + +// RawConfig is a struct with methods to manage a +// configuration defined using directly the Envoy config API +type RawConfig struct { + // Type is the type url for the protobuf message + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +kubebuilder:validation:Enum=listener;routeConfiguration;cluster;runtime + Type string `json:"type"` + // +operator-sdk:csv:customresourcedefinitions:type=spec + // Allows defining configuration using directly envoy's config API. + // WARNING: no validation of this field's value is performed before + // writting the custom resource to etcd. + Value runtime.RawExtension `json:"value"` +} diff --git a/api/v1alpha1/marin3r_types_test.go b/api/v1alpha1/marin3r_types_test.go index cd14e424..4f8779c8 100644 --- a/api/v1alpha1/marin3r_types_test.go +++ b/api/v1alpha1/marin3r_types_test.go @@ -4,9 +4,9 @@ import ( "reflect" "testing" + envoyconfig "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/apimachinery/pkg/runtime" ) func TestMarin3rSidecarSpec_Default(t *testing.T) { @@ -220,40 +220,44 @@ func TestInitializeMarin3rSidecarSpec(t *testing.T) { } } -func TestEnvoyDynamicConfigRaw_GetRawConfig(t *testing.T) { - type fields struct { - RawConfig *runtime.RawExtension - } +func TestMapOfEnvoyDynamicConfig_AsList(t *testing.T) { tests := []struct { - name string - fields fields - want []byte + name string + mapofconfs MapOfEnvoyDynamicConfig + want []envoyconfig.EnvoyDynamicConfigDescriptor }{ { - name: "returns the raw config", - fields: fields{ - RawConfig: &runtime.RawExtension{ - Raw: []byte("whatever"), - Object: nil, + name: "Returns the map as a list of EnvoyDynamicConfigDescriptor", + mapofconfs: map[string]EnvoyDynamicConfig{ + "one": { + name: "", + GeneratorVersion: new(string), + ListenerHttp: &ListenerHttp{}, + }, + "two": { + name: "", + GeneratorVersion: new(string), + Cluster: &Cluster{}, }, }, - want: []byte("whatever"), - }, - { - name: "returns nil", - fields: fields{ - RawConfig: nil, + want: []envoyconfig.EnvoyDynamicConfigDescriptor{ + &EnvoyDynamicConfig{ + name: "one", + GeneratorVersion: new(string), + ListenerHttp: &ListenerHttp{}, + }, + &EnvoyDynamicConfig{ + name: "two", + GeneratorVersion: new(string), + Cluster: &Cluster{}, + }, }, - want: nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - raw := &EnvoyDynamicConfigRaw{ - RawConfig: tt.fields.RawConfig, - } - if got := raw.GetRawConfig(); !reflect.DeepEqual(got, tt.want) { - t.Errorf("EnvoyDynamicConfigRaw.GetRawConfig() = %v, want %v", got, tt.want) + if got := tt.mapofconfs.AsList(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("MapOfEnvoyDynamicConfig.AsList() = %v, want %v", got, tt.want) } }) } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 59bafcf4..fb459f51 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -875,8 +875,6 @@ func (in *Canary) DeepCopy() *Canary { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Cluster) DeepCopyInto(out *Cluster) { *out = *in - in.EnvoyDynamicConfigMeta.DeepCopyInto(&out.EnvoyDynamicConfigMeta) - in.EnvoyDynamicConfigRaw.DeepCopyInto(&out.EnvoyDynamicConfigRaw) if in.IsHttp2 != nil { in, out := &in.IsHttp2, &out.IsHttp2 *out = new(bool) @@ -1101,6 +1099,11 @@ func (in *Endpoint) DeepCopy() *Endpoint { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EnvoyDynamicConfig) DeepCopyInto(out *EnvoyDynamicConfig) { *out = *in + if in.GeneratorVersion != nil { + in, out := &in.GeneratorVersion, &out.GeneratorVersion + *out = new(string) + **out = **in + } if in.ListenerHttp != nil { in, out := &in.ListenerHttp, &out.ListenerHttp *out = new(ListenerHttp) @@ -1121,54 +1124,19 @@ func (in *EnvoyDynamicConfig) DeepCopyInto(out *EnvoyDynamicConfig) { *out = new(Runtime) (*in).DeepCopyInto(*out) } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyDynamicConfig. -func (in *EnvoyDynamicConfig) DeepCopy() *EnvoyDynamicConfig { - if in == nil { - return nil - } - out := new(EnvoyDynamicConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EnvoyDynamicConfigMeta) DeepCopyInto(out *EnvoyDynamicConfigMeta) { - *out = *in - if in.GeneratorVersion != nil { - in, out := &in.GeneratorVersion, &out.GeneratorVersion - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyDynamicConfigMeta. -func (in *EnvoyDynamicConfigMeta) DeepCopy() *EnvoyDynamicConfigMeta { - if in == nil { - return nil - } - out := new(EnvoyDynamicConfigMeta) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EnvoyDynamicConfigRaw) DeepCopyInto(out *EnvoyDynamicConfigRaw) { - *out = *in if in.RawConfig != nil { in, out := &in.RawConfig, &out.RawConfig - *out = new(runtime.RawExtension) + *out = new(RawConfig) (*in).DeepCopyInto(*out) } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyDynamicConfigRaw. -func (in *EnvoyDynamicConfigRaw) DeepCopy() *EnvoyDynamicConfigRaw { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyDynamicConfig. +func (in *EnvoyDynamicConfig) DeepCopy() *EnvoyDynamicConfig { if in == nil { return nil } - out := new(EnvoyDynamicConfigRaw) + out := new(EnvoyDynamicConfig) in.DeepCopyInto(out) return out } @@ -1373,8 +1341,11 @@ func (in *ListenerConfig) DeepCopy() *ListenerConfig { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ListenerHttp) DeepCopyInto(out *ListenerHttp) { *out = *in - in.EnvoyDynamicConfigMeta.DeepCopyInto(&out.EnvoyDynamicConfigMeta) - in.EnvoyDynamicConfigRaw.DeepCopyInto(&out.EnvoyDynamicConfigRaw) + if in.ProxyProtocol != nil { + in, out := &in.ProxyProtocol, &out.ProxyProtocol + *out = new(bool) + **out = **in + } if in.CertificateSecretName != nil { in, out := &in.CertificateSecretName, &out.CertificateSecretName *out = new(string) @@ -1550,6 +1521,27 @@ func (in *LoadBalancerSpec) DeepCopy() *LoadBalancerSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in MapOfEnvoyDynamicConfig) DeepCopyInto(out *MapOfEnvoyDynamicConfig) { + { + in := &in + *out = make(MapOfEnvoyDynamicConfig, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MapOfEnvoyDynamicConfig. +func (in MapOfEnvoyDynamicConfig) DeepCopy() MapOfEnvoyDynamicConfig { + if in == nil { + return nil + } + out := new(MapOfEnvoyDynamicConfig) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MappingService) DeepCopyInto(out *MappingService) { *out = *in @@ -1766,9 +1758,9 @@ func (in *Marin3rSidecarSpec) DeepCopyInto(out *Marin3rSidecarSpec) { } if in.EnvoyDynamicConfig != nil { in, out := &in.EnvoyDynamicConfig, &out.EnvoyDynamicConfig - *out = make([]EnvoyDynamicConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) + *out = make(MapOfEnvoyDynamicConfig, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() } } } @@ -2009,6 +2001,22 @@ func (in *RateLimitOptions) DeepCopy() *RateLimitOptions { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RawConfig) DeepCopyInto(out *RawConfig) { + *out = *in + in.Value.DeepCopyInto(&out.Value) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RawConfig. +func (in *RawConfig) DeepCopy() *RawConfig { + if in == nil { + return nil + } + out := new(RawConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RedHatCustomerPortalSpec) DeepCopyInto(out *RedHatCustomerPortalSpec) { *out = *in @@ -2234,8 +2242,6 @@ func (in *ResourceRequirementsSpec) DeepCopy() *ResourceRequirementsSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouteConfiguration) DeepCopyInto(out *RouteConfiguration) { *out = *in - in.EnvoyDynamicConfigMeta.DeepCopyInto(&out.EnvoyDynamicConfigMeta) - in.EnvoyDynamicConfigRaw.DeepCopyInto(&out.EnvoyDynamicConfigRaw) if in.VirtualHosts != nil { in, out := &in.VirtualHosts, &out.VirtualHosts *out = make([]runtime.RawExtension, len(*in)) @@ -2258,8 +2264,6 @@ func (in *RouteConfiguration) DeepCopy() *RouteConfiguration { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Runtime) DeepCopyInto(out *Runtime) { *out = *in - in.EnvoyDynamicConfigMeta.DeepCopyInto(&out.EnvoyDynamicConfigMeta) - in.EnvoyDynamicConfigRaw.DeepCopyInto(&out.EnvoyDynamicConfigRaw) if in.ListenerNames != nil { in, out := &in.ListenerNames, &out.ListenerNames *out = make([]string, len(*in)) diff --git a/bundle/manifests/saas-operator.clusterserviceversion.yaml b/bundle/manifests/saas-operator.clusterserviceversion.yaml index 5e9c2e44..db85878a 100644 --- a/bundle/manifests/saas-operator.clusterserviceversion.yaml +++ b/bundle/manifests/saas-operator.clusterserviceversion.yaml @@ -218,18 +218,48 @@ metadata: "tag": "latest" }, "marin3r": { - "dynamicConfigs": [ - { + "dynamicConfigs": { + "echo_api_cluster": { + "cluster": { + "host": "127.0.0.1", + "port": 9292 + } + }, + "echo_api_route": { + "rawConfig": { + "type": "routeConfiguration", + "value": { + "name": "echo_api_route", + "virtual_hosts": [ + { + "domains": [ + "*" + ], + "name": "echo_api", + "routes": [ + { + "match": { + "prefix": "/" + }, + "route": { + "cluster": "echo_api" + } + } + ] + } + ] + } + } + }, + "http": { "listenerHttp": { - "name": "http", "port": 38080, "routeConfigName": "echo_api" } }, - { + "https": { "listenerHttp": { "certificateSecretName": "certificate", - "name": "https", "port": 38443, "rateLimitOptions": { "domain": "echo_api", @@ -239,45 +269,14 @@ metadata: "routeConfigName": "echo_api" } }, - { - "routeConfiguration": { - "name": "echo_api", - "virtualHosts": [ - { - "domains": [ - "*" - ], - "name": "echo_api", - "routes": [ - { - "match": { - "prefix": "/" - }, - "route": { - "cluster": "echo_api" - } - } - ] - } - ] - } - }, - { - "cluster": { - "host": "127.0.0.1", - "name": "echo_api", - "port": 9292 - } - }, - { + "runtime": { "runtime": { "listenerNames": [ "http" - ], - "name": "runtime" + ] } } - ], + }, "ports": [ { "name": "echo-api-http", @@ -636,7 +635,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/3scale/saas-operator support: Red Hat - name: saas-operator.v0.18.0-alpha.4 + name: saas-operator.v0.18.0-alpha.8 namespace: placeholder spec: apiservicedefinitions: {} @@ -793,129 +792,6 @@ spec: in the cluster. displayName: Envoy Dynamic Config path: production.marin3r.dynamicConfigs - - description: Cluster contains options for an Envoy cluster protobuffer message - displayName: Cluster - path: production.marin3r.dynamicConfigs[0].cluster - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: production.marin3r.dynamicConfigs[0].cluster.generatorVersion - - description: The upstream host - displayName: Host - path: production.marin3r.dynamicConfigs[0].cluster.host - - description: Specifies if the upstream cluster is http2 or not (default). - displayName: Is Http2 - path: production.marin3r.dynamicConfigs[0].cluster.isHttp2 - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: production.marin3r.dynamicConfigs[0].cluster.name - - description: The upstream port - displayName: Port - path: production.marin3r.dynamicConfigs[0].cluster.port - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: production.marin3r.dynamicConfigs[0].cluster.rawConfig - - description: ListenerHttp contains options for an HTTP/HTTPS listener - displayName: Listener Http - path: production.marin3r.dynamicConfigs[0].listenerHttp - - description: Allow headers with underscores - displayName: Allow Headers With Underscores - path: production.marin3r.dynamicConfigs[0].listenerHttp.allowHeadersWithUnderscores - - description: The name of the Secret containing a valid certificate. If unset - the listener will be http, if set https - displayName: Certificate Secret Name - path: production.marin3r.dynamicConfigs[0].listenerHttp.certificateSecretName - - description: If this filed is set, http 1.0 will be enabled and this will - be the default hostname to use. - displayName: Default Host For Http10 - path: production.marin3r.dynamicConfigs[0].listenerHttp.defaultHostForHttp10 - - description: Enable http2 in the listener.Disabled by default. - displayName: Enable Http2 - path: production.marin3r.dynamicConfigs[0].listenerHttp.enableHttp2 - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: production.marin3r.dynamicConfigs[0].listenerHttp.generatorVersion - - description: Max connection duration. If unset no max connection duration - will be applied. - displayName: Max Connection Duration - path: production.marin3r.dynamicConfigs[0].listenerHttp.maxConnectionDuration - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: production.marin3r.dynamicConfigs[0].listenerHttp.name - - description: The port where the listener listens for new connections - displayName: Port - path: production.marin3r.dynamicConfigs[0].listenerHttp.port - - description: Rate limit options for the ratelimit filter of the HTTP connection - manager - displayName: Rate Limit Options - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions - - description: The rate limit domain - displayName: Domain - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.domain - - description: Whether to allow requests or not if the rate limit service is - unavailable - displayName: Failure Mode Deny - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.failureModeDeny - - description: Location of the rate limit service. Must point to one of the - defined clusters. - displayName: Rate Limit Cluster - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.rateLimitCluster - - description: Max time to wait for a response from the rate limit service - displayName: Timeout - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.timeout - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: production.marin3r.dynamicConfigs[0].listenerHttp.rawConfig - - description: The name of the RouteConfiguration to use in the listener - displayName: Route Config Name - path: production.marin3r.dynamicConfigs[0].listenerHttp.routeConfigName - - description: RouteConfiguration contains options for an Envoy route_configuration - protobuffer message - displayName: Route Configuration - path: production.marin3r.dynamicConfigs[0].routeConfiguration - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: production.marin3r.dynamicConfigs[0].routeConfiguration.generatorVersion - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: production.marin3r.dynamicConfigs[0].routeConfiguration.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: production.marin3r.dynamicConfigs[0].routeConfiguration.rawConfig - - description: The virtual_hosts definitions for this route configuration. Virtual - hosts must be specified using directly Envoy's API - displayName: Virtual Hosts - path: production.marin3r.dynamicConfigs[0].routeConfiguration.virtualHosts - - description: Runtime contains options for an Envoy runtime protobuffer message - displayName: Runtime - path: production.marin3r.dynamicConfigs[0].runtime - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: production.marin3r.dynamicConfigs[0].runtime.generatorVersion - - description: The list of listeners to apply overload protection limits to - displayName: Listener Names - path: production.marin3r.dynamicConfigs[0].runtime.listenerNames - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: production.marin3r.dynamicConfigs[0].runtime.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: production.marin3r.dynamicConfigs[0].runtime.rawConfig - description: The Envoy API version to use displayName: Envoy APIVersion path: production.marin3r.envoyAPIVersion @@ -1146,129 +1022,6 @@ spec: in the cluster. displayName: Envoy Dynamic Config path: staging.marin3r.dynamicConfigs - - description: Cluster contains options for an Envoy cluster protobuffer message - displayName: Cluster - path: staging.marin3r.dynamicConfigs[0].cluster - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: staging.marin3r.dynamicConfigs[0].cluster.generatorVersion - - description: The upstream host - displayName: Host - path: staging.marin3r.dynamicConfigs[0].cluster.host - - description: Specifies if the upstream cluster is http2 or not (default). - displayName: Is Http2 - path: staging.marin3r.dynamicConfigs[0].cluster.isHttp2 - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: staging.marin3r.dynamicConfigs[0].cluster.name - - description: The upstream port - displayName: Port - path: staging.marin3r.dynamicConfigs[0].cluster.port - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: staging.marin3r.dynamicConfigs[0].cluster.rawConfig - - description: ListenerHttp contains options for an HTTP/HTTPS listener - displayName: Listener Http - path: staging.marin3r.dynamicConfigs[0].listenerHttp - - description: Allow headers with underscores - displayName: Allow Headers With Underscores - path: staging.marin3r.dynamicConfigs[0].listenerHttp.allowHeadersWithUnderscores - - description: The name of the Secret containing a valid certificate. If unset - the listener will be http, if set https - displayName: Certificate Secret Name - path: staging.marin3r.dynamicConfigs[0].listenerHttp.certificateSecretName - - description: If this filed is set, http 1.0 will be enabled and this will - be the default hostname to use. - displayName: Default Host For Http10 - path: staging.marin3r.dynamicConfigs[0].listenerHttp.defaultHostForHttp10 - - description: Enable http2 in the listener.Disabled by default. - displayName: Enable Http2 - path: staging.marin3r.dynamicConfigs[0].listenerHttp.enableHttp2 - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: staging.marin3r.dynamicConfigs[0].listenerHttp.generatorVersion - - description: Max connection duration. If unset no max connection duration - will be applied. - displayName: Max Connection Duration - path: staging.marin3r.dynamicConfigs[0].listenerHttp.maxConnectionDuration - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: staging.marin3r.dynamicConfigs[0].listenerHttp.name - - description: The port where the listener listens for new connections - displayName: Port - path: staging.marin3r.dynamicConfigs[0].listenerHttp.port - - description: Rate limit options for the ratelimit filter of the HTTP connection - manager - displayName: Rate Limit Options - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions - - description: The rate limit domain - displayName: Domain - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.domain - - description: Whether to allow requests or not if the rate limit service is - unavailable - displayName: Failure Mode Deny - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.failureModeDeny - - description: Location of the rate limit service. Must point to one of the - defined clusters. - displayName: Rate Limit Cluster - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.rateLimitCluster - - description: Max time to wait for a response from the rate limit service - displayName: Timeout - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.timeout - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rawConfig - - description: The name of the RouteConfiguration to use in the listener - displayName: Route Config Name - path: staging.marin3r.dynamicConfigs[0].listenerHttp.routeConfigName - - description: RouteConfiguration contains options for an Envoy route_configuration - protobuffer message - displayName: Route Configuration - path: staging.marin3r.dynamicConfigs[0].routeConfiguration - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: staging.marin3r.dynamicConfigs[0].routeConfiguration.generatorVersion - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: staging.marin3r.dynamicConfigs[0].routeConfiguration.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: staging.marin3r.dynamicConfigs[0].routeConfiguration.rawConfig - - description: The virtual_hosts definitions for this route configuration. Virtual - hosts must be specified using directly Envoy's API - displayName: Virtual Hosts - path: staging.marin3r.dynamicConfigs[0].routeConfiguration.virtualHosts - - description: Runtime contains options for an Envoy runtime protobuffer message - displayName: Runtime - path: staging.marin3r.dynamicConfigs[0].runtime - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: staging.marin3r.dynamicConfigs[0].runtime.generatorVersion - - description: The list of listeners to apply overload protection limits to - displayName: Listener Names - path: staging.marin3r.dynamicConfigs[0].runtime.listenerNames - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: staging.marin3r.dynamicConfigs[0].runtime.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: staging.marin3r.dynamicConfigs[0].runtime.rawConfig - description: The Envoy API version to use displayName: Envoy APIVersion path: staging.marin3r.envoyAPIVersion @@ -1865,129 +1618,6 @@ spec: in the cluster. displayName: Envoy Dynamic Config path: listener.marin3r.dynamicConfigs - - description: Cluster contains options for an Envoy cluster protobuffer message - displayName: Cluster - path: listener.marin3r.dynamicConfigs[0].cluster - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: listener.marin3r.dynamicConfigs[0].cluster.generatorVersion - - description: The upstream host - displayName: Host - path: listener.marin3r.dynamicConfigs[0].cluster.host - - description: Specifies if the upstream cluster is http2 or not (default). - displayName: Is Http2 - path: listener.marin3r.dynamicConfigs[0].cluster.isHttp2 - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: listener.marin3r.dynamicConfigs[0].cluster.name - - description: The upstream port - displayName: Port - path: listener.marin3r.dynamicConfigs[0].cluster.port - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: listener.marin3r.dynamicConfigs[0].cluster.rawConfig - - description: ListenerHttp contains options for an HTTP/HTTPS listener - displayName: Listener Http - path: listener.marin3r.dynamicConfigs[0].listenerHttp - - description: Allow headers with underscores - displayName: Allow Headers With Underscores - path: listener.marin3r.dynamicConfigs[0].listenerHttp.allowHeadersWithUnderscores - - description: The name of the Secret containing a valid certificate. If unset - the listener will be http, if set https - displayName: Certificate Secret Name - path: listener.marin3r.dynamicConfigs[0].listenerHttp.certificateSecretName - - description: If this filed is set, http 1.0 will be enabled and this will - be the default hostname to use. - displayName: Default Host For Http10 - path: listener.marin3r.dynamicConfigs[0].listenerHttp.defaultHostForHttp10 - - description: Enable http2 in the listener.Disabled by default. - displayName: Enable Http2 - path: listener.marin3r.dynamicConfigs[0].listenerHttp.enableHttp2 - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: listener.marin3r.dynamicConfigs[0].listenerHttp.generatorVersion - - description: Max connection duration. If unset no max connection duration - will be applied. - displayName: Max Connection Duration - path: listener.marin3r.dynamicConfigs[0].listenerHttp.maxConnectionDuration - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: listener.marin3r.dynamicConfigs[0].listenerHttp.name - - description: The port where the listener listens for new connections - displayName: Port - path: listener.marin3r.dynamicConfigs[0].listenerHttp.port - - description: Rate limit options for the ratelimit filter of the HTTP connection - manager - displayName: Rate Limit Options - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions - - description: The rate limit domain - displayName: Domain - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.domain - - description: Whether to allow requests or not if the rate limit service is - unavailable - displayName: Failure Mode Deny - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.failureModeDeny - - description: Location of the rate limit service. Must point to one of the - defined clusters. - displayName: Rate Limit Cluster - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.rateLimitCluster - - description: Max time to wait for a response from the rate limit service - displayName: Timeout - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.timeout - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rawConfig - - description: The name of the RouteConfiguration to use in the listener - displayName: Route Config Name - path: listener.marin3r.dynamicConfigs[0].listenerHttp.routeConfigName - - description: RouteConfiguration contains options for an Envoy route_configuration - protobuffer message - displayName: Route Configuration - path: listener.marin3r.dynamicConfigs[0].routeConfiguration - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: listener.marin3r.dynamicConfigs[0].routeConfiguration.generatorVersion - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: listener.marin3r.dynamicConfigs[0].routeConfiguration.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: listener.marin3r.dynamicConfigs[0].routeConfiguration.rawConfig - - description: The virtual_hosts definitions for this route configuration. Virtual - hosts must be specified using directly Envoy's API - displayName: Virtual Hosts - path: listener.marin3r.dynamicConfigs[0].routeConfiguration.virtualHosts - - description: Runtime contains options for an Envoy runtime protobuffer message - displayName: Runtime - path: listener.marin3r.dynamicConfigs[0].runtime - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: listener.marin3r.dynamicConfigs[0].runtime.generatorVersion - - description: The list of listeners to apply overload protection limits to - displayName: Listener Names - path: listener.marin3r.dynamicConfigs[0].runtime.listenerNames - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: listener.marin3r.dynamicConfigs[0].runtime.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: listener.marin3r.dynamicConfigs[0].runtime.rawConfig - description: The Envoy API version to use displayName: Envoy APIVersion path: listener.marin3r.envoyAPIVersion @@ -2561,129 +2191,6 @@ spec: in the cluster. displayName: Envoy Dynamic Config path: marin3r.dynamicConfigs - - description: Cluster contains options for an Envoy cluster protobuffer message - displayName: Cluster - path: marin3r.dynamicConfigs[0].cluster - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: marin3r.dynamicConfigs[0].cluster.generatorVersion - - description: The upstream host - displayName: Host - path: marin3r.dynamicConfigs[0].cluster.host - - description: Specifies if the upstream cluster is http2 or not (default). - displayName: Is Http2 - path: marin3r.dynamicConfigs[0].cluster.isHttp2 - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: marin3r.dynamicConfigs[0].cluster.name - - description: The upstream port - displayName: Port - path: marin3r.dynamicConfigs[0].cluster.port - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: marin3r.dynamicConfigs[0].cluster.rawConfig - - description: ListenerHttp contains options for an HTTP/HTTPS listener - displayName: Listener Http - path: marin3r.dynamicConfigs[0].listenerHttp - - description: Allow headers with underscores - displayName: Allow Headers With Underscores - path: marin3r.dynamicConfigs[0].listenerHttp.allowHeadersWithUnderscores - - description: The name of the Secret containing a valid certificate. If unset - the listener will be http, if set https - displayName: Certificate Secret Name - path: marin3r.dynamicConfigs[0].listenerHttp.certificateSecretName - - description: If this filed is set, http 1.0 will be enabled and this will - be the default hostname to use. - displayName: Default Host For Http10 - path: marin3r.dynamicConfigs[0].listenerHttp.defaultHostForHttp10 - - description: Enable http2 in the listener.Disabled by default. - displayName: Enable Http2 - path: marin3r.dynamicConfigs[0].listenerHttp.enableHttp2 - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: marin3r.dynamicConfigs[0].listenerHttp.generatorVersion - - description: Max connection duration. If unset no max connection duration - will be applied. - displayName: Max Connection Duration - path: marin3r.dynamicConfigs[0].listenerHttp.maxConnectionDuration - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: marin3r.dynamicConfigs[0].listenerHttp.name - - description: The port where the listener listens for new connections - displayName: Port - path: marin3r.dynamicConfigs[0].listenerHttp.port - - description: Rate limit options for the ratelimit filter of the HTTP connection - manager - displayName: Rate Limit Options - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions - - description: The rate limit domain - displayName: Domain - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.domain - - description: Whether to allow requests or not if the rate limit service is - unavailable - displayName: Failure Mode Deny - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.failureModeDeny - - description: Location of the rate limit service. Must point to one of the - defined clusters. - displayName: Rate Limit Cluster - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.rateLimitCluster - - description: Max time to wait for a response from the rate limit service - displayName: Timeout - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.timeout - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: marin3r.dynamicConfigs[0].listenerHttp.rawConfig - - description: The name of the RouteConfiguration to use in the listener - displayName: Route Config Name - path: marin3r.dynamicConfigs[0].listenerHttp.routeConfigName - - description: RouteConfiguration contains options for an Envoy route_configuration - protobuffer message - displayName: Route Configuration - path: marin3r.dynamicConfigs[0].routeConfiguration - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: marin3r.dynamicConfigs[0].routeConfiguration.generatorVersion - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: marin3r.dynamicConfigs[0].routeConfiguration.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: marin3r.dynamicConfigs[0].routeConfiguration.rawConfig - - description: The virtual_hosts definitions for this route configuration. Virtual - hosts must be specified using directly Envoy's API - displayName: Virtual Hosts - path: marin3r.dynamicConfigs[0].routeConfiguration.virtualHosts - - description: Runtime contains options for an Envoy runtime protobuffer message - displayName: Runtime - path: marin3r.dynamicConfigs[0].runtime - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: marin3r.dynamicConfigs[0].runtime.generatorVersion - - description: The list of listeners to apply overload protection limits to - displayName: Listener Names - path: marin3r.dynamicConfigs[0].runtime.listenerNames - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: marin3r.dynamicConfigs[0].runtime.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: marin3r.dynamicConfigs[0].runtime.rawConfig - description: The Envoy API version to use displayName: Envoy APIVersion path: marin3r.envoyAPIVersion @@ -4797,7 +4304,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - image: quay.io/3scale/saas-operator:v0.18.0-alpha.4 + image: quay.io/3scale/saas-operator:v0.18.0-alpha.8 livenessProbe: httpGet: path: /healthz @@ -5311,4 +4818,4 @@ spec: provider: name: Red Hat url: https://www.3scale.net/ - version: 0.18.0-alpha.4 + version: 0.18.0-alpha.8 diff --git a/bundle/manifests/saas.3scale.net_apicasts.yaml b/bundle/manifests/saas.3scale.net_apicasts.yaml index 7032bdca..59d74736 100644 --- a/bundle/manifests/saas.3scale.net_apicasts.yaml +++ b/bundle/manifests/saas.3scale.net_apicasts.yaml @@ -239,10 +239,7 @@ spec: description: Marin3r configures the Marin3r sidecars for the component properties: dynamicConfigs: - description: Envoy dynamic configuration. Populating this - field causes the operator to create a Marin3r EnvoyConfig - resource, so Marin3r must be installed in the cluster. - items: + additionalProperties: maxProperties: 1 minProperties: 1 properties: @@ -250,11 +247,6 @@ spec: description: Cluster contains options for an Envoy cluster protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string host: description: The upstream host type: string @@ -263,27 +255,19 @@ spec: description: Specifies if the upstream cluster is http2 or not (default). type: boolean - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The upstream port format: int32 type: integer - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - host - - name - port type: object + generatorVersion: + default: v1 + description: GeneratorVersion specifies the version + of a given template. "v1" is the default. + type: string listenerHttp: description: ListenerHttp contains options for an HTTP/HTTPS listener @@ -307,25 +291,20 @@ spec: description: Enable http2 in the listener.Disabled by default. type: boolean - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string maxConnectionDuration: description: Max connection duration. If unset no max connection duration will be applied. type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The port where the listener listens for new connections format: int32 type: integer + proxyProtocol: + default: true + description: Whether proxy protocol should be enabled + or not. Defaults to true. + type: boolean rateLimitOptions: description: Rate limit options for the ratelimit filter of the HTTP connection manager @@ -352,43 +331,43 @@ spec: - rateLimitCluster - timeout type: object - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true routeConfigName: description: The name of the RouteConfiguration to use in the listener type: string required: - - name - port - routeConfigName type: object - routeConfiguration: - description: RouteConfiguration contains options for - an Envoy route_configuration protobuffer message + rawConfig: + description: RawConfig is a struct with methods to manage + a configuration defined using directly the Envoy config + API properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. + type: + description: Type is the type url for the protobuf + message + enum: + - listener + - routeConfiguration + - cluster + - runtime type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: + value: description: 'Allows defining configuration using directly envoy''s config API. WARNING: no validation of this field''s value is performed before writting the custom resource to etcd.' type: object x-kubernetes-preserve-unknown-fields: true + required: + - type + - value + type: object + routeConfiguration: + description: RouteConfiguration contains options for + an Envoy route_configuration protobuffer message + properties: virtualHosts: description: The virtual_hosts definitions for this route configuration. Virtual hosts must be specified @@ -398,42 +377,26 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array required: - - name - virtualHosts type: object runtime: description: Runtime contains options for an Envoy runtime protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string listenerNames: description: The list of listeners to apply overload protection limits to items: type: string type: array - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - listenerNames - - name type: object type: object - type: array + description: Envoy dynamic configuration. Populating this + field causes the operator to create a Marin3r EnvoyConfig + resource, so Marin3r must be installed in the cluster. + type: object envoyAPIVersion: description: The Envoy API version to use enum: @@ -1036,10 +999,7 @@ spec: description: Marin3r configures the Marin3r sidecars for the component properties: dynamicConfigs: - description: Envoy dynamic configuration. Populating this - field causes the operator to create a Marin3r EnvoyConfig - resource, so Marin3r must be installed in the cluster. - items: + additionalProperties: maxProperties: 1 minProperties: 1 properties: @@ -1047,11 +1007,6 @@ spec: description: Cluster contains options for an Envoy cluster protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string host: description: The upstream host type: string @@ -1060,27 +1015,19 @@ spec: description: Specifies if the upstream cluster is http2 or not (default). type: boolean - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The upstream port format: int32 type: integer - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - host - - name - port type: object + generatorVersion: + default: v1 + description: GeneratorVersion specifies the version + of a given template. "v1" is the default. + type: string listenerHttp: description: ListenerHttp contains options for an HTTP/HTTPS listener @@ -1104,25 +1051,20 @@ spec: description: Enable http2 in the listener.Disabled by default. type: boolean - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string maxConnectionDuration: description: Max connection duration. If unset no max connection duration will be applied. type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The port where the listener listens for new connections format: int32 type: integer + proxyProtocol: + default: true + description: Whether proxy protocol should be enabled + or not. Defaults to true. + type: boolean rateLimitOptions: description: Rate limit options for the ratelimit filter of the HTTP connection manager @@ -1149,43 +1091,43 @@ spec: - rateLimitCluster - timeout type: object - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true routeConfigName: description: The name of the RouteConfiguration to use in the listener type: string required: - - name - port - routeConfigName type: object - routeConfiguration: - description: RouteConfiguration contains options for - an Envoy route_configuration protobuffer message + rawConfig: + description: RawConfig is a struct with methods to manage + a configuration defined using directly the Envoy config + API properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. + type: + description: Type is the type url for the protobuf + message + enum: + - listener + - routeConfiguration + - cluster + - runtime type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: + value: description: 'Allows defining configuration using directly envoy''s config API. WARNING: no validation of this field''s value is performed before writting the custom resource to etcd.' type: object x-kubernetes-preserve-unknown-fields: true + required: + - type + - value + type: object + routeConfiguration: + description: RouteConfiguration contains options for + an Envoy route_configuration protobuffer message + properties: virtualHosts: description: The virtual_hosts definitions for this route configuration. Virtual hosts must be specified @@ -1195,42 +1137,26 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array required: - - name - virtualHosts type: object runtime: description: Runtime contains options for an Envoy runtime protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string listenerNames: description: The list of listeners to apply overload protection limits to items: type: string type: array - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - listenerNames - - name type: object type: object - type: array + description: Envoy dynamic configuration. Populating this + field causes the operator to create a Marin3r EnvoyConfig + resource, so Marin3r must be installed in the cluster. + type: object envoyAPIVersion: description: The Envoy API version to use enum: diff --git a/bundle/manifests/saas.3scale.net_backends.yaml b/bundle/manifests/saas.3scale.net_backends.yaml index 037499f5..5549bc42 100644 --- a/bundle/manifests/saas.3scale.net_backends.yaml +++ b/bundle/manifests/saas.3scale.net_backends.yaml @@ -669,10 +669,7 @@ spec: description: Marin3r configures the Marin3r sidecars for the component properties: dynamicConfigs: - description: Envoy dynamic configuration. Populating this - field causes the operator to create a Marin3r EnvoyConfig - resource, so Marin3r must be installed in the cluster. - items: + additionalProperties: maxProperties: 1 minProperties: 1 properties: @@ -680,11 +677,6 @@ spec: description: Cluster contains options for an Envoy cluster protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string host: description: The upstream host type: string @@ -693,27 +685,19 @@ spec: description: Specifies if the upstream cluster is http2 or not (default). type: boolean - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The upstream port format: int32 type: integer - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - host - - name - port type: object + generatorVersion: + default: v1 + description: GeneratorVersion specifies the version + of a given template. "v1" is the default. + type: string listenerHttp: description: ListenerHttp contains options for an HTTP/HTTPS listener @@ -737,25 +721,20 @@ spec: description: Enable http2 in the listener.Disabled by default. type: boolean - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string maxConnectionDuration: description: Max connection duration. If unset no max connection duration will be applied. type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The port where the listener listens for new connections format: int32 type: integer + proxyProtocol: + default: true + description: Whether proxy protocol should be enabled + or not. Defaults to true. + type: boolean rateLimitOptions: description: Rate limit options for the ratelimit filter of the HTTP connection manager @@ -782,43 +761,43 @@ spec: - rateLimitCluster - timeout type: object - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true routeConfigName: description: The name of the RouteConfiguration to use in the listener type: string required: - - name - port - routeConfigName type: object - routeConfiguration: - description: RouteConfiguration contains options for - an Envoy route_configuration protobuffer message + rawConfig: + description: RawConfig is a struct with methods to manage + a configuration defined using directly the Envoy config + API properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. + type: + description: Type is the type url for the protobuf + message + enum: + - listener + - routeConfiguration + - cluster + - runtime type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: + value: description: 'Allows defining configuration using directly envoy''s config API. WARNING: no validation of this field''s value is performed before writting the custom resource to etcd.' type: object x-kubernetes-preserve-unknown-fields: true + required: + - type + - value + type: object + routeConfiguration: + description: RouteConfiguration contains options for + an Envoy route_configuration protobuffer message + properties: virtualHosts: description: The virtual_hosts definitions for this route configuration. Virtual hosts must be specified @@ -828,42 +807,26 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array required: - - name - virtualHosts type: object runtime: description: Runtime contains options for an Envoy runtime protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string listenerNames: description: The list of listeners to apply overload protection limits to items: type: string type: array - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - listenerNames - - name type: object type: object - type: array + description: Envoy dynamic configuration. Populating this + field causes the operator to create a Marin3r EnvoyConfig + resource, so Marin3r must be installed in the cluster. + type: object envoyAPIVersion: description: The Envoy API version to use enum: diff --git a/bundle/manifests/saas.3scale.net_echoapis.yaml b/bundle/manifests/saas.3scale.net_echoapis.yaml index e9a9a447..8ec25322 100644 --- a/bundle/manifests/saas.3scale.net_echoapis.yaml +++ b/bundle/manifests/saas.3scale.net_echoapis.yaml @@ -137,10 +137,7 @@ spec: description: Marin3r configures the Marin3r sidecars for the component properties: dynamicConfigs: - description: Envoy dynamic configuration. Populating this field - causes the operator to create a Marin3r EnvoyConfig resource, - so Marin3r must be installed in the cluster. - items: + additionalProperties: maxProperties: 1 minProperties: 1 properties: @@ -148,11 +145,6 @@ spec: description: Cluster contains options for an Envoy cluster protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string host: description: The upstream host type: string @@ -161,27 +153,19 @@ spec: description: Specifies if the upstream cluster is http2 or not (default). type: boolean - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be used - from wihin other configuration. - type: string port: description: The upstream port format: int32 type: integer - rawConfig: - description: 'Allows defining configuration using directly - envoy''s config API. WARNING: no validation of this - field''s value is performed before writting the custom - resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - host - - name - port type: object + generatorVersion: + default: v1 + description: GeneratorVersion specifies the version of a + given template. "v1" is the default. + type: string listenerHttp: description: ListenerHttp contains options for an HTTP/HTTPS listener @@ -204,25 +188,20 @@ spec: description: Enable http2 in the listener.Disabled by default. type: boolean - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string maxConnectionDuration: description: Max connection duration. If unset no max connection duration will be applied. type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be used - from wihin other configuration. - type: string port: description: The port where the listener listens for new connections format: int32 type: integer + proxyProtocol: + default: true + description: Whether proxy protocol should be enabled + or not. Defaults to true. + type: boolean rateLimitOptions: description: Rate limit options for the ratelimit filter of the HTTP connection manager @@ -249,43 +228,42 @@ spec: - rateLimitCluster - timeout type: object - rawConfig: - description: 'Allows defining configuration using directly - envoy''s config API. WARNING: no validation of this - field''s value is performed before writting the custom - resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true routeConfigName: description: The name of the RouteConfiguration to use in the listener type: string required: - - name - port - routeConfigName type: object - routeConfiguration: - description: RouteConfiguration contains options for an - Envoy route_configuration protobuffer message + rawConfig: + description: RawConfig is a struct with methods to manage + a configuration defined using directly the Envoy config + API properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. + type: + description: Type is the type url for the protobuf message + enum: + - listener + - routeConfiguration + - cluster + - runtime type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be used - from wihin other configuration. - type: string - rawConfig: + value: description: 'Allows defining configuration using directly envoy''s config API. WARNING: no validation of this field''s value is performed before writting the custom resource to etcd.' type: object x-kubernetes-preserve-unknown-fields: true + required: + - type + - value + type: object + routeConfiguration: + description: RouteConfiguration contains options for an + Envoy route_configuration protobuffer message + properties: virtualHosts: description: The virtual_hosts definitions for this route configuration. Virtual hosts must be specified @@ -295,42 +273,26 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array required: - - name - virtualHosts type: object runtime: description: Runtime contains options for an Envoy runtime protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string listenerNames: description: The list of listeners to apply overload protection limits to items: type: string type: array - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be used - from wihin other configuration. - type: string - rawConfig: - description: 'Allows defining configuration using directly - envoy''s config API. WARNING: no validation of this - field''s value is performed before writting the custom - resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - listenerNames - - name type: object type: object - type: array + description: Envoy dynamic configuration. Populating this field + causes the operator to create a Marin3r EnvoyConfig resource, + so Marin3r must be installed in the cluster. + type: object envoyAPIVersion: description: The Envoy API version to use enum: diff --git a/config/crd/bases/saas.3scale.net_apicasts.yaml b/config/crd/bases/saas.3scale.net_apicasts.yaml index 9e5d9f10..2c1192f8 100644 --- a/config/crd/bases/saas.3scale.net_apicasts.yaml +++ b/config/crd/bases/saas.3scale.net_apicasts.yaml @@ -240,10 +240,7 @@ spec: description: Marin3r configures the Marin3r sidecars for the component properties: dynamicConfigs: - description: Envoy dynamic configuration. Populating this - field causes the operator to create a Marin3r EnvoyConfig - resource, so Marin3r must be installed in the cluster. - items: + additionalProperties: maxProperties: 1 minProperties: 1 properties: @@ -251,11 +248,6 @@ spec: description: Cluster contains options for an Envoy cluster protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string host: description: The upstream host type: string @@ -264,27 +256,19 @@ spec: description: Specifies if the upstream cluster is http2 or not (default). type: boolean - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The upstream port format: int32 type: integer - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - host - - name - port type: object + generatorVersion: + default: v1 + description: GeneratorVersion specifies the version + of a given template. "v1" is the default. + type: string listenerHttp: description: ListenerHttp contains options for an HTTP/HTTPS listener @@ -308,25 +292,20 @@ spec: description: Enable http2 in the listener.Disabled by default. type: boolean - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string maxConnectionDuration: description: Max connection duration. If unset no max connection duration will be applied. type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The port where the listener listens for new connections format: int32 type: integer + proxyProtocol: + default: true + description: Whether proxy protocol should be enabled + or not. Defaults to true. + type: boolean rateLimitOptions: description: Rate limit options for the ratelimit filter of the HTTP connection manager @@ -353,43 +332,43 @@ spec: - rateLimitCluster - timeout type: object - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true routeConfigName: description: The name of the RouteConfiguration to use in the listener type: string required: - - name - port - routeConfigName type: object - routeConfiguration: - description: RouteConfiguration contains options for - an Envoy route_configuration protobuffer message + rawConfig: + description: RawConfig is a struct with methods to manage + a configuration defined using directly the Envoy config + API properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. + type: + description: Type is the type url for the protobuf + message + enum: + - listener + - routeConfiguration + - cluster + - runtime type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: + value: description: 'Allows defining configuration using directly envoy''s config API. WARNING: no validation of this field''s value is performed before writting the custom resource to etcd.' type: object x-kubernetes-preserve-unknown-fields: true + required: + - type + - value + type: object + routeConfiguration: + description: RouteConfiguration contains options for + an Envoy route_configuration protobuffer message + properties: virtualHosts: description: The virtual_hosts definitions for this route configuration. Virtual hosts must be specified @@ -399,42 +378,26 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array required: - - name - virtualHosts type: object runtime: description: Runtime contains options for an Envoy runtime protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string listenerNames: description: The list of listeners to apply overload protection limits to items: type: string type: array - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - listenerNames - - name type: object type: object - type: array + description: Envoy dynamic configuration. Populating this + field causes the operator to create a Marin3r EnvoyConfig + resource, so Marin3r must be installed in the cluster. + type: object envoyAPIVersion: description: The Envoy API version to use enum: @@ -1037,10 +1000,7 @@ spec: description: Marin3r configures the Marin3r sidecars for the component properties: dynamicConfigs: - description: Envoy dynamic configuration. Populating this - field causes the operator to create a Marin3r EnvoyConfig - resource, so Marin3r must be installed in the cluster. - items: + additionalProperties: maxProperties: 1 minProperties: 1 properties: @@ -1048,11 +1008,6 @@ spec: description: Cluster contains options for an Envoy cluster protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string host: description: The upstream host type: string @@ -1061,27 +1016,19 @@ spec: description: Specifies if the upstream cluster is http2 or not (default). type: boolean - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The upstream port format: int32 type: integer - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - host - - name - port type: object + generatorVersion: + default: v1 + description: GeneratorVersion specifies the version + of a given template. "v1" is the default. + type: string listenerHttp: description: ListenerHttp contains options for an HTTP/HTTPS listener @@ -1105,25 +1052,20 @@ spec: description: Enable http2 in the listener.Disabled by default. type: boolean - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string maxConnectionDuration: description: Max connection duration. If unset no max connection duration will be applied. type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The port where the listener listens for new connections format: int32 type: integer + proxyProtocol: + default: true + description: Whether proxy protocol should be enabled + or not. Defaults to true. + type: boolean rateLimitOptions: description: Rate limit options for the ratelimit filter of the HTTP connection manager @@ -1150,43 +1092,43 @@ spec: - rateLimitCluster - timeout type: object - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true routeConfigName: description: The name of the RouteConfiguration to use in the listener type: string required: - - name - port - routeConfigName type: object - routeConfiguration: - description: RouteConfiguration contains options for - an Envoy route_configuration protobuffer message + rawConfig: + description: RawConfig is a struct with methods to manage + a configuration defined using directly the Envoy config + API properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. + type: + description: Type is the type url for the protobuf + message + enum: + - listener + - routeConfiguration + - cluster + - runtime type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: + value: description: 'Allows defining configuration using directly envoy''s config API. WARNING: no validation of this field''s value is performed before writting the custom resource to etcd.' type: object x-kubernetes-preserve-unknown-fields: true + required: + - type + - value + type: object + routeConfiguration: + description: RouteConfiguration contains options for + an Envoy route_configuration protobuffer message + properties: virtualHosts: description: The virtual_hosts definitions for this route configuration. Virtual hosts must be specified @@ -1196,42 +1138,26 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array required: - - name - virtualHosts type: object runtime: description: Runtime contains options for an Envoy runtime protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string listenerNames: description: The list of listeners to apply overload protection limits to items: type: string type: array - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - listenerNames - - name type: object type: object - type: array + description: Envoy dynamic configuration. Populating this + field causes the operator to create a Marin3r EnvoyConfig + resource, so Marin3r must be installed in the cluster. + type: object envoyAPIVersion: description: The Envoy API version to use enum: diff --git a/config/crd/bases/saas.3scale.net_backends.yaml b/config/crd/bases/saas.3scale.net_backends.yaml index 1294a748..639f38ef 100644 --- a/config/crd/bases/saas.3scale.net_backends.yaml +++ b/config/crd/bases/saas.3scale.net_backends.yaml @@ -670,10 +670,7 @@ spec: description: Marin3r configures the Marin3r sidecars for the component properties: dynamicConfigs: - description: Envoy dynamic configuration. Populating this - field causes the operator to create a Marin3r EnvoyConfig - resource, so Marin3r must be installed in the cluster. - items: + additionalProperties: maxProperties: 1 minProperties: 1 properties: @@ -681,11 +678,6 @@ spec: description: Cluster contains options for an Envoy cluster protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string host: description: The upstream host type: string @@ -694,27 +686,19 @@ spec: description: Specifies if the upstream cluster is http2 or not (default). type: boolean - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The upstream port format: int32 type: integer - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - host - - name - port type: object + generatorVersion: + default: v1 + description: GeneratorVersion specifies the version + of a given template. "v1" is the default. + type: string listenerHttp: description: ListenerHttp contains options for an HTTP/HTTPS listener @@ -738,25 +722,20 @@ spec: description: Enable http2 in the listener.Disabled by default. type: boolean - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string maxConnectionDuration: description: Max connection duration. If unset no max connection duration will be applied. type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string port: description: The port where the listener listens for new connections format: int32 type: integer + proxyProtocol: + default: true + description: Whether proxy protocol should be enabled + or not. Defaults to true. + type: boolean rateLimitOptions: description: Rate limit options for the ratelimit filter of the HTTP connection manager @@ -783,43 +762,43 @@ spec: - rateLimitCluster - timeout type: object - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true routeConfigName: description: The name of the RouteConfiguration to use in the listener type: string required: - - name - port - routeConfigName type: object - routeConfiguration: - description: RouteConfiguration contains options for - an Envoy route_configuration protobuffer message + rawConfig: + description: RawConfig is a struct with methods to manage + a configuration defined using directly the Envoy config + API properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. + type: + description: Type is the type url for the protobuf + message + enum: + - listener + - routeConfiguration + - cluster + - runtime type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: + value: description: 'Allows defining configuration using directly envoy''s config API. WARNING: no validation of this field''s value is performed before writting the custom resource to etcd.' type: object x-kubernetes-preserve-unknown-fields: true + required: + - type + - value + type: object + routeConfiguration: + description: RouteConfiguration contains options for + an Envoy route_configuration protobuffer message + properties: virtualHosts: description: The virtual_hosts definitions for this route configuration. Virtual hosts must be specified @@ -829,42 +808,26 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array required: - - name - virtualHosts type: object runtime: description: Runtime contains options for an Envoy runtime protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string listenerNames: description: The list of listeners to apply overload protection limits to items: type: string type: array - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be - used from wihin other configuration. - type: string - rawConfig: - description: 'Allows defining configuration using - directly envoy''s config API. WARNING: no validation - of this field''s value is performed before writting - the custom resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - listenerNames - - name type: object type: object - type: array + description: Envoy dynamic configuration. Populating this + field causes the operator to create a Marin3r EnvoyConfig + resource, so Marin3r must be installed in the cluster. + type: object envoyAPIVersion: description: The Envoy API version to use enum: diff --git a/config/crd/bases/saas.3scale.net_echoapis.yaml b/config/crd/bases/saas.3scale.net_echoapis.yaml index 7e10573a..d8f03aea 100644 --- a/config/crd/bases/saas.3scale.net_echoapis.yaml +++ b/config/crd/bases/saas.3scale.net_echoapis.yaml @@ -138,10 +138,7 @@ spec: description: Marin3r configures the Marin3r sidecars for the component properties: dynamicConfigs: - description: Envoy dynamic configuration. Populating this field - causes the operator to create a Marin3r EnvoyConfig resource, - so Marin3r must be installed in the cluster. - items: + additionalProperties: maxProperties: 1 minProperties: 1 properties: @@ -149,11 +146,6 @@ spec: description: Cluster contains options for an Envoy cluster protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string host: description: The upstream host type: string @@ -162,27 +154,19 @@ spec: description: Specifies if the upstream cluster is http2 or not (default). type: boolean - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be used - from wihin other configuration. - type: string port: description: The upstream port format: int32 type: integer - rawConfig: - description: 'Allows defining configuration using directly - envoy''s config API. WARNING: no validation of this - field''s value is performed before writting the custom - resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - host - - name - port type: object + generatorVersion: + default: v1 + description: GeneratorVersion specifies the version of a + given template. "v1" is the default. + type: string listenerHttp: description: ListenerHttp contains options for an HTTP/HTTPS listener @@ -205,25 +189,20 @@ spec: description: Enable http2 in the listener.Disabled by default. type: boolean - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string maxConnectionDuration: description: Max connection duration. If unset no max connection duration will be applied. type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be used - from wihin other configuration. - type: string port: description: The port where the listener listens for new connections format: int32 type: integer + proxyProtocol: + default: true + description: Whether proxy protocol should be enabled + or not. Defaults to true. + type: boolean rateLimitOptions: description: Rate limit options for the ratelimit filter of the HTTP connection manager @@ -250,43 +229,42 @@ spec: - rateLimitCluster - timeout type: object - rawConfig: - description: 'Allows defining configuration using directly - envoy''s config API. WARNING: no validation of this - field''s value is performed before writting the custom - resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true routeConfigName: description: The name of the RouteConfiguration to use in the listener type: string required: - - name - port - routeConfigName type: object - routeConfiguration: - description: RouteConfiguration contains options for an - Envoy route_configuration protobuffer message + rawConfig: + description: RawConfig is a struct with methods to manage + a configuration defined using directly the Envoy config + API properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. + type: + description: Type is the type url for the protobuf message + enum: + - listener + - routeConfiguration + - cluster + - runtime type: string - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be used - from wihin other configuration. - type: string - rawConfig: + value: description: 'Allows defining configuration using directly envoy''s config API. WARNING: no validation of this field''s value is performed before writting the custom resource to etcd.' type: object x-kubernetes-preserve-unknown-fields: true + required: + - type + - value + type: object + routeConfiguration: + description: RouteConfiguration contains options for an + Envoy route_configuration protobuffer message + properties: virtualHosts: description: The virtual_hosts definitions for this route configuration. Virtual hosts must be specified @@ -296,42 +274,26 @@ spec: x-kubernetes-preserve-unknown-fields: true type: array required: - - name - virtualHosts type: object runtime: description: Runtime contains options for an Envoy runtime protobuffer message properties: - generatorVersion: - default: v1 - description: GeneratorVersion specifies the version - of a given template. "v1" is the default. - type: string listenerNames: description: The list of listeners to apply overload protection limits to items: type: string type: array - name: - description: The name of the configuration/resource. - The name is what allows a configuration to be used - from wihin other configuration. - type: string - rawConfig: - description: 'Allows defining configuration using directly - envoy''s config API. WARNING: no validation of this - field''s value is performed before writting the custom - resource to etcd.' - type: object - x-kubernetes-preserve-unknown-fields: true required: - listenerNames - - name type: object type: object - type: array + description: Envoy dynamic configuration. Populating this field + causes the operator to create a Marin3r EnvoyConfig resource, + so Marin3r must be installed in the cluster. + type: object envoyAPIVersion: description: The Envoy API version to use enum: diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index bdbb0220..0f0a2b64 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -13,4 +13,4 @@ kind: Kustomization images: - name: controller newName: quay.io/3scale/saas-operator - newTag: v0.18.0-alpha.4 + newTag: v0.18.0-alpha.8 diff --git a/config/manifests/bases/saas-operator.clusterserviceversion.yaml b/config/manifests/bases/saas-operator.clusterserviceversion.yaml index 459f1b0a..07b92a67 100644 --- a/config/manifests/bases/saas-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/saas-operator.clusterserviceversion.yaml @@ -304,129 +304,6 @@ spec: in the cluster. displayName: Envoy Dynamic Config path: production.marin3r.dynamicConfigs - - description: Cluster contains options for an Envoy cluster protobuffer message - displayName: Cluster - path: production.marin3r.dynamicConfigs[0].cluster - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: production.marin3r.dynamicConfigs[0].cluster.generatorVersion - - description: The upstream host - displayName: Host - path: production.marin3r.dynamicConfigs[0].cluster.host - - description: Specifies if the upstream cluster is http2 or not (default). - displayName: Is Http2 - path: production.marin3r.dynamicConfigs[0].cluster.isHttp2 - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: production.marin3r.dynamicConfigs[0].cluster.name - - description: The upstream port - displayName: Port - path: production.marin3r.dynamicConfigs[0].cluster.port - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: production.marin3r.dynamicConfigs[0].cluster.rawConfig - - description: ListenerHttp contains options for an HTTP/HTTPS listener - displayName: Listener Http - path: production.marin3r.dynamicConfigs[0].listenerHttp - - description: Allow headers with underscores - displayName: Allow Headers With Underscores - path: production.marin3r.dynamicConfigs[0].listenerHttp.allowHeadersWithUnderscores - - description: The name of the Secret containing a valid certificate. If unset - the listener will be http, if set https - displayName: Certificate Secret Name - path: production.marin3r.dynamicConfigs[0].listenerHttp.certificateSecretName - - description: If this filed is set, http 1.0 will be enabled and this will - be the default hostname to use. - displayName: Default Host For Http10 - path: production.marin3r.dynamicConfigs[0].listenerHttp.defaultHostForHttp10 - - description: Enable http2 in the listener.Disabled by default. - displayName: Enable Http2 - path: production.marin3r.dynamicConfigs[0].listenerHttp.enableHttp2 - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: production.marin3r.dynamicConfigs[0].listenerHttp.generatorVersion - - description: Max connection duration. If unset no max connection duration - will be applied. - displayName: Max Connection Duration - path: production.marin3r.dynamicConfigs[0].listenerHttp.maxConnectionDuration - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: production.marin3r.dynamicConfigs[0].listenerHttp.name - - description: The port where the listener listens for new connections - displayName: Port - path: production.marin3r.dynamicConfigs[0].listenerHttp.port - - description: Rate limit options for the ratelimit filter of the HTTP connection - manager - displayName: Rate Limit Options - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions - - description: The rate limit domain - displayName: Domain - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.domain - - description: Whether to allow requests or not if the rate limit service is - unavailable - displayName: Failure Mode Deny - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.failureModeDeny - - description: Location of the rate limit service. Must point to one of the - defined clusters. - displayName: Rate Limit Cluster - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.rateLimitCluster - - description: Max time to wait for a response from the rate limit service - displayName: Timeout - path: production.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.timeout - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: production.marin3r.dynamicConfigs[0].listenerHttp.rawConfig - - description: The name of the RouteConfiguration to use in the listener - displayName: Route Config Name - path: production.marin3r.dynamicConfigs[0].listenerHttp.routeConfigName - - description: RouteConfiguration contains options for an Envoy route_configuration - protobuffer message - displayName: Route Configuration - path: production.marin3r.dynamicConfigs[0].routeConfiguration - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: production.marin3r.dynamicConfigs[0].routeConfiguration.generatorVersion - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: production.marin3r.dynamicConfigs[0].routeConfiguration.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: production.marin3r.dynamicConfigs[0].routeConfiguration.rawConfig - - description: The virtual_hosts definitions for this route configuration. Virtual - hosts must be specified using directly Envoy's API - displayName: Virtual Hosts - path: production.marin3r.dynamicConfigs[0].routeConfiguration.virtualHosts - - description: Runtime contains options for an Envoy runtime protobuffer message - displayName: Runtime - path: production.marin3r.dynamicConfigs[0].runtime - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: production.marin3r.dynamicConfigs[0].runtime.generatorVersion - - description: The list of listeners to apply overload protection limits to - displayName: Listener Names - path: production.marin3r.dynamicConfigs[0].runtime.listenerNames - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: production.marin3r.dynamicConfigs[0].runtime.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: production.marin3r.dynamicConfigs[0].runtime.rawConfig - description: The Envoy API version to use displayName: Envoy APIVersion path: production.marin3r.envoyAPIVersion @@ -657,129 +534,6 @@ spec: in the cluster. displayName: Envoy Dynamic Config path: staging.marin3r.dynamicConfigs - - description: Cluster contains options for an Envoy cluster protobuffer message - displayName: Cluster - path: staging.marin3r.dynamicConfigs[0].cluster - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: staging.marin3r.dynamicConfigs[0].cluster.generatorVersion - - description: The upstream host - displayName: Host - path: staging.marin3r.dynamicConfigs[0].cluster.host - - description: Specifies if the upstream cluster is http2 or not (default). - displayName: Is Http2 - path: staging.marin3r.dynamicConfigs[0].cluster.isHttp2 - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: staging.marin3r.dynamicConfigs[0].cluster.name - - description: The upstream port - displayName: Port - path: staging.marin3r.dynamicConfigs[0].cluster.port - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: staging.marin3r.dynamicConfigs[0].cluster.rawConfig - - description: ListenerHttp contains options for an HTTP/HTTPS listener - displayName: Listener Http - path: staging.marin3r.dynamicConfigs[0].listenerHttp - - description: Allow headers with underscores - displayName: Allow Headers With Underscores - path: staging.marin3r.dynamicConfigs[0].listenerHttp.allowHeadersWithUnderscores - - description: The name of the Secret containing a valid certificate. If unset - the listener will be http, if set https - displayName: Certificate Secret Name - path: staging.marin3r.dynamicConfigs[0].listenerHttp.certificateSecretName - - description: If this filed is set, http 1.0 will be enabled and this will - be the default hostname to use. - displayName: Default Host For Http10 - path: staging.marin3r.dynamicConfigs[0].listenerHttp.defaultHostForHttp10 - - description: Enable http2 in the listener.Disabled by default. - displayName: Enable Http2 - path: staging.marin3r.dynamicConfigs[0].listenerHttp.enableHttp2 - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: staging.marin3r.dynamicConfigs[0].listenerHttp.generatorVersion - - description: Max connection duration. If unset no max connection duration - will be applied. - displayName: Max Connection Duration - path: staging.marin3r.dynamicConfigs[0].listenerHttp.maxConnectionDuration - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: staging.marin3r.dynamicConfigs[0].listenerHttp.name - - description: The port where the listener listens for new connections - displayName: Port - path: staging.marin3r.dynamicConfigs[0].listenerHttp.port - - description: Rate limit options for the ratelimit filter of the HTTP connection - manager - displayName: Rate Limit Options - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions - - description: The rate limit domain - displayName: Domain - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.domain - - description: Whether to allow requests or not if the rate limit service is - unavailable - displayName: Failure Mode Deny - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.failureModeDeny - - description: Location of the rate limit service. Must point to one of the - defined clusters. - displayName: Rate Limit Cluster - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.rateLimitCluster - - description: Max time to wait for a response from the rate limit service - displayName: Timeout - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.timeout - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: staging.marin3r.dynamicConfigs[0].listenerHttp.rawConfig - - description: The name of the RouteConfiguration to use in the listener - displayName: Route Config Name - path: staging.marin3r.dynamicConfigs[0].listenerHttp.routeConfigName - - description: RouteConfiguration contains options for an Envoy route_configuration - protobuffer message - displayName: Route Configuration - path: staging.marin3r.dynamicConfigs[0].routeConfiguration - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: staging.marin3r.dynamicConfigs[0].routeConfiguration.generatorVersion - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: staging.marin3r.dynamicConfigs[0].routeConfiguration.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: staging.marin3r.dynamicConfigs[0].routeConfiguration.rawConfig - - description: The virtual_hosts definitions for this route configuration. Virtual - hosts must be specified using directly Envoy's API - displayName: Virtual Hosts - path: staging.marin3r.dynamicConfigs[0].routeConfiguration.virtualHosts - - description: Runtime contains options for an Envoy runtime protobuffer message - displayName: Runtime - path: staging.marin3r.dynamicConfigs[0].runtime - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: staging.marin3r.dynamicConfigs[0].runtime.generatorVersion - - description: The list of listeners to apply overload protection limits to - displayName: Listener Names - path: staging.marin3r.dynamicConfigs[0].runtime.listenerNames - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: staging.marin3r.dynamicConfigs[0].runtime.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: staging.marin3r.dynamicConfigs[0].runtime.rawConfig - description: The Envoy API version to use displayName: Envoy APIVersion path: staging.marin3r.envoyAPIVersion @@ -1376,129 +1130,6 @@ spec: in the cluster. displayName: Envoy Dynamic Config path: listener.marin3r.dynamicConfigs - - description: Cluster contains options for an Envoy cluster protobuffer message - displayName: Cluster - path: listener.marin3r.dynamicConfigs[0].cluster - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: listener.marin3r.dynamicConfigs[0].cluster.generatorVersion - - description: The upstream host - displayName: Host - path: listener.marin3r.dynamicConfigs[0].cluster.host - - description: Specifies if the upstream cluster is http2 or not (default). - displayName: Is Http2 - path: listener.marin3r.dynamicConfigs[0].cluster.isHttp2 - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: listener.marin3r.dynamicConfigs[0].cluster.name - - description: The upstream port - displayName: Port - path: listener.marin3r.dynamicConfigs[0].cluster.port - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: listener.marin3r.dynamicConfigs[0].cluster.rawConfig - - description: ListenerHttp contains options for an HTTP/HTTPS listener - displayName: Listener Http - path: listener.marin3r.dynamicConfigs[0].listenerHttp - - description: Allow headers with underscores - displayName: Allow Headers With Underscores - path: listener.marin3r.dynamicConfigs[0].listenerHttp.allowHeadersWithUnderscores - - description: The name of the Secret containing a valid certificate. If unset - the listener will be http, if set https - displayName: Certificate Secret Name - path: listener.marin3r.dynamicConfigs[0].listenerHttp.certificateSecretName - - description: If this filed is set, http 1.0 will be enabled and this will - be the default hostname to use. - displayName: Default Host For Http10 - path: listener.marin3r.dynamicConfigs[0].listenerHttp.defaultHostForHttp10 - - description: Enable http2 in the listener.Disabled by default. - displayName: Enable Http2 - path: listener.marin3r.dynamicConfigs[0].listenerHttp.enableHttp2 - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: listener.marin3r.dynamicConfigs[0].listenerHttp.generatorVersion - - description: Max connection duration. If unset no max connection duration - will be applied. - displayName: Max Connection Duration - path: listener.marin3r.dynamicConfigs[0].listenerHttp.maxConnectionDuration - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: listener.marin3r.dynamicConfigs[0].listenerHttp.name - - description: The port where the listener listens for new connections - displayName: Port - path: listener.marin3r.dynamicConfigs[0].listenerHttp.port - - description: Rate limit options for the ratelimit filter of the HTTP connection - manager - displayName: Rate Limit Options - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions - - description: The rate limit domain - displayName: Domain - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.domain - - description: Whether to allow requests or not if the rate limit service is - unavailable - displayName: Failure Mode Deny - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.failureModeDeny - - description: Location of the rate limit service. Must point to one of the - defined clusters. - displayName: Rate Limit Cluster - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.rateLimitCluster - - description: Max time to wait for a response from the rate limit service - displayName: Timeout - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.timeout - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: listener.marin3r.dynamicConfigs[0].listenerHttp.rawConfig - - description: The name of the RouteConfiguration to use in the listener - displayName: Route Config Name - path: listener.marin3r.dynamicConfigs[0].listenerHttp.routeConfigName - - description: RouteConfiguration contains options for an Envoy route_configuration - protobuffer message - displayName: Route Configuration - path: listener.marin3r.dynamicConfigs[0].routeConfiguration - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: listener.marin3r.dynamicConfigs[0].routeConfiguration.generatorVersion - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: listener.marin3r.dynamicConfigs[0].routeConfiguration.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: listener.marin3r.dynamicConfigs[0].routeConfiguration.rawConfig - - description: The virtual_hosts definitions for this route configuration. Virtual - hosts must be specified using directly Envoy's API - displayName: Virtual Hosts - path: listener.marin3r.dynamicConfigs[0].routeConfiguration.virtualHosts - - description: Runtime contains options for an Envoy runtime protobuffer message - displayName: Runtime - path: listener.marin3r.dynamicConfigs[0].runtime - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: listener.marin3r.dynamicConfigs[0].runtime.generatorVersion - - description: The list of listeners to apply overload protection limits to - displayName: Listener Names - path: listener.marin3r.dynamicConfigs[0].runtime.listenerNames - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: listener.marin3r.dynamicConfigs[0].runtime.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: listener.marin3r.dynamicConfigs[0].runtime.rawConfig - description: The Envoy API version to use displayName: Envoy APIVersion path: listener.marin3r.envoyAPIVersion @@ -2072,129 +1703,6 @@ spec: in the cluster. displayName: Envoy Dynamic Config path: marin3r.dynamicConfigs - - description: Cluster contains options for an Envoy cluster protobuffer message - displayName: Cluster - path: marin3r.dynamicConfigs[0].cluster - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: marin3r.dynamicConfigs[0].cluster.generatorVersion - - description: The upstream host - displayName: Host - path: marin3r.dynamicConfigs[0].cluster.host - - description: Specifies if the upstream cluster is http2 or not (default). - displayName: Is Http2 - path: marin3r.dynamicConfigs[0].cluster.isHttp2 - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: marin3r.dynamicConfigs[0].cluster.name - - description: The upstream port - displayName: Port - path: marin3r.dynamicConfigs[0].cluster.port - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: marin3r.dynamicConfigs[0].cluster.rawConfig - - description: ListenerHttp contains options for an HTTP/HTTPS listener - displayName: Listener Http - path: marin3r.dynamicConfigs[0].listenerHttp - - description: Allow headers with underscores - displayName: Allow Headers With Underscores - path: marin3r.dynamicConfigs[0].listenerHttp.allowHeadersWithUnderscores - - description: The name of the Secret containing a valid certificate. If unset - the listener will be http, if set https - displayName: Certificate Secret Name - path: marin3r.dynamicConfigs[0].listenerHttp.certificateSecretName - - description: If this filed is set, http 1.0 will be enabled and this will - be the default hostname to use. - displayName: Default Host For Http10 - path: marin3r.dynamicConfigs[0].listenerHttp.defaultHostForHttp10 - - description: Enable http2 in the listener.Disabled by default. - displayName: Enable Http2 - path: marin3r.dynamicConfigs[0].listenerHttp.enableHttp2 - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: marin3r.dynamicConfigs[0].listenerHttp.generatorVersion - - description: Max connection duration. If unset no max connection duration - will be applied. - displayName: Max Connection Duration - path: marin3r.dynamicConfigs[0].listenerHttp.maxConnectionDuration - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: marin3r.dynamicConfigs[0].listenerHttp.name - - description: The port where the listener listens for new connections - displayName: Port - path: marin3r.dynamicConfigs[0].listenerHttp.port - - description: Rate limit options for the ratelimit filter of the HTTP connection - manager - displayName: Rate Limit Options - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions - - description: The rate limit domain - displayName: Domain - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.domain - - description: Whether to allow requests or not if the rate limit service is - unavailable - displayName: Failure Mode Deny - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.failureModeDeny - - description: Location of the rate limit service. Must point to one of the - defined clusters. - displayName: Rate Limit Cluster - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.rateLimitCluster - - description: Max time to wait for a response from the rate limit service - displayName: Timeout - path: marin3r.dynamicConfigs[0].listenerHttp.rateLimitOptions.timeout - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: marin3r.dynamicConfigs[0].listenerHttp.rawConfig - - description: The name of the RouteConfiguration to use in the listener - displayName: Route Config Name - path: marin3r.dynamicConfigs[0].listenerHttp.routeConfigName - - description: RouteConfiguration contains options for an Envoy route_configuration - protobuffer message - displayName: Route Configuration - path: marin3r.dynamicConfigs[0].routeConfiguration - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: marin3r.dynamicConfigs[0].routeConfiguration.generatorVersion - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: marin3r.dynamicConfigs[0].routeConfiguration.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: marin3r.dynamicConfigs[0].routeConfiguration.rawConfig - - description: The virtual_hosts definitions for this route configuration. Virtual - hosts must be specified using directly Envoy's API - displayName: Virtual Hosts - path: marin3r.dynamicConfigs[0].routeConfiguration.virtualHosts - - description: Runtime contains options for an Envoy runtime protobuffer message - displayName: Runtime - path: marin3r.dynamicConfigs[0].runtime - - description: GeneratorVersion specifies the version of a given template. "v1" - is the default. - displayName: Generator Version - path: marin3r.dynamicConfigs[0].runtime.generatorVersion - - description: The list of listeners to apply overload protection limits to - displayName: Listener Names - path: marin3r.dynamicConfigs[0].runtime.listenerNames - - description: The name of the configuration/resource. The name is what allows - a configuration to be used from wihin other configuration. - displayName: Name - path: marin3r.dynamicConfigs[0].runtime.name - - description: 'Allows defining configuration using directly envoy''s config - API. WARNING: no validation of this field''s value is performed before writting - the custom resource to etcd.' - displayName: Raw Config - path: marin3r.dynamicConfigs[0].runtime.rawConfig - description: The Envoy API version to use displayName: Envoy APIVersion path: marin3r.envoyAPIVersion diff --git a/config/samples/saas_v1alpha1_echoapi.yaml b/config/samples/saas_v1alpha1_echoapi.yaml index 3b41ccce..36b63adc 100644 --- a/config/samples/saas_v1alpha1_echoapi.yaml +++ b/config/samples/saas_v1alpha1_echoapi.yaml @@ -17,12 +17,12 @@ spec: - name: envoy-metrics port: 9901 dynamicConfigs: - - listenerHttp: - name: http + "http": + listenerHttp: port: 38080 routeConfigName: echo_api - - listenerHttp: - name: https + "https": + listenerHttp: port: 38443 routeConfigName: echo_api certificateSecretName: certificate @@ -30,17 +30,24 @@ spec: domain: echo_api timeout: 10ms rateLimitCluster: test - - routeConfiguration: - name: echo_api - virtualHosts: - - name: echo_api - domains: ["*"] - routes: - - {route: {cluster: echo_api}, match: {prefix: "/"}} - - cluster: - name: echo_api + "echo_api_route": + rawConfig: + type: "routeConfiguration" + value: + name: echo_api_route + virtual_hosts: + - domains: + - "*" + name: echo_api + routes: + - match: + prefix: / + route: + cluster: echo_api + "echo_api_cluster": + cluster: port: 9292 host: 127.0.0.1 - - runtime: - name: runtime + "runtime": + runtime: listenerNames: ["http"] diff --git a/controllers/apicast_controller.go b/controllers/apicast_controller.go index addff565..3cb97b14 100644 --- a/controllers/apicast_controller.go +++ b/controllers/apicast_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" + marin3rv1alpha1 "github.com/3scale-ops/marin3r/apis/marin3r/v1alpha1" saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" grafanav1alpha1 "github.com/3scale/saas-operator/pkg/apis/grafana/v1alpha1" "github.com/3scale/saas-operator/pkg/generators/apicast" @@ -105,5 +106,6 @@ func (r *ApicastReconciler) SetupWithManager(mgr ctrl.Manager) error { Owns(&autoscalingv2.HorizontalPodAutoscaler{}). Owns(&monitoringv1.PodMonitor{}). Owns(&grafanav1alpha1.GrafanaDashboard{}). + Owns(&marin3rv1alpha1.EnvoyConfig{}). Complete(r) } diff --git a/controllers/apicast_controller_suite_test.go b/controllers/apicast_controller_suite_test.go index 49d4750a..5607a2fe 100644 --- a/controllers/apicast_controller_suite_test.go +++ b/controllers/apicast_controller_suite_test.go @@ -259,16 +259,14 @@ var _ = Describe("Apicast controller", func() { ReadinessProbe: &saasv1alpha1.ProbeSpec{}, Marin3r: &saasv1alpha1.Marin3rSidecarSpec{ NodeID: pointer.String("apicast-production"), - EnvoyDynamicConfig: []saasv1alpha1.EnvoyDynamicConfig{{ - ListenerHttp: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "http", - GeneratorVersion: pointer.String("v1"), + EnvoyDynamicConfig: saasv1alpha1.MapOfEnvoyDynamicConfig{ + "http": { + GeneratorVersion: pointer.String("v1"), + ListenerHttp: &saasv1alpha1.ListenerHttp{ + Port: 8080, + RouteConfigName: "route", }, - Port: 8080, - RouteConfigName: "route", - }, - }}, + }}, }, } apicast.Spec.Staging = saasv1alpha1.ApicastEnvironmentSpec{ @@ -286,13 +284,11 @@ var _ = Describe("Apicast controller", func() { ReadinessProbe: &saasv1alpha1.ProbeSpec{}, Marin3r: &saasv1alpha1.Marin3rSidecarSpec{ NodeID: pointer.String("apicast-production"), - EnvoyDynamicConfig: []saasv1alpha1.EnvoyDynamicConfig{ - { + EnvoyDynamicConfig: saasv1alpha1.MapOfEnvoyDynamicConfig{ + "http": { + + GeneratorVersion: pointer.String("v1"), ListenerHttp: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "http", - GeneratorVersion: pointer.String("v1"), - }, Port: 8080, RouteConfigName: "route", }, diff --git a/controllers/backend_controller.go b/controllers/backend_controller.go index ff91c312..e684a98d 100644 --- a/controllers/backend_controller.go +++ b/controllers/backend_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" + marin3rv1alpha1 "github.com/3scale-ops/marin3r/apis/marin3r/v1alpha1" saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" externalsecretsv1beta1 "github.com/3scale/saas-operator/pkg/apis/externalsecrets/v1beta1" grafanav1alpha1 "github.com/3scale/saas-operator/pkg/apis/grafana/v1alpha1" @@ -122,6 +123,7 @@ func (r *BackendReconciler) SetupWithManager(mgr ctrl.Manager) error { Owns(&monitoringv1.PodMonitor{}). Owns(&externalsecretsv1beta1.ExternalSecret{}). Owns(&grafanav1alpha1.GrafanaDashboard{}). + Owns(&marin3rv1alpha1.EnvoyConfig{}). Watches(&source.Kind{Type: &corev1.Secret{TypeMeta: metav1.TypeMeta{Kind: "Secret"}}}, r.SecretEventHandler(&saasv1alpha1.BackendList{}, r.Log)). Complete(r) diff --git a/controllers/backend_controller_suite_test.go b/controllers/backend_controller_suite_test.go index fe5e5b30..5cd03a46 100644 --- a/controllers/backend_controller_suite_test.go +++ b/controllers/backend_controller_suite_test.go @@ -314,16 +314,14 @@ var _ = Describe("Backend controller", func() { backend.Spec.Listener.Marin3r = &saasv1alpha1.Marin3rSidecarSpec{ NodeID: pointer.String("backend-listener"), - EnvoyDynamicConfig: []saasv1alpha1.EnvoyDynamicConfig{{ - ListenerHttp: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "http", - GeneratorVersion: pointer.String("v1"), + EnvoyDynamicConfig: saasv1alpha1.MapOfEnvoyDynamicConfig{ + "http": { + GeneratorVersion: pointer.String("v1"), + ListenerHttp: &saasv1alpha1.ListenerHttp{ + Port: 8080, + RouteConfigName: "route", }, - Port: 8080, - RouteConfigName: "route", - }, - }}, + }}, } return k8sClient.Patch(context.Background(), backend, patch) diff --git a/controllers/echoapi_controller.go b/controllers/echoapi_controller.go index af8b184a..b191b199 100644 --- a/controllers/echoapi_controller.go +++ b/controllers/echoapi_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" + marin3rv1alpha1 "github.com/3scale-ops/marin3r/apis/marin3r/v1alpha1" saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" grafanav1alpha1 "github.com/3scale/saas-operator/pkg/apis/grafana/v1alpha1" "github.com/3scale/saas-operator/pkg/generators/echoapi" @@ -96,5 +97,6 @@ func (r *EchoAPIReconciler) SetupWithManager(mgr ctrl.Manager) error { Owns(&autoscalingv2.HorizontalPodAutoscaler{}). Owns(&monitoringv1.PodMonitor{}). Owns(&grafanav1alpha1.GrafanaDashboard{}). + Owns(&marin3rv1alpha1.EnvoyConfig{}). Complete(r) } diff --git a/controllers/echoapi_controller_suite_test.go b/controllers/echoapi_controller_suite_test.go index b480cb41..a8e536a4 100644 --- a/controllers/echoapi_controller_suite_test.go +++ b/controllers/echoapi_controller_suite_test.go @@ -126,16 +126,14 @@ var _ = Describe("EchoAPI controller", func() { echoapi.Spec.Marin3r = &saasv1alpha1.Marin3rSidecarSpec{ NodeID: pointer.String("echo-api"), - EnvoyDynamicConfig: []saasv1alpha1.EnvoyDynamicConfig{{ - ListenerHttp: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "http", - GeneratorVersion: pointer.String("v1"), + EnvoyDynamicConfig: saasv1alpha1.MapOfEnvoyDynamicConfig{ + "http": { + GeneratorVersion: pointer.String("v1"), + ListenerHttp: &saasv1alpha1.ListenerHttp{ + Port: 8080, + RouteConfigName: "route", }, - Port: 8080, - RouteConfigName: "route", - }, - }}, + }}, } return k8sClient.Patch(context.Background(), echoapi, patch) diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 496aedad..b3f0c401 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -18,6 +18,8 @@ package controllers import ( "context" + "crypto/rand" + "math/big" "path/filepath" "testing" "time" @@ -73,8 +75,9 @@ var _ = BeforeSuite(func() { }, } - seed := GinkgoRandomSeed() + int64(GinkgoParallelProcess()) - nameGenerator = namegenerator.NewNameGenerator(seed) + nBig, err := rand.Int(rand.Reader, big.NewInt(1000000)) + Expect(err).NotTo(HaveOccurred()) + nameGenerator = namegenerator.NewNameGenerator(nBig.Int64()) cfg, err := testEnv.Start() Expect(err).NotTo(HaveOccurred()) diff --git a/docs/api-reference/reference.asciidoc b/docs/api-reference/reference.asciidoc index b7dd0fb6..fb8802ea 100644 --- a/docs/api-reference/reference.asciidoc +++ b/docs/api-reference/reference.asciidoc @@ -434,8 +434,6 @@ Cluster contains options for an Envoy cluster protobuffer message [cols="25a,75a", options="header"] |=== | Field | Description -| *`EnvoyDynamicConfigMeta`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigmeta[$$EnvoyDynamicConfigMeta$$]__ | -| *`EnvoyDynamicConfigRaw`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigraw[$$EnvoyDynamicConfigRaw$$]__ | | *`host`* __string__ | The upstream host | *`port`* __integer__ | The upstream port | *`isHttp2`* __boolean__ | Specifies if the upstream cluster is http2 or not (default). @@ -544,51 +542,12 @@ Endpoint sets the external endpoint for the component [cols="25a,75a", options="header"] |=== | Field | Description +| *`generatorVersion`* __string__ | GeneratorVersion specifies the version of a given template. "v1" is the default. | *`listenerHttp`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-listenerhttp[$$ListenerHttp$$]__ | ListenerHttp contains options for an HTTP/HTTPS listener | *`routeConfiguration`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-routeconfiguration[$$RouteConfiguration$$]__ | RouteConfiguration contains options for an Envoy route_configuration protobuffer message | *`cluster`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-cluster[$$Cluster$$]__ | Cluster contains options for an Envoy cluster protobuffer message | *`runtime`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-runtime[$$Runtime$$]__ | Runtime contains options for an Envoy runtime protobuffer message -|=== - - -[id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigmeta"] -==== EnvoyDynamicConfigMeta - - - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-cluster[$$Cluster$$] -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-listenerhttp[$$ListenerHttp$$] -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-routeconfiguration[$$RouteConfiguration$$] -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-runtime[$$Runtime$$] -**** - -[cols="25a,75a", options="header"] -|=== -| Field | Description -| *`name`* __string__ | The name of the configuration/resource. The name is what allows a configuration to be used from wihin other configuration. -| *`generatorVersion`* __string__ | GeneratorVersion specifies the version of a given template. "v1" is the default. -|=== - - -[id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigraw"] -==== EnvoyDynamicConfigRaw - -EnvoyDynamicConfigRaw is a struct with methods to manage a configuration defined using directly the Envoy config API - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-cluster[$$Cluster$$] -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-listenerhttp[$$ListenerHttp$$] -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-routeconfiguration[$$RouteConfiguration$$] -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-runtime[$$Runtime$$] -**** - -[cols="25a,75a", options="header"] -|=== -| Field | Description -| *`rawConfig`* __RawExtension__ | Allows defining configuration using directly envoy's config API. WARNING: no validation of this field's value is performed before writting the custom resource to etcd. +| *`rawConfig`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-rawconfig[$$RawConfig$$]__ | |=== @@ -770,9 +729,8 @@ ListenerHttp contains options for an HTTP/HTTPS listener [cols="25a,75a", options="header"] |=== | Field | Description -| *`EnvoyDynamicConfigMeta`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigmeta[$$EnvoyDynamicConfigMeta$$]__ | -| *`EnvoyDynamicConfigRaw`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigraw[$$EnvoyDynamicConfigRaw$$]__ | | *`port`* __integer__ | The port where the listener listens for new connections +| *`proxyProtocol`* __boolean__ | Whether proxy protocol should be enabled or not. Defaults to true. | *`routeConfigName`* __string__ | The name of the RouteConfiguration to use in the listener | *`certificateSecretName`* __string__ | The name of the Secret containing a valid certificate. If unset the listener will be http, if set https | *`rateLimitOptions`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-ratelimitoptions[$$RateLimitOptions$$]__ | Rate limit options for the ratelimit filter of the HTTP connection manager @@ -837,6 +795,8 @@ LoadBalancerSpec configures the AWS load balancer for the component |=== + + [id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-mappingservice"] ==== MappingService @@ -929,7 +889,7 @@ Marin3rSidecarSpec defines the marin3r sidecar for the component | *`shtdnmgrPort`* __integer__ | The port where Marin3r's shutdown manager listens | *`shtdnmgrExtraLifecycleHooks`* __string array__ | Extra containers to sync with the shutdown manager upon pod termination | *`extraPodAnnotations`* __object (keys:string, values:string)__ | Extra annotations to pass the Pod to further configure the sidecar container. -| *`dynamicConfigs`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfig[$$EnvoyDynamicConfig$$] array__ | Envoy dynamic configuration. Populating this field causes the operator to create a Marin3r EnvoyConfig resource, so Marin3r must be installed in the cluster. +| *`dynamicConfigs`* __object (keys:string, values:xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfig[$$EnvoyDynamicConfig$$])__ | Envoy dynamic configuration. Populating this field causes the operator to create a Marin3r EnvoyConfig resource, so Marin3r must be installed in the cluster. |=== @@ -1077,12 +1037,30 @@ RateLimitOptions contains options for the ratelimit filter of the http connectio |=== | Field | Description | *`domain`* __string__ | The rate limit domain -| *`failureModeDeny`* __boolean__ | Whether to allow requests or not if the rate limit service is unavailable +| *`failureModeDeny`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-bool[$$bool$$]__ | Whether to allow requests or not if the rate limit service is unavailable | *`timeout`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#duration-v1-meta[$$Duration$$]__ | Max time to wait for a response from the rate limit service | *`rateLimitCluster`* __string__ | Location of the rate limit service. Must point to one of the defined clusters. |=== +[id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-rawconfig"] +==== RawConfig + +RawConfig is a struct with methods to manage a configuration defined using directly the Envoy config API + +.Appears In: +**** +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfig[$$EnvoyDynamicConfig$$] +**** + +[cols="25a,75a", options="header"] +|=== +| Field | Description +| *`type`* __string__ | Type is the type url for the protobuf message +| *`value`* __xref:{anchor_prefix}-k8s-io-apimachinery-pkg-runtime-rawextension[$$RawExtension$$]__ | Allows defining configuration using directly envoy's config API. WARNING: no validation of this field's value is performed before writting the custom resource to etcd. +|=== + + [id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-redhatcustomerportalspec"] ==== RedHatCustomerPortalSpec @@ -1251,8 +1229,6 @@ RouteConfiguration contains options for an Envoy route_configuration protobuffer [cols="25a,75a", options="header"] |=== | Field | Description -| *`EnvoyDynamicConfigMeta`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigmeta[$$EnvoyDynamicConfigMeta$$]__ | -| *`EnvoyDynamicConfigRaw`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigraw[$$EnvoyDynamicConfigRaw$$]__ | | *`virtualHosts`* __xref:{anchor_prefix}-k8s-io-apimachinery-pkg-runtime-rawextension[$$RawExtension$$] array__ | The virtual_hosts definitions for this route configuration. Virtual hosts must be specified using directly Envoy's API |=== @@ -1270,8 +1246,6 @@ Runtime contains options for an Envoy runtime protobuffer message [cols="25a,75a", options="header"] |=== | Field | Description -| *`EnvoyDynamicConfigMeta`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigmeta[$$EnvoyDynamicConfigMeta$$]__ | -| *`EnvoyDynamicConfigRaw`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-envoydynamicconfigraw[$$EnvoyDynamicConfigRaw$$]__ | | *`listenerNames`* __string array__ | The list of listeners to apply overload protection limits to |=== diff --git a/go.mod b/go.mod index a8923612..1407d175 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 github.com/go-redis/redis/v8 v8.11.5 github.com/go-test/deep v1.0.8 + github.com/golang/protobuf v1.5.2 github.com/google/go-cmp v0.5.9 github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e github.com/kelseyhightower/envconfig v1.4.0 @@ -63,7 +64,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.2 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/gofuzz v1.1.0 // indirect github.com/google/uuid v1.1.2 // indirect diff --git a/pkg/generators/apicast/generator.go b/pkg/generators/apicast/generator.go index b30baf22..e66c8332 100644 --- a/pkg/generators/apicast/generator.go +++ b/pkg/generators/apicast/generator.go @@ -9,6 +9,7 @@ import ( basereconciler "github.com/3scale/saas-operator/pkg/reconcilers/basereconciler/v2" basereconciler_resources "github.com/3scale/saas-operator/pkg/reconcilers/basereconciler/v2/resources" "github.com/3scale/saas-operator/pkg/reconcilers/workloads" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" "github.com/3scale/saas-operator/pkg/resource_builders/grafanadashboard" "github.com/3scale/saas-operator/pkg/resource_builders/podmonitor" monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" @@ -206,6 +207,6 @@ func (gen *EnvGenerator) TrafficSelector() map[string]string { fmt.Sprintf("%s/traffic", saasv1alpha1.GroupVersion.Group): gen.GetComponent(), } } -func (gen *EnvGenerator) EnvoyDynamicConfigurations() []saasv1alpha1.EnvoyDynamicConfig { - return gen.Spec.Marin3r.EnvoyDynamicConfig +func (gen *EnvGenerator) EnvoyDynamicConfigurations() []descriptor.EnvoyDynamicConfigDescriptor { + return gen.Spec.Marin3r.EnvoyDynamicConfig.AsList() } diff --git a/pkg/generators/backend/generator.go b/pkg/generators/backend/generator.go index 2af480ef..1428b158 100644 --- a/pkg/generators/backend/generator.go +++ b/pkg/generators/backend/generator.go @@ -10,6 +10,7 @@ import ( "github.com/3scale/saas-operator/pkg/reconcilers/basereconciler/v2" basereconciler_resources "github.com/3scale/saas-operator/pkg/reconcilers/basereconciler/v2/resources" "github.com/3scale/saas-operator/pkg/reconcilers/workloads" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" "github.com/3scale/saas-operator/pkg/resource_builders/grafanadashboard" "github.com/3scale/saas-operator/pkg/resource_builders/pod" "github.com/3scale/saas-operator/pkg/resource_builders/podmonitor" @@ -248,8 +249,8 @@ func (gen *ListenerGenerator) TrafficSelector() map[string]string { fmt.Sprintf("%s/traffic", saasv1alpha1.GroupVersion.Group): fmt.Sprintf("%s-%s", component, listener), } } -func (gen *ListenerGenerator) EnvoyDynamicConfigurations() []saasv1alpha1.EnvoyDynamicConfig { - return gen.ListenerSpec.Marin3r.EnvoyDynamicConfig +func (gen *ListenerGenerator) EnvoyDynamicConfigurations() []descriptor.EnvoyDynamicConfigDescriptor { + return gen.ListenerSpec.Marin3r.EnvoyDynamicConfig.AsList() } // WorkerGenerator has methods to generate resources for a diff --git a/pkg/generators/echoapi/generator.go b/pkg/generators/echoapi/generator.go index 7fd75fa2..7de9459c 100644 --- a/pkg/generators/echoapi/generator.go +++ b/pkg/generators/echoapi/generator.go @@ -7,6 +7,7 @@ import ( "github.com/3scale/saas-operator/pkg/generators" basereconciler_resources "github.com/3scale/saas-operator/pkg/reconcilers/basereconciler/v2/resources" "github.com/3scale/saas-operator/pkg/reconcilers/workloads" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" "github.com/3scale/saas-operator/pkg/resource_builders/podmonitor" monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" ) @@ -82,6 +83,6 @@ func (gen *Generator) MonitoredEndpoints() []monitoringv1.PodMetricsEndpoint { } } -func (gen *Generator) EnvoyDynamicConfigurations() []saasv1alpha1.EnvoyDynamicConfig { - return gen.Spec.Marin3r.EnvoyDynamicConfig +func (gen *Generator) EnvoyDynamicConfigurations() []descriptor.EnvoyDynamicConfigDescriptor { + return gen.Spec.Marin3r.EnvoyDynamicConfig.AsList() } diff --git a/pkg/reconcilers/basereconciler/v2/test/suite_test.go b/pkg/reconcilers/basereconciler/v2/test/suite_test.go index 609a7779..49a21941 100644 --- a/pkg/reconcilers/basereconciler/v2/test/suite_test.go +++ b/pkg/reconcilers/basereconciler/v2/test/suite_test.go @@ -18,6 +18,8 @@ package test import ( "context" + "crypto/rand" + "math/big" "path/filepath" "testing" "time" @@ -72,8 +74,9 @@ var _ = BeforeSuite(func() { }, } - seed := GinkgoRandomSeed() + int64(GinkgoParallelProcess()) - nameGenerator = namegenerator.NewNameGenerator(seed) + nBig, err := rand.Int(rand.Reader, big.NewInt(1000000)) + Expect(err).NotTo(HaveOccurred()) + nameGenerator = namegenerator.NewNameGenerator(nBig.Int64()) cfg, err := testEnv.Start() Expect(err).NotTo(HaveOccurred()) diff --git a/pkg/reconcilers/workloads/interfaces.go b/pkg/reconcilers/workloads/interfaces.go index 85039358..8ded5d00 100644 --- a/pkg/reconcilers/workloads/interfaces.go +++ b/pkg/reconcilers/workloads/interfaces.go @@ -3,6 +3,7 @@ package workloads import ( saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" "github.com/3scale/saas-operator/pkg/reconcilers/basereconciler/v2/resources" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" "k8s.io/apimachinery/pkg/types" ) @@ -51,7 +52,7 @@ type WithTraffic interface { type WithEnvoySidecar interface { WithWorkloadMeta - EnvoyDynamicConfigurations() []saasv1alpha1.EnvoyDynamicConfig + EnvoyDynamicConfigurations() []descriptor.EnvoyDynamicConfigDescriptor } type DeploymentWorkload interface { diff --git a/pkg/reconcilers/workloads/resources.go b/pkg/reconcilers/workloads/resources.go index 59745434..24379e2a 100644 --- a/pkg/reconcilers/workloads/resources.go +++ b/pkg/reconcilers/workloads/resources.go @@ -5,6 +5,8 @@ import ( saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" basereconciler_resources "github.com/3scale/saas-operator/pkg/reconcilers/basereconciler/v2/resources" "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" + "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/factory" "github.com/3scale/saas-operator/pkg/resource_builders/hpa" "github.com/3scale/saas-operator/pkg/resource_builders/pdb" "github.com/3scale/saas-operator/pkg/resource_builders/podmonitor" @@ -260,9 +262,9 @@ func NewEnvoyConfigTemplate(t basereconciler_resources.EnvoyConfigTemplate) Envo return EnvoyConfigTemplate{EnvoyConfigTemplate: t} } -func NewEnvoyConfigTemplateFromEnvoyResources(eres []saasv1alpha1.EnvoyDynamicConfig) EnvoyConfigTemplate { +func NewEnvoyConfigTemplateFromEnvoyResources(configs []descriptor.EnvoyDynamicConfigDescriptor) EnvoyConfigTemplate { return NewEnvoyConfigTemplate(basereconciler_resources.EnvoyConfigTemplate{ - Template: envoyconfig.New(EmptyKey, EmptyKey.Name, eres...), - IsEnabled: len(eres) > 0, + Template: envoyconfig.New(EmptyKey, EmptyKey.Name, factory.Default(), configs...), + IsEnabled: len(configs) > 0, }) } diff --git a/pkg/reconcilers/workloads/test/suite_test.go b/pkg/reconcilers/workloads/test/suite_test.go index cd7b832f..b5717265 100644 --- a/pkg/reconcilers/workloads/test/suite_test.go +++ b/pkg/reconcilers/workloads/test/suite_test.go @@ -18,6 +18,8 @@ package test import ( "context" + "crypto/rand" + "math/big" "path/filepath" "testing" "time" @@ -70,8 +72,9 @@ var _ = BeforeSuite(func() { }, } - seed := GinkgoRandomSeed() + int64(GinkgoParallelProcess()) - nameGenerator = namegenerator.NewNameGenerator(seed) + nBig, err := rand.Int(rand.Reader, big.NewInt(1000000)) + Expect(err).NotTo(HaveOccurred()) + nameGenerator = namegenerator.NewNameGenerator(nBig.Int64()) cfg, err := testEnv.Start() Expect(err).NotTo(HaveOccurred()) diff --git a/pkg/resource_builders/envoyconfig/secrets.go b/pkg/resource_builders/envoyconfig/auto/secrets.go similarity index 94% rename from pkg/resource_builders/envoyconfig/secrets.go rename to pkg/resource_builders/envoyconfig/auto/secrets.go index a4f06d39..8bcc1dfe 100644 --- a/pkg/resource_builders/envoyconfig/secrets.go +++ b/pkg/resource_builders/envoyconfig/auto/secrets.go @@ -1,4 +1,4 @@ -package envoyconfig +package auto import ( marin3rv1alpha1 "github.com/3scale-ops/marin3r/apis/marin3r/v1alpha1" @@ -8,26 +8,7 @@ import ( envoy_extensions_transport_sockets_tls_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" ) -func secretRefsFromListener(listener *envoy_config_listener_v3.Listener) ([]string, error) { - - if listener.FilterChains[0].TransportSocket == nil { - return nil, nil - } - - secrets := []string{} - proto, err := listener.FilterChains[0].TransportSocket.GetTypedConfig().UnmarshalNew() - if err != nil { - return nil, err - } - tlsContext := proto.(*envoy_extensions_transport_sockets_tls_v3.DownstreamTlsContext) - for _, sdsConfig := range tlsContext.CommonTlsContext.TlsCertificateSdsSecretConfigs { - secrets = append(secrets, sdsConfig.Name) - } - - return util.Unique(secrets), nil -} - -func generateSecrets(resources []envoy.Resource) ([]marin3rv1alpha1.EnvoySecretResource, error) { +func GenerateSecrets(resources []envoy.Resource) ([]marin3rv1alpha1.EnvoySecretResource, error) { refs := []string{} @@ -43,7 +24,6 @@ func generateSecrets(resources []envoy.Resource) ([]marin3rv1alpha1.EnvoySecretR refs = append(refs, secrets...) } - } secrets := []marin3rv1alpha1.EnvoySecretResource{} @@ -53,3 +33,22 @@ func generateSecrets(resources []envoy.Resource) ([]marin3rv1alpha1.EnvoySecretR return secrets, nil } + +func secretRefsFromListener(listener *envoy_config_listener_v3.Listener) ([]string, error) { + + if listener.FilterChains[0].TransportSocket == nil { + return nil, nil + } + + secrets := []string{} + proto, err := listener.FilterChains[0].TransportSocket.GetTypedConfig().UnmarshalNew() + if err != nil { + return nil, err + } + tlsContext := proto.(*envoy_extensions_transport_sockets_tls_v3.DownstreamTlsContext) + for _, sdsConfig := range tlsContext.CommonTlsContext.TlsCertificateSdsSecretConfigs { + secrets = append(secrets, sdsConfig.Name) + } + + return util.Unique(secrets), nil +} diff --git a/pkg/resource_builders/envoyconfig/secrets_test.go b/pkg/resource_builders/envoyconfig/auto/secrets_test.go similarity index 55% rename from pkg/resource_builders/envoyconfig/secrets_test.go rename to pkg/resource_builders/envoyconfig/auto/secrets_test.go index 62f4f83a..a035ca69 100644 --- a/pkg/resource_builders/envoyconfig/secrets_test.go +++ b/pkg/resource_builders/envoyconfig/auto/secrets_test.go @@ -1,4 +1,4 @@ -package envoyconfig +package auto import ( "reflect" @@ -7,6 +7,7 @@ import ( marin3rv1alpha1 "github.com/3scale-ops/marin3r/apis/marin3r/v1alpha1" "github.com/3scale-ops/marin3r/pkg/envoy" saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" + "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/templates" envoy_config_listener_v3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" "k8s.io/utils/pointer" ) @@ -25,12 +26,12 @@ func Test_secretRefsFromListener(t *testing.T) { name: "returns the list of secrets used by the listener", args: args{ listener: func() *envoy_config_listener_v3.Listener { - l, _ := ListenerHTTP_v1(&saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "test"}, - Port: 8080, - RouteConfigName: "my_route", - CertificateSecretName: pointer.String("my_certificate"), - EnableHttp2: pointer.Bool(false), + l, _ := templates.ListenerHTTP_v1("test", &saasv1alpha1.ListenerHttp{ + Port: 8080, + RouteConfigName: "my_route", + CertificateSecretName: pointer.String("my_certificate"), + EnableHttp2: pointer.Bool(false), + ProxyProtocol: pointer.Bool(false), }) return l.(*envoy_config_listener_v3.Listener) }(), @@ -53,7 +54,7 @@ func Test_secretRefsFromListener(t *testing.T) { } } -func Test_generateSecrets(t *testing.T) { +func TestGenerateSecrets(t *testing.T) { type args struct { resources []envoy.Resource } @@ -68,32 +69,32 @@ func Test_generateSecrets(t *testing.T) { args: args{ resources: []envoy.Resource{ func() envoy.Resource { - l, _ := ListenerHTTP_v1(&saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "test1"}, - Port: 8080, - RouteConfigName: "my_route", - CertificateSecretName: pointer.String("cert1"), - EnableHttp2: pointer.Bool(false), + l, _ := templates.ListenerHTTP_v1("test1", &saasv1alpha1.ListenerHttp{ + Port: 8080, + RouteConfigName: "my_route", + CertificateSecretName: pointer.String("cert1"), + EnableHttp2: pointer.Bool(false), + ProxyProtocol: pointer.Bool(false), }) return l }(), func() envoy.Resource { - l, _ := ListenerHTTP_v1(&saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "test2"}, - Port: 8081, - RouteConfigName: "my_route", - CertificateSecretName: pointer.String("cert2"), - EnableHttp2: pointer.Bool(false), + l, _ := templates.ListenerHTTP_v1("test2", &saasv1alpha1.ListenerHttp{ + Port: 8081, + RouteConfigName: "my_route", + CertificateSecretName: pointer.String("cert2"), + EnableHttp2: pointer.Bool(false), + ProxyProtocol: pointer.Bool(false), }) return l }(), func() envoy.Resource { - l, _ := ListenerHTTP_v1(&saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "test3"}, - Port: 8082, - RouteConfigName: "my_route", - CertificateSecretName: pointer.String("cert1"), - EnableHttp2: pointer.Bool(false), + l, _ := templates.ListenerHTTP_v1("test3", &saasv1alpha1.ListenerHttp{ + Port: 8082, + RouteConfigName: "my_route", + CertificateSecretName: pointer.String("cert1"), + EnableHttp2: pointer.Bool(false), + ProxyProtocol: pointer.Bool(false), }) return l }(), @@ -108,13 +109,13 @@ func Test_generateSecrets(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := generateSecrets(tt.args.resources) + got, err := GenerateSecrets(tt.args.resources) if (err != nil) != tt.wantErr { - t.Errorf("generateSecrets() error = %v, wantErr %v", err, tt.wantErr) + t.Errorf("GenerateSecrets() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { - t.Errorf("generateSecrets() = %v, want %v", got, tt.want) + t.Errorf("GenerateSecrets() = %v, want %v", got, tt.want) } }) } diff --git a/pkg/resource_builders/envoyconfig/descriptor/interface.go b/pkg/resource_builders/envoyconfig/descriptor/interface.go new file mode 100644 index 00000000..18bcbb77 --- /dev/null +++ b/pkg/resource_builders/envoyconfig/descriptor/interface.go @@ -0,0 +1,9 @@ +package envoyconfig + +// EnvoyDynamicConfigDescriptor is a struct that contains +// information to generate an Envoy dynamic configuration +type EnvoyDynamicConfigDescriptor interface { + GetGeneratorVersion() string + GetName() string + GetOptions() interface{} +} diff --git a/pkg/resource_builders/envoyconfig/factory/default.go b/pkg/resource_builders/envoyconfig/factory/default.go new file mode 100644 index 00000000..2792236d --- /dev/null +++ b/pkg/resource_builders/envoyconfig/factory/default.go @@ -0,0 +1,21 @@ +package factory + +import ( + "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/templates" + envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" + envoy_config_listener_v3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" + envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" + envoy_service_runtime_v3 "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3" +) + +var f = EnvoyDynamicConfigFactory{ + "ListenerHttp_v1": RegisterTemplate(templates.ListenerHTTP_v1, &envoy_config_listener_v3.Listener{}), + "Cluster_v1": RegisterTemplate(templates.Cluster_v1, &envoy_config_cluster_v3.Cluster{}), + "RouteConfiguration_v1": RegisterTemplate(templates.RouteConfiguration_v1, &envoy_config_route_v3.RouteConfiguration{}), + "Runtime_v1": RegisterTemplate(templates.Runtime_v1, &envoy_service_runtime_v3.Runtime{}), + "RawConfig_v1": RegisterTemplate(templates.RawConfig_v1, nil), +} + +func Default() EnvoyDynamicConfigFactory { + return f +} diff --git a/pkg/resource_builders/envoyconfig/factory/factory.go b/pkg/resource_builders/envoyconfig/factory/factory.go new file mode 100644 index 00000000..a43faf9e --- /dev/null +++ b/pkg/resource_builders/envoyconfig/factory/factory.go @@ -0,0 +1,55 @@ +package factory + +import ( + "fmt" + "reflect" + + "github.com/3scale-ops/marin3r/pkg/envoy" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" +) + +// EnvoyDynamicConfigClass contains properties to generate specific types +// of Envoy dynamic configurations +type EnvoyDynamicConfigClass struct { + Function func(name string, opts interface{}) (envoy.Resource, error) + Produces envoy.Resource +} + +func RegisterTemplate(f func(name string, opts interface{}) (envoy.Resource, error), p envoy.Resource) *EnvoyDynamicConfigClass { + return &EnvoyDynamicConfigClass{ + Function: f, + Produces: p, + } +} + +// EnvoyDynamicConfigFactory has methods to produce different types of +// Envoy dynamic resources +type EnvoyDynamicConfigFactory map[string]*EnvoyDynamicConfigClass + +// GetClass translates from the external saas-operator API to the internal +// EnvoyDynamicConfigClass that can generate the envoy dynamic resource described +// by the external API +func (factory EnvoyDynamicConfigFactory) GetClass(v descriptor.EnvoyDynamicConfigDescriptor) (*EnvoyDynamicConfigClass, error) { + opts := v.GetOptions() + name := reflect.TypeOf(opts).Elem().Name() + "_" + v.GetGeneratorVersion() + class, ok := factory[name] + if !ok { + return nil, fmt.Errorf("unregistered function for '%s'", name) + } + + return class, nil +} + +func (factory EnvoyDynamicConfigFactory) NewResource(desc descriptor.EnvoyDynamicConfigDescriptor) (envoy.Resource, error) { + + class, err := factory.GetClass(desc) + if err != nil { + return nil, err + } + + resource, err := class.Function(desc.GetName(), desc.GetOptions()) + if err != nil { + return nil, err + } + return resource, nil +} diff --git a/pkg/resource_builders/envoyconfig/factory/factory_test.go b/pkg/resource_builders/envoyconfig/factory/factory_test.go new file mode 100644 index 00000000..628d2ffd --- /dev/null +++ b/pkg/resource_builders/envoyconfig/factory/factory_test.go @@ -0,0 +1,114 @@ +package factory + +import ( + "testing" + + "github.com/3scale-ops/marin3r/pkg/envoy" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" + envoy_service_runtime_v3 "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/structpb" +) + +type unregisteredType struct{ opts *opts } +type opts struct{} + +func (x *unregisteredType) GetOptions() interface{} { return x.opts } +func (x *unregisteredType) GetGeneratorVersion() string { return "" } +func (x *unregisteredType) GetName() string { return "" } + +type testDescriptor struct { + name string + generatorVersion string + opts *testOptions +} + +type testOptions struct { + structpb *structpb.Struct +} + +func (x *testDescriptor) GetOptions() interface{} { return x.opts } +func (x *testDescriptor) GetGeneratorVersion() string { return x.generatorVersion } +func (x *testDescriptor) GetName() string { return x.name } + +func testTemplate(name string, opts interface{}) (envoy.Resource, error) { + o := opts.(*testOptions) + + return &envoy_service_runtime_v3.Runtime{ + Name: name, + Layer: o.structpb, + }, nil +} + +var testFactory = EnvoyDynamicConfigFactory{ + "testOptions_v1": RegisterTemplate(testTemplate, &envoy_service_runtime_v3.Runtime{}), +} + +func TestEnvoyDynamicConfigFactory_NewResource(t *testing.T) { + type args struct { + descriptor descriptor.EnvoyDynamicConfigDescriptor + } + tests := []struct { + name string + factory EnvoyDynamicConfigFactory + args args + want envoy.Resource + wantErr bool + }{ + { + name: "Generates a runtime proto", + factory: testFactory, + args: args{ + descriptor: &testDescriptor{ + name: "test", + generatorVersion: "v1", + opts: &testOptions{ + structpb: func() *structpb.Struct { + l, _ := structpb.NewStruct(map[string]interface{}{ + "key": map[string]interface{}{ + "key": map[string]interface{}{}, + }, + }) + return l + }(), + }, + }, + }, + want: func() envoy.Resource { + return &envoy_service_runtime_v3.Runtime{ + Name: "test", + Layer: func() *structpb.Struct { + l, _ := structpb.NewStruct(map[string]interface{}{ + "key": map[string]interface{}{ + "key": map[string]interface{}{}, + }, + }) + return l + }(), + } + }(), + wantErr: false, + }, + { + name: "Unregistered class", + factory: testFactory, + args: args{ + descriptor: &unregisteredType{}, + }, + want: nil, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := tt.factory.NewResource(tt.args.descriptor) + if (err != nil) != tt.wantErr { + t.Errorf("EnvoyDynamicConfigFactory.NewResource() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !proto.Equal(got, tt.want) { + t.Errorf("EnvoyDynamicConfigFactory.NewResource() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/pkg/resource_builders/envoyconfig/resource.go b/pkg/resource_builders/envoyconfig/resource.go index 2621e14c..d6fafcec 100644 --- a/pkg/resource_builders/envoyconfig/resource.go +++ b/pkg/resource_builders/envoyconfig/resource.go @@ -2,13 +2,14 @@ package envoyconfig import ( "fmt" - "reflect" marin3rv1alpha1 "github.com/3scale-ops/marin3r/apis/marin3r/v1alpha1" "github.com/3scale-ops/marin3r/pkg/envoy" envoy_serializer "github.com/3scale-ops/marin3r/pkg/envoy/serializer" envoy_serializer_v3 "github.com/3scale-ops/marin3r/pkg/envoy/serializer/v3" - saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" + "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/auto" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" + "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/factory" envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" envoy_config_listener_v3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" @@ -19,68 +20,27 @@ import ( "sigs.k8s.io/yaml" ) -var generator = envoyDynamicConfigFactory{ - "ListenerHttp_v1": {ListenerHTTP_v1, &envoy_config_listener_v3.Listener{}}, - "Cluster_v1": {Cluster_v1, &envoy_config_cluster_v3.Cluster{}}, - "RouteConfiguration_v1": {RouteConfiguration_v1, &envoy_config_route_v3.RouteConfiguration{}}, - "Runtime_v1": {Runtime_v1, &envoy_service_runtime_v3.Runtime{}}, -} - -type envoyDynamicConfigDescriptor interface { - GetGeneratorVersion() string - GetName() string - GetRawConfig() []byte -} - -type envoyDynamicConfigGeneratorFn func(envoyDynamicConfigDescriptor) (envoy.Resource, error) - -type envoyDynamicConfigClass struct { - Function envoyDynamicConfigGeneratorFn - Produces envoy.Resource -} +func New(key types.NamespacedName, nodeID string, factory factory.EnvoyDynamicConfigFactory, resources ...descriptor.EnvoyDynamicConfigDescriptor) func() (*marin3rv1alpha1.EnvoyConfig, error) { -type envoyDynamicConfigFactory map[string]envoyDynamicConfigClass - -func (erf envoyDynamicConfigFactory) newResource(functionName string, descriptor envoyDynamicConfigDescriptor) (envoy.Resource, error) { + return func() (*marin3rv1alpha1.EnvoyConfig, error) { + protos := []envoy.Resource{} - class, ok := erf[functionName] - if !ok { - return nil, fmt.Errorf("unregistered class %s", functionName) - } + for _, res := range resources { - if raw := descriptor.GetRawConfig(); raw != nil { + proto, err := factory.NewResource(res) + if err != nil { + return nil, err + } + protos = append(protos, proto) + } - err := envoy_serializer_v3.JSON{}.Unmarshal(string(raw), class.Produces) + ec, err := newFromProtos(key, nodeID, protos)() if err != nil { return nil, err } - return class.Produces, nil - } - - resource, err := class.Function(descriptor) - if err != nil { - return nil, err - } - return resource, nil -} - -func inspect(v *saasv1alpha1.EnvoyDynamicConfig) (string, envoyDynamicConfigDescriptor) { - val := reflect.Indirect(reflect.ValueOf(v)) - for i := 0; i < val.Type().NumField(); i++ { - field := val.Type().Field(i) - if !val.Field(i).IsNil() { - descriptor, ok := val.Field(i).Interface().(envoyDynamicConfigDescriptor) - if !ok { - // this error cannot occur at runtime - panic("not an EnvoyDynamicConfigDescriptor") - } - generatorFnName := field.Name + "_" + descriptor.GetGeneratorVersion() - return generatorFnName, descriptor - } + return ec, nil } - - return "", nil } func newFromProtos(key types.NamespacedName, nodeID string, resources []envoy.Resource) func() (*marin3rv1alpha1.EnvoyConfig, error) { @@ -91,7 +51,7 @@ func newFromProtos(key types.NamespacedName, nodeID string, resources []envoy.Re routes := []marin3rv1alpha1.EnvoyResource{} listeners := []marin3rv1alpha1.EnvoyResource{} runtimes := []marin3rv1alpha1.EnvoyResource{} - secrets, err := generateSecrets(resources) + secrets, err := auto.GenerateSecrets(resources) if err != nil { return nil, err } @@ -122,8 +82,7 @@ func newFromProtos(key types.NamespacedName, nodeID string, resources []envoy.Re runtimes = append(runtimes, marin3rv1alpha1.EnvoyResource{Value: string(y)}) default: - // should never reach this code in runtime - panic(fmt.Errorf("unknown resource type")) + return nil, fmt.Errorf("unknown dynamic configuration type") } } @@ -148,27 +107,3 @@ func newFromProtos(key types.NamespacedName, nodeID string, resources []envoy.Re } } - -func New(key types.NamespacedName, nodeID string, resources ...saasv1alpha1.EnvoyDynamicConfig) func() (*marin3rv1alpha1.EnvoyConfig, error) { - - return func() (*marin3rv1alpha1.EnvoyConfig, error) { - protos := []envoy.Resource{} - - for _, res := range resources { - - fn, descriptor := inspect(&res) - proto, err := generator.newResource(fn, descriptor) - if err != nil { - return nil, err - } - protos = append(protos, proto) - } - - ec, err := newFromProtos(key, nodeID, protos)() - if err != nil { - return nil, err - } - - return ec, nil - } -} diff --git a/pkg/resource_builders/envoyconfig/resource_test.go b/pkg/resource_builders/envoyconfig/resource_test.go index f14e76a5..693bbc02 100644 --- a/pkg/resource_builders/envoyconfig/resource_test.go +++ b/pkg/resource_builders/envoyconfig/resource_test.go @@ -1,7 +1,6 @@ package envoyconfig import ( - "reflect" "testing" "time" @@ -9,6 +8,8 @@ import ( "github.com/3scale-ops/marin3r/pkg/envoy" envoy_serializer "github.com/3scale-ops/marin3r/pkg/envoy/serializer" saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" + descriptor "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/descriptor" + "github.com/3scale/saas-operator/pkg/resource_builders/envoyconfig/factory" "github.com/3scale/saas-operator/pkg/util" "github.com/MakeNowJust/heredoc" envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" @@ -18,11 +19,9 @@ import ( envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" envoy_service_runtime_v3 "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3" "github.com/go-test/deep" - "google.golang.org/protobuf/proto" + structpb "github.com/golang/protobuf/ptypes/struct" "google.golang.org/protobuf/types/known/durationpb" - "google.golang.org/protobuf/types/known/structpb" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/utils/pointer" ) @@ -31,7 +30,8 @@ func TestNew(t *testing.T) { type args struct { key types.NamespacedName nodeID string - resources []saasv1alpha1.EnvoyDynamicConfig + factory factory.EnvoyDynamicConfigFactory + resources []descriptor.EnvoyDynamicConfigDescriptor } tests := []struct { name string @@ -42,34 +42,31 @@ func TestNew(t *testing.T) { { name: "Generates an EnvoyConfig", args: args{ - key: types.NamespacedName{Name: "test", Namespace: "default"}, - nodeID: "test", - resources: []saasv1alpha1.EnvoyDynamicConfig{ - { + key: types.NamespacedName{Name: "test", Namespace: "default"}, + nodeID: "test", + factory: factory.Default(), + resources: saasv1alpha1.MapOfEnvoyDynamicConfig{ + "my_cluster": { + GeneratorVersion: pointer.String("v1"), Cluster: &saasv1alpha1.Cluster{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "my_cluster", - GeneratorVersion: pointer.String("v1"), - }, Host: "localhost", Port: 8080, IsHttp2: pointer.Bool(false), }, }, - { + "my_listener": { + GeneratorVersion: pointer.String("v1"), ListenerHttp: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "my_listener", - GeneratorVersion: pointer.String("v1"), - }, Port: 0, + Port: 0, RouteConfigName: "routeconfig", CertificateSecretName: pointer.String("certificate"), EnableHttp2: pointer.Bool(false), AllowHeadersWithUnderscores: pointer.Bool(true), MaxConnectionDuration: util.Metav1DurationPtr(900 * time.Second), + ProxyProtocol: pointer.Bool(true), }, }, - }, + }.AsList(), }, want: &marin3rv1alpha1.EnvoyConfig{ ObjectMeta: metav1.ObjectMeta{ @@ -169,8 +166,6 @@ func TestNew(t *testing.T) { listener_filters: - name: envoy.filters.listener.tls_inspector - name: envoy.filters.listener.proxy_protocol - typed_config: - '@type': type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol name: my_listener per_connection_buffer_limit_bytes: 32768 `), @@ -186,7 +181,7 @@ func TestNew(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := New(tt.args.key, tt.args.nodeID, tt.args.resources...)() + got, err := New(tt.args.key, tt.args.nodeID, tt.args.factory, tt.args.resources...)() if (err != nil) != tt.wantErr { t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr) return @@ -324,154 +319,3 @@ func Test_newFromProtos(t *testing.T) { }) } } - -func Test_inspect(t *testing.T) { - type args struct { - v *saasv1alpha1.EnvoyDynamicConfig - } - tests := []struct { - name string - args args - want string - want1 interface{} - }{ - { - name: "", - args: args{ - v: &saasv1alpha1.EnvoyDynamicConfig{ - ListenerHttp: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "test", - GeneratorVersion: pointer.String("v1"), - }, - }, - }, - }, - want: "ListenerHttp_v1", - want1: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "test", - GeneratorVersion: pointer.String("v1"), - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, got1 := inspect(tt.args.v) - if got != tt.want { - t.Errorf("inspect() got = %v, want %v", got, tt.want) - } - if !reflect.DeepEqual(got1, tt.want1) { - t.Errorf("inspect() got1 = %+v, want %+v", got1, tt.want1) - } - }) - } -} -func Test_envoyResourceFactory_newResource(t *testing.T) { - type args struct { - functionName string - descriptor envoyDynamicConfigDescriptor - } - tests := []struct { - name string - erf envoyDynamicConfigFactory - args args - want envoy.Resource - wantErr bool - }{ - { - name: "Generates a resource proto", - erf: generator, - args: args{ - functionName: "Runtime_v1", - descriptor: &saasv1alpha1.Runtime{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "test", - GeneratorVersion: pointer.String("v1"), - }, - ListenerNames: []string{"http", "https"}, - }, - }, - want: func() envoy.Resource { - l, _ := structpb.NewStruct(map[string]interface{}{ - "envoy": map[string]interface{}{ - "resource_limits": map[string]interface{}{ - "listener": map[string]interface{}{ - "http": map[string]interface{}{ - "connection_limit": 10000, - }, - "https": map[string]interface{}{ - "connection_limit": 10000, - }, - }, - }, - }, - "overload": map[string]interface{}{ - "global_downstream_max_connections": 50000, - }, - }) - return &envoy_service_runtime_v3.Runtime{ - Name: "test", - Layer: l, - } - }(), - wantErr: false, - }, - { - name: "Returns raw configuration", - erf: generator, - args: args{ - functionName: "Cluster_v1", - descriptor: &saasv1alpha1.Cluster{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{ - Name: "test", - GeneratorVersion: pointer.String("v1"), - }, - EnvoyDynamicConfigRaw: saasv1alpha1.EnvoyDynamicConfigRaw{ - RawConfig: &runtime.RawExtension{ - Raw: []byte(heredoc.Doc(` - { - "load_assignment": { - "cluster_name": "cluster1" - }, - "name": "cluster1" - } - `)), - }, - }, - }, - }, - want: &envoy_config_cluster_v3.Cluster{ - Name: "cluster1", - LoadAssignment: &envoy_config_endpoint_v3.ClusterLoadAssignment{ - ClusterName: "cluster1", - Endpoints: []*envoy_config_endpoint_v3.LocalityLbEndpoints{}, - }, - }, - wantErr: false, - }, - { - name: "Unregistered class", - erf: generator, - args: args{ - functionName: "Runtime_xx", - descriptor: nil, - }, - want: nil, - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := tt.erf.newResource(tt.args.functionName, tt.args.descriptor) - if (err != nil) != tt.wantErr { - t.Errorf("envoyResourceFactory.newResource() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !proto.Equal(got, tt.want) { - t.Errorf("envoyResourceFactory.newResource() = %+v, want %+v", got, tt.want) - } - }) - } -} diff --git a/pkg/resource_builders/envoyconfig/clusters.go b/pkg/resource_builders/envoyconfig/templates/clusters.go similarity index 89% rename from pkg/resource_builders/envoyconfig/clusters.go rename to pkg/resource_builders/envoyconfig/templates/clusters.go index e7943c13..73ee2046 100644 --- a/pkg/resource_builders/envoyconfig/clusters.go +++ b/pkg/resource_builders/envoyconfig/templates/clusters.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( "time" @@ -14,11 +14,11 @@ import ( "google.golang.org/protobuf/types/known/wrapperspb" ) -func Cluster_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) { - opts := desc.(*saasv1alpha1.Cluster) +func Cluster_v1(name string, opts interface{}) (envoy.Resource, error) { + o := opts.(*saasv1alpha1.Cluster) cluster := &envoy_config_cluster_v3.Cluster{ - Name: desc.GetName(), + Name: name, ConnectTimeout: durationpb.New(1 * time.Second), ClusterDiscoveryType: &envoy_config_cluster_v3.Cluster_Type{ Type: envoy_config_cluster_v3.Cluster_STRICT_DNS, @@ -26,14 +26,14 @@ func Cluster_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) { DnsLookupFamily: envoy_config_cluster_v3.Cluster_V4_ONLY, LbPolicy: envoy_config_cluster_v3.Cluster_ROUND_ROBIN, LoadAssignment: &envoy_config_endpoint_v3.ClusterLoadAssignment{ - ClusterName: desc.GetName(), + ClusterName: name, Endpoints: []*envoy_config_endpoint_v3.LocalityLbEndpoints{ { LbEndpoints: []*envoy_config_endpoint_v3.LbEndpoint{ { HostIdentifier: &envoy_config_endpoint_v3.LbEndpoint_Endpoint{ Endpoint: &envoy_config_endpoint_v3.Endpoint{ - Address: Address_v1(opts.Host, opts.Port), + Address: Address_v1(o.Host, o.Port), }, }, }, @@ -43,7 +43,7 @@ func Cluster_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) { }, } - if *opts.IsHttp2 { + if *o.IsHttp2 { any, err := anypb.New(&envoy_extensions_upstreams_http_v3.HttpProtocolOptions{ UpstreamProtocolOptions: &envoy_extensions_upstreams_http_v3.HttpProtocolOptions_ExplicitHttpConfig_{ ExplicitHttpConfig: &envoy_extensions_upstreams_http_v3.HttpProtocolOptions_ExplicitHttpConfig{ diff --git a/pkg/resource_builders/envoyconfig/clusters_test.go b/pkg/resource_builders/envoyconfig/templates/clusters_test.go similarity index 82% rename from pkg/resource_builders/envoyconfig/clusters_test.go rename to pkg/resource_builders/envoyconfig/templates/clusters_test.go index 020c8ddc..3f194906 100644 --- a/pkg/resource_builders/envoyconfig/clusters_test.go +++ b/pkg/resource_builders/envoyconfig/templates/clusters_test.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( "testing" @@ -12,7 +12,8 @@ import ( func TestCluster_v1(t *testing.T) { type args struct { - opts *saasv1alpha1.Cluster + name string + opts interface{} } tests := []struct { name string @@ -22,11 +23,11 @@ func TestCluster_v1(t *testing.T) { { name: "Generates http 1.1 cluster", args: args{ + name: "my_cluster", opts: &saasv1alpha1.Cluster{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "my_cluster"}, - Host: "localhost", - Port: 8080, - IsHttp2: pointer.Bool(false), + Host: "localhost", + Port: 8080, + IsHttp2: pointer.Bool(false), }, }, want: heredoc.Doc(` @@ -48,11 +49,11 @@ func TestCluster_v1(t *testing.T) { { name: "Generates http 1.1 cluster", args: args{ + name: "my_cluster", opts: &saasv1alpha1.Cluster{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "my_cluster"}, - Host: "localhost", - Port: 8080, - IsHttp2: pointer.Bool(true), + Host: "localhost", + Port: 8080, + IsHttp2: pointer.Bool(true), }, }, want: heredoc.Doc(` @@ -81,7 +82,7 @@ func TestCluster_v1(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, _ := Cluster_v1(tt.args.opts) + got, _ := Cluster_v1(tt.args.name, tt.args.opts) j, err := envoy_serializer_v3.JSON{}.Marshal(got) if err != nil { t.Error(err) diff --git a/pkg/resource_builders/envoyconfig/common_messages.go b/pkg/resource_builders/envoyconfig/templates/common_messages.go similarity index 95% rename from pkg/resource_builders/envoyconfig/common_messages.go rename to pkg/resource_builders/envoyconfig/templates/common_messages.go index 1d5c66ca..5efba3d7 100644 --- a/pkg/resource_builders/envoyconfig/common_messages.go +++ b/pkg/resource_builders/envoyconfig/templates/common_messages.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" diff --git a/pkg/resource_builders/envoyconfig/listeners.go b/pkg/resource_builders/envoyconfig/templates/listeners.go similarity index 84% rename from pkg/resource_builders/envoyconfig/listeners.go rename to pkg/resource_builders/envoyconfig/templates/listeners.go index 5cf5e89c..e3cf6b75 100644 --- a/pkg/resource_builders/envoyconfig/listeners.go +++ b/pkg/resource_builders/envoyconfig/templates/listeners.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( "time" @@ -11,7 +11,6 @@ import ( envoy_config_ratelimit_v3 "github.com/envoyproxy/go-control-plane/envoy/config/ratelimit/v3" envoy_extensions_access_loggers_file_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/file/v3" envoy_extensions_filters_http_ratelimit_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ratelimit/v3" - envoy_extensions_filters_listener_proxy_protocol_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/listener/proxy_protocol/v3" http_connection_manager_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" envoy_extensions_transport_sockets_tls_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" "google.golang.org/protobuf/types/known/anypb" @@ -20,13 +19,13 @@ import ( "google.golang.org/protobuf/types/known/wrapperspb" ) -func ListenerHTTP_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) { - opts := desc.(*saasv1alpha1.ListenerHttp) +func ListenerHTTP_v1(name string, opts interface{}) (envoy.Resource, error) { + o := opts.(*saasv1alpha1.ListenerHttp) listener := &envoy_config_listener_v3.Listener{ - Name: desc.GetName(), - Address: Address_v1("0.0.0.0", opts.Port), - ListenerFilters: ListenerFilters_v1(opts.CertificateSecretName != nil), + Name: name, + Address: Address_v1("0.0.0.0", o.Port), + ListenerFilters: ListenerFilters_v1(o.CertificateSecretName != nil, *o.ProxyProtocol), FilterChains: []*envoy_config_listener_v3.FilterChain{{ Filters: []*envoy_config_listener_v3.Filter{{ Name: "envoy.filters.network.http_connection_manager", @@ -34,15 +33,15 @@ func ListenerHTTP_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) TypedConfig: func() *anypb.Any { any, err := anypb.New( &http_connection_manager_v3.HttpConnectionManager{ - AccessLog: AccessLogConfig_v1(desc.GetName(), opts.CertificateSecretName != nil), + AccessLog: AccessLogConfig_v1(name, o.CertificateSecretName != nil), CommonHttpProtocolOptions: func() *envoy_config_core_v3.HttpProtocolOptions { po := &envoy_config_core_v3.HttpProtocolOptions{ IdleTimeout: durationpb.New(3600 * time.Second), } - if opts.MaxConnectionDuration != nil { - po.MaxConnectionDuration = durationpb.New(opts.MaxConnectionDuration.Duration) + if o.MaxConnectionDuration != nil { + po.MaxConnectionDuration = durationpb.New(o.MaxConnectionDuration.Duration) } - if opts.AllowHeadersWithUnderscores != nil && *opts.AllowHeadersWithUnderscores { + if o.AllowHeadersWithUnderscores != nil && *o.AllowHeadersWithUnderscores { po.HeadersWithUnderscoresAction = envoy_config_core_v3.HttpProtocolOptions_ALLOW } else { po.HeadersWithUnderscoresAction = envoy_config_core_v3.HttpProtocolOptions_REJECT_REQUEST @@ -50,12 +49,12 @@ func ListenerHTTP_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) return po }(), - HttpFilters: HttpFilters_v1(opts.RateLimitOptions), + HttpFilters: HttpFilters_v1(o.RateLimitOptions), HttpProtocolOptions: func() *envoy_config_core_v3.Http1ProtocolOptions { - if opts.DefaultHostForHttp10 != nil { + if o.DefaultHostForHttp10 != nil { return &envoy_config_core_v3.Http1ProtocolOptions{ AcceptHttp_10: true, - DefaultHostForHttp_10: *opts.DefaultHostForHttp10, + DefaultHostForHttp_10: *o.DefaultHostForHttp10, } } return &envoy_config_core_v3.Http1ProtocolOptions{} @@ -66,10 +65,10 @@ func ListenerHTTP_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) InitialConnectionWindowSize: wrapperspb.UInt32(1048576), // 1 MiB }, RequestTimeout: durationpb.New(300 * time.Second), - RouteSpecifier: RouteConfigFromAds_v1(opts.RouteConfigName), - StatPrefix: desc.GetName(), + RouteSpecifier: RouteConfigFromAds_v1(o.RouteConfigName), + StatPrefix: name, StreamIdleTimeout: durationpb.New(300 * time.Second), - UseRemoteAddress: wrapperspb.Bool(true), + UseRemoteAddress: wrapperspb.Bool(*o.ProxyProtocol), }) if err != nil { panic(err) @@ -83,37 +82,28 @@ func ListenerHTTP_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) } // Apply TLS config if this is a HTTPS listener - if opts.CertificateSecretName != nil { - listener.FilterChains[0].TransportSocket = TransportSocket_v1(*opts.CertificateSecretName, *opts.EnableHttp2) + if o.CertificateSecretName != nil { + listener.FilterChains[0].TransportSocket = TransportSocket_v1(*o.CertificateSecretName, *o.EnableHttp2) } return listener, nil } -func ListenerFilters_v1(tls bool) []*envoy_config_listener_v3.ListenerFilter { +func ListenerFilters_v1(tls, proxyProtocol bool) []*envoy_config_listener_v3.ListenerFilter { filters := []*envoy_config_listener_v3.ListenerFilter{} if tls { filters = append(filters, &envoy_config_listener_v3.ListenerFilter{ Name: "envoy.filters.listener.tls_inspector", }) } - filters = append(filters, &envoy_config_listener_v3.ListenerFilter{ - Name: "envoy.filters.listener.proxy_protocol", - ConfigType: &envoy_config_listener_v3.ListenerFilter_TypedConfig{ - TypedConfig: func() *anypb.Any { - any, err := anypb.New(&envoy_extensions_filters_listener_proxy_protocol_v3.ProxyProtocol{}) - if err != nil { - panic(err) - } - return any - }(), - }, - }) + if proxyProtocol { + filters = append(filters, &envoy_config_listener_v3.ListenerFilter{ + Name: "envoy.filters.listener.proxy_protocol", + }) + } return filters } -func HTTPConnectionManager() {} - func RouteConfigFromAds_v1(name string) *http_connection_manager_v3.HttpConnectionManager_Rds { return &http_connection_manager_v3.HttpConnectionManager_Rds{ Rds: &http_connection_manager_v3.Rds{ diff --git a/pkg/resource_builders/envoyconfig/listeners_test.go b/pkg/resource_builders/envoyconfig/templates/listeners_test.go similarity index 93% rename from pkg/resource_builders/envoyconfig/listeners_test.go rename to pkg/resource_builders/envoyconfig/templates/listeners_test.go index 5e68e874..7a8b170d 100644 --- a/pkg/resource_builders/envoyconfig/listeners_test.go +++ b/pkg/resource_builders/envoyconfig/templates/listeners_test.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( "testing" @@ -15,6 +15,7 @@ import ( func TestListenerHTTP_v1(t *testing.T) { type args struct { + name string opts *saasv1alpha1.ListenerHttp } tests := []struct { @@ -25,11 +26,11 @@ func TestListenerHTTP_v1(t *testing.T) { { name: "Generates https listener", args: args{ + name: "test", opts: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "test"}, - Port: 8080, - RouteConfigName: "my_route", - CertificateSecretName: pointer.String("my_certificate"), + Port: 8080, + RouteConfigName: "my_route", + CertificateSecretName: pointer.String("my_certificate"), RateLimitOptions: &saasv1alpha1.RateLimitOptions{ Domain: "test_domain", FailureModeDeny: pointer.Bool(true), @@ -40,6 +41,7 @@ func TestListenerHTTP_v1(t *testing.T) { EnableHttp2: pointer.Bool(false), AllowHeadersWithUnderscores: pointer.Bool(true), MaxConnectionDuration: util.Metav1DurationPtr(900 * time.Second), + ProxyProtocol: pointer.Bool(true), }, }, want: heredoc.Doc(` @@ -125,8 +127,6 @@ func TestListenerHTTP_v1(t *testing.T) { listener_filters: - name: envoy.filters.listener.tls_inspector - name: envoy.filters.listener.proxy_protocol - typed_config: - '@type': type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol name: test per_connection_buffer_limit_bytes: 32768 `), @@ -134,10 +134,10 @@ func TestListenerHTTP_v1(t *testing.T) { { name: "Generates http listener", args: args{ + name: "test", opts: &saasv1alpha1.ListenerHttp{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "test"}, - Port: 8080, - RouteConfigName: "my_route", + Port: 8080, + RouteConfigName: "my_route", RateLimitOptions: &saasv1alpha1.RateLimitOptions{ Domain: "test_domain", FailureModeDeny: pointer.Bool(false), @@ -148,6 +148,7 @@ func TestListenerHTTP_v1(t *testing.T) { EnableHttp2: pointer.Bool(false), AllowHeadersWithUnderscores: pointer.Bool(true), MaxConnectionDuration: util.Metav1DurationPtr(900 * time.Second), + ProxyProtocol: pointer.Bool(true), }, }, want: heredoc.Doc(` @@ -215,8 +216,6 @@ func TestListenerHTTP_v1(t *testing.T) { use_remote_address: true listener_filters: - name: envoy.filters.listener.proxy_protocol - typed_config: - '@type': type.googleapis.com/envoy.extensions.filters.listener.proxy_protocol.v3.ProxyProtocol name: test per_connection_buffer_limit_bytes: 32768 `), @@ -224,7 +223,7 @@ func TestListenerHTTP_v1(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, _ := ListenerHTTP_v1(tt.args.opts) + got, _ := ListenerHTTP_v1(tt.args.name, tt.args.opts) j, err := envoy_serializer_v3.JSON{}.Marshal(got) if err != nil { t.Error(err) diff --git a/pkg/resource_builders/envoyconfig/templates/rawconfig.go b/pkg/resource_builders/envoyconfig/templates/rawconfig.go new file mode 100644 index 00000000..6cee7004 --- /dev/null +++ b/pkg/resource_builders/envoyconfig/templates/rawconfig.go @@ -0,0 +1,36 @@ +package templates + +import ( + "github.com/3scale-ops/marin3r/pkg/envoy" + envoy_serializer_v3 "github.com/3scale-ops/marin3r/pkg/envoy/serializer/v3" + saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" + envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" + envoy_config_listener_v3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" + envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" + envoy_service_runtime_v3 "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3" +) + +func RawConfig_v1(name string, opts interface{}) (envoy.Resource, error) { + o := opts.(*saasv1alpha1.RawConfig) + + switch o.Type { + case "listener": + return unmarshal(o.Value.Raw, &envoy_config_listener_v3.Listener{}) + case "routeConfiguration": + return unmarshal(o.Value.Raw, &envoy_config_route_v3.RouteConfiguration{}) + case "cluster": + return unmarshal(o.Value.Raw, &envoy_config_cluster_v3.Cluster{}) + case "runtime": + return unmarshal(o.Value.Raw, &envoy_service_runtime_v3.Runtime{}) + } + + return nil, nil +} + +func unmarshal(b []byte, proto envoy.Resource) (envoy.Resource, error) { + err := envoy_serializer_v3.JSON{}.Unmarshal(string(b), proto) + if err != nil { + return nil, err + } + return proto, nil +} diff --git a/pkg/resource_builders/envoyconfig/templates/rawconfig_test.go b/pkg/resource_builders/envoyconfig/templates/rawconfig_test.go new file mode 100644 index 00000000..89ad8e52 --- /dev/null +++ b/pkg/resource_builders/envoyconfig/templates/rawconfig_test.go @@ -0,0 +1,84 @@ +package templates + +import ( + "testing" + + "github.com/3scale-ops/marin3r/pkg/envoy" + saasv1alpha1 "github.com/3scale/saas-operator/api/v1alpha1" + "github.com/MakeNowJust/heredoc" + envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" + envoy_config_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" + "google.golang.org/protobuf/proto" + "k8s.io/apimachinery/pkg/runtime" +) + +func TestRawConfig_v1(t *testing.T) { + type args struct { + name string + opts interface{} + } + tests := []struct { + name string + args args + want envoy.Resource + wantErr bool + }{ + { + name: "Generates the corresponding proto msg", + args: args{ + name: "test", + opts: &saasv1alpha1.RawConfig{ + Type: "cluster", + Value: runtime.RawExtension{ + Raw: []byte(heredoc.Doc(` + { + "load_assignment": { + "cluster_name": "cluster1" + }, + "name": "cluster1" + } + `)), + }, + }, + }, + want: &envoy_config_cluster_v3.Cluster{ + Name: "cluster1", + LoadAssignment: &envoy_config_endpoint_v3.ClusterLoadAssignment{ + ClusterName: "cluster1", + Endpoints: []*envoy_config_endpoint_v3.LocalityLbEndpoints{}, + }, + }, wantErr: false, + }, + { + name: "Returns an error", + args: args{ + name: "test", + opts: &saasv1alpha1.RawConfig{ + Type: "listener", + Value: runtime.RawExtension{ + Raw: []byte(heredoc.Doc(` + { + "wrong_key": "value", + "name": "listener" + } + `)), + }, + }, + }, + want: nil, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := RawConfig_v1(tt.args.name, tt.args.opts) + if (err != nil) != tt.wantErr { + t.Errorf("RawConfig_v1() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !proto.Equal(got, tt.want) { + t.Errorf("RawConfig_v1() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/pkg/resource_builders/envoyconfig/routeconfigurations.go b/pkg/resource_builders/envoyconfig/templates/routeconfigurations.go similarity index 76% rename from pkg/resource_builders/envoyconfig/routeconfigurations.go rename to pkg/resource_builders/envoyconfig/templates/routeconfigurations.go index 727ea4b6..76465ab6 100644 --- a/pkg/resource_builders/envoyconfig/routeconfigurations.go +++ b/pkg/resource_builders/envoyconfig/templates/routeconfigurations.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( "github.com/3scale-ops/marin3r/pkg/envoy" @@ -8,16 +8,16 @@ import ( envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" ) -func RouteConfiguration_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) { - opts := desc.(*saasv1alpha1.RouteConfiguration) +func RouteConfiguration_v1(name string, opts interface{}) (envoy.Resource, error) { + o := opts.(*saasv1alpha1.RouteConfiguration) rc := &envoy_config_route_v3.RouteConfiguration{ - Name: desc.GetName(), + Name: name, VirtualHosts: []*envoy_config_route_v3.VirtualHost{}, } merr := util.MultiError{} - for _, vhost := range opts.VirtualHosts { + for _, vhost := range o.VirtualHosts { vh := &envoy_config_route_v3.VirtualHost{} err := envoy_serializer_v3.JSON{}.Unmarshal(string(vhost.Raw), vh) if err != nil { diff --git a/pkg/resource_builders/envoyconfig/routeconfigurations_test.go b/pkg/resource_builders/envoyconfig/templates/routeconfigurations_test.go similarity index 93% rename from pkg/resource_builders/envoyconfig/routeconfigurations_test.go rename to pkg/resource_builders/envoyconfig/templates/routeconfigurations_test.go index 23d25dd7..aa72b222 100644 --- a/pkg/resource_builders/envoyconfig/routeconfigurations_test.go +++ b/pkg/resource_builders/envoyconfig/templates/routeconfigurations_test.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( "testing" @@ -12,6 +12,7 @@ import ( func TestRouteConfiguration_v1(t *testing.T) { type args struct { + name string opts *saasv1alpha1.RouteConfiguration } tests := []struct { @@ -23,8 +24,8 @@ func TestRouteConfiguration_v1(t *testing.T) { { name: "Generate a route with the given virtual hosts", args: args{ + name: "my_route", opts: &saasv1alpha1.RouteConfiguration{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "my_route"}, VirtualHosts: []runtime.RawExtension{ { Raw: []byte(`{"name":"example","domains":["example.com"],"routes":[{"route":{"cluster":"example_cluster"},"match":{"prefix":"/"}}],"rate_limits":[{"actions":[{"remote_address":{}}]}]}`), @@ -63,7 +64,7 @@ func TestRouteConfiguration_v1(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := RouteConfiguration_v1(tt.args.opts) + got, err := RouteConfiguration_v1(tt.args.name, tt.args.opts) if (err != nil) != tt.wantErr { t.Errorf("RouteConfiguration_v1() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/pkg/resource_builders/envoyconfig/runtimes.go b/pkg/resource_builders/envoyconfig/templates/runtimes.go similarity index 78% rename from pkg/resource_builders/envoyconfig/runtimes.go rename to pkg/resource_builders/envoyconfig/templates/runtimes.go index 0a86b097..ab489e19 100644 --- a/pkg/resource_builders/envoyconfig/runtimes.go +++ b/pkg/resource_builders/envoyconfig/templates/runtimes.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( "github.com/3scale-ops/marin3r/pkg/envoy" @@ -7,15 +7,15 @@ import ( "google.golang.org/protobuf/types/known/structpb" ) -func Runtime_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) { - opts := desc.(*saasv1alpha1.Runtime) +func Runtime_v1(name string, opts interface{}) (envoy.Resource, error) { + o := opts.(*saasv1alpha1.Runtime) layer, _ := structpb.NewStruct(map[string]interface{}{ "envoy": map[string]interface{}{ "resource_limits": map[string]interface{}{ "listener": func() map[string]interface{} { m := map[string]interface{}{} - for _, name := range opts.ListenerNames { + for _, name := range o.ListenerNames { m[name] = map[string]interface{}{ "connection_limit": 10000, } @@ -30,7 +30,7 @@ func Runtime_v1(desc envoyDynamicConfigDescriptor) (envoy.Resource, error) { }) return &envoy_service_runtime_v3.Runtime{ - Name: desc.GetName(), + Name: name, Layer: layer, }, nil } diff --git a/pkg/resource_builders/envoyconfig/runtimes_test.go b/pkg/resource_builders/envoyconfig/templates/runtimes_test.go similarity index 86% rename from pkg/resource_builders/envoyconfig/runtimes_test.go rename to pkg/resource_builders/envoyconfig/templates/runtimes_test.go index 7f54e6a9..1ac49441 100644 --- a/pkg/resource_builders/envoyconfig/runtimes_test.go +++ b/pkg/resource_builders/envoyconfig/templates/runtimes_test.go @@ -1,4 +1,4 @@ -package envoyconfig +package templates import ( "testing" @@ -11,6 +11,7 @@ import ( func TestRuntime_v1(t *testing.T) { type args struct { + name string opts *saasv1alpha1.Runtime } tests := []struct { @@ -21,9 +22,9 @@ func TestRuntime_v1(t *testing.T) { { name: "Generates runtime", args: args{ + name: "runtime", opts: &saasv1alpha1.Runtime{ - EnvoyDynamicConfigMeta: saasv1alpha1.EnvoyDynamicConfigMeta{Name: "runtime"}, - ListenerNames: []string{"listener1", "listener2"}, + ListenerNames: []string{"listener1", "listener2"}, }, }, want: heredoc.Doc(` @@ -43,7 +44,7 @@ func TestRuntime_v1(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, _ := Runtime_v1(tt.args.opts) + got, _ := Runtime_v1(tt.args.name, tt.args.opts) j, err := envoy_serializer_v3.JSON{}.Marshal(got) if err != nil { t.Error(err) diff --git a/pkg/version/version.go b/pkg/version/version.go index 46293f6b..59dfe4c8 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,7 +1,7 @@ package version const ( - version string = "v0.18.0-alpha.4" + version string = "v0.18.0-alpha.8" ) // Current returns the current marin3r operator version diff --git a/test/e2e/sentinel_suite_test.go b/test/e2e/sentinel_suite_test.go index 27296b5a..bcb33697 100644 --- a/test/e2e/sentinel_suite_test.go +++ b/test/e2e/sentinel_suite_test.go @@ -120,7 +120,7 @@ var _ = Describe("sentinel e2e suite", func() { sclient, stopCh, err := testutil.SentinelClient(cfg, types.NamespacedName{ - Name: fmt.Sprintf("redis-sentinel-%d", rand.Intn(int(saasv1alpha1.SentinelDefaultReplicas))-1), + Name: fmt.Sprintf("redis-sentinel-%d", rand.Intn(int(saasv1alpha1.SentinelDefaultReplicas))), Namespace: ns, }) Expect(err).ToNot(HaveOccurred()) diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 90502e51..a255502d 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -17,6 +17,8 @@ limitations under the License. package e2e import ( + "crypto/rand" + "math/big" "testing" "time" @@ -59,15 +61,15 @@ func TestAPIs(t *testing.T) { var _ = BeforeSuite(func() { logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - seed := GinkgoRandomSeed() + int64(GinkgoParallelProcess()) - nameGenerator = namegenerator.NewNameGenerator(seed) + nBig, err := rand.Int(rand.Reader, big.NewInt(1000000)) + Expect(err).NotTo(HaveOccurred()) + nameGenerator = namegenerator.NewNameGenerator(nBig.Int64()) By("bootstrapping test environment") testEnv = &envtest.Environment{ UseExistingCluster: pointer.BoolPtr(true), } - var err error // cfg is defined in this file globally. cfg, err = testEnv.Start() Expect(err).NotTo(HaveOccurred())