From 0ac3d4bd6e53472b29d8a1e3df0869e391fe155f Mon Sep 17 00:00:00 2001 From: Roi Vazquez Date: Mon, 24 Oct 2022 11:44:37 +0200 Subject: [PATCH 1/2] Make spec.envoyResources[*].name optional --- apis/marin3r/v1alpha1/envoyconfig_types.go | 3 +- .../envoyconfig_webhook_suite_test.go | 4 +- .../marin3r/v1alpha1/zz_generated.deepcopy.go | 33 ++++++++--- ...rin3r.3scale.net_envoyconfigrevisions.yaml | 7 --- .../marin3r.3scale.net_envoyconfigs.yaml | 7 --- .../envoyconfig_controller_suite_test.go | 10 ++-- ...voyconfigrevision_controller_suite_test.go | 8 +-- .../envoyconfig/reconcile_revisions_test.go | 10 ++-- .../marin3r/envoyconfigrevision/cache_test.go | 27 ++++----- .../e2e/marin3r/envoydeployment_suite_test.go | 24 ++++---- test/e2e/marin3r/pod_suite_test.go | 57 ++++++++----------- test/e2e/marin3r/sidecar_suite_test.go | 25 ++++---- test/e2e/util/generators.go | 50 ++++++++-------- 13 files changed, 127 insertions(+), 138 deletions(-) diff --git a/apis/marin3r/v1alpha1/envoyconfig_types.go b/apis/marin3r/v1alpha1/envoyconfig_types.go index e15ad7e6..26fe7a30 100644 --- a/apis/marin3r/v1alpha1/envoyconfig_types.go +++ b/apis/marin3r/v1alpha1/envoyconfig_types.go @@ -120,7 +120,8 @@ type EnvoyResources struct { type EnvoyResource struct { // Name of the envoy resource // +operator-sdk:csv:customresourcedefinitions:type=spec - Name string `json:"name"` + // +optional + Name *string `json:"name"` // Value is the serialized representation of the envoy resource // +operator-sdk:csv:customresourcedefinitions:type=spec Value string `json:"value"` diff --git a/apis/marin3r/v1alpha1/envoyconfig_webhook_suite_test.go b/apis/marin3r/v1alpha1/envoyconfig_webhook_suite_test.go index dccb23ac..ac3e2ed7 100644 --- a/apis/marin3r/v1alpha1/envoyconfig_webhook_suite_test.go +++ b/apis/marin3r/v1alpha1/envoyconfig_webhook_suite_test.go @@ -84,7 +84,7 @@ var _ = Describe("EnvoyConfig webhook", func() { EnvoyAPI: pointer.StringPtr("v3"), EnvoyResources: &EnvoyResources{ Clusters: []EnvoyResource{{ - Name: "cluster", + Name: pointer.String("cluster"), // the connect_timeout value unit is wrong Value: `{"name":"cluster1","type":"STRICT_DNS","connect_timeout":"2xs","load_assignment":{"cluster_name":"cluster1"}}`, }}, @@ -103,7 +103,7 @@ var _ = Describe("EnvoyConfig webhook", func() { EnvoyAPI: pointer.StringPtr("v3"), EnvoyResources: &EnvoyResources{ Listeners: []EnvoyResource{{ - Name: "test", + Name: pointer.String("test"), // the "port" property should be "port_value" Value: ` name: listener1 diff --git a/apis/marin3r/v1alpha1/zz_generated.deepcopy.go b/apis/marin3r/v1alpha1/zz_generated.deepcopy.go index 6da2c43b..9c8f3c50 100644 --- a/apis/marin3r/v1alpha1/zz_generated.deepcopy.go +++ b/apis/marin3r/v1alpha1/zz_generated.deepcopy.go @@ -307,6 +307,11 @@ func (in *EnvoyConfigStatus) DeepCopy() *EnvoyConfigStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EnvoyResource) DeepCopyInto(out *EnvoyResource) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyResource. @@ -325,32 +330,44 @@ func (in *EnvoyResources) DeepCopyInto(out *EnvoyResources) { if in.Endpoints != nil { in, out := &in.Endpoints, &out.Endpoints *out = make([]EnvoyResource, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Clusters != nil { in, out := &in.Clusters, &out.Clusters *out = make([]EnvoyResource, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Routes != nil { in, out := &in.Routes, &out.Routes *out = make([]EnvoyResource, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.ScopedRoutes != nil { in, out := &in.ScopedRoutes, &out.ScopedRoutes *out = make([]EnvoyResource, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Listeners != nil { in, out := &in.Listeners, &out.Listeners *out = make([]EnvoyResource, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Runtimes != nil { in, out := &in.Runtimes, &out.Runtimes *out = make([]EnvoyResource, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Secrets != nil { in, out := &in.Secrets, &out.Secrets @@ -362,7 +379,9 @@ func (in *EnvoyResources) DeepCopyInto(out *EnvoyResources) { if in.ExtensionConfigs != nil { in, out := &in.ExtensionConfigs, &out.ExtensionConfigs *out = make([]EnvoyResource, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } diff --git a/config/crd/bases/marin3r.3scale.net_envoyconfigrevisions.yaml b/config/crd/bases/marin3r.3scale.net_envoyconfigrevisions.yaml index c354636f..8e3afcd0 100644 --- a/config/crd/bases/marin3r.3scale.net_envoyconfigrevisions.yaml +++ b/config/crd/bases/marin3r.3scale.net_envoyconfigrevisions.yaml @@ -89,7 +89,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -108,7 +107,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -127,7 +125,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -146,7 +143,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -165,7 +161,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -184,7 +179,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -203,7 +197,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array diff --git a/config/crd/bases/marin3r.3scale.net_envoyconfigs.yaml b/config/crd/bases/marin3r.3scale.net_envoyconfigs.yaml index 90f60320..38d241c5 100644 --- a/config/crd/bases/marin3r.3scale.net_envoyconfigs.yaml +++ b/config/crd/bases/marin3r.3scale.net_envoyconfigs.yaml @@ -81,7 +81,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -100,7 +99,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -119,7 +117,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -138,7 +135,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -157,7 +153,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -176,7 +171,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array @@ -195,7 +189,6 @@ spec: envoy resource type: string required: - - name - value type: object type: array diff --git a/controllers/marin3r/envoyconfig_controller_suite_test.go b/controllers/marin3r/envoyconfig_controller_suite_test.go index e6b79b22..40028885 100644 --- a/controllers/marin3r/envoyconfig_controller_suite_test.go +++ b/controllers/marin3r/envoyconfig_controller_suite_test.go @@ -80,7 +80,7 @@ var _ = Describe("EnvoyConfig controller", func() { NodeID: nodeID, EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"endpoint\"}"}, }}}, } err := k8sClient.Create(context.Background(), ec) @@ -146,7 +146,7 @@ var _ = Describe("EnvoyConfig controller", func() { NodeID: nodeID, EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"endpoint\"}"}, }}}, } err := k8sClient.Create(context.Background(), ec) @@ -172,7 +172,7 @@ var _ = Describe("EnvoyConfig controller", func() { patch := client.MergeFrom(ec.DeepCopy()) ec.Spec.EnvoyResources = &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"wrong_key\": \"wrong_value\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"wrong_key\": \"wrong_value\"}"}, }} err := k8sClient.Patch(context.Background(), ec, patch) Expect(err).ToNot(HaveOccurred()) @@ -201,7 +201,7 @@ var _ = Describe("EnvoyConfig controller", func() { patch := client.MergeFrom(ec.DeepCopy()) ec.Spec.EnvoyResources = &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"correct_endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"correct_endpoint\"}"}, }} err := k8sClient.Patch(context.Background(), ec, patch) Expect(err).ToNot(HaveOccurred()) @@ -270,7 +270,7 @@ var _ = Describe("EnvoyConfig controller", func() { patch := client.MergeFrom(ec.DeepCopy()) ec.Spec.EnvoyResources = &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"correct_endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"correct_endpoint\"}"}, }} err := k8sClient.Patch(context.Background(), ec, patch) Expect(err).ToNot(HaveOccurred()) diff --git a/controllers/marin3r/envoyconfigrevision_controller_suite_test.go b/controllers/marin3r/envoyconfigrevision_controller_suite_test.go index 2e82bbc2..5361cd8a 100644 --- a/controllers/marin3r/envoyconfigrevision_controller_suite_test.go +++ b/controllers/marin3r/envoyconfigrevision_controller_suite_test.go @@ -83,7 +83,7 @@ var _ = Describe("EnvoyConfigRevision controller", func() { EnvoyAPI: pointer.StringPtr(string(envoy.APIv3)), EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"endpoint\"}"}, }}}, } err := k8sClient.Create(context.Background(), ecr) @@ -265,7 +265,7 @@ var _ = Describe("EnvoyConfigRevision controller", func() { Version: "xxxx", EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"endpoint\"}"}, }}}, } err := k8sClient.Create(context.Background(), ecr) @@ -328,7 +328,7 @@ var _ = Describe("EnvoyConfigRevision controller", func() { Version: "xxxx", EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"endpoint\"}"}, }}}, } err := k8sClient.Create(context.Background(), ecr) @@ -390,7 +390,7 @@ var _ = Describe("EnvoyConfigRevision controller", func() { Expect(err).ToNot(HaveOccurred()) patch := client.MergeFrom(ecr.DeepCopy()) ecr.Spec.EnvoyResources.Clusters = []marin3rv1alpha1.EnvoyResource{ - {Name: "cluster", Value: "{\"wrong_key\": \"wrong_value\"}"}, + {Name: pointer.String("cluster"), Value: "{\"wrong_key\": \"wrong_value\"}"}, } err = k8sClient.Patch(context.Background(), ecr, patch) Expect(err).ToNot(HaveOccurred()) diff --git a/pkg/reconcilers/marin3r/envoyconfig/reconcile_revisions_test.go b/pkg/reconcilers/marin3r/envoyconfig/reconcile_revisions_test.go index 79bd66cc..aa010642 100644 --- a/pkg/reconcilers/marin3r/envoyconfig/reconcile_revisions_test.go +++ b/pkg/reconcilers/marin3r/envoyconfig/reconcile_revisions_test.go @@ -761,7 +761,7 @@ func TestRevisionReconciler_newRevisionForCurrentResources(t *testing.T) { NodeID: "node", EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"correct_endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"correct_endpoint\"}"}, }, }, }, @@ -769,22 +769,22 @@ func TestRevisionReconciler_newRevisionForCurrentResources(t *testing.T) { ), want: &marin3rv1alpha1.EnvoyConfigRevision{ ObjectMeta: metav1.ObjectMeta{ - Name: "node-v3-7fc7b66fd6", + Name: "node-v3-6c554ddcb8", Namespace: "test", Labels: map[string]string{ filters.EnvoyAPITag: envoy.APIv3.String(), filters.NodeIDTag: "node", - filters.VersionTag: "7fc7b66fd6", + filters.VersionTag: "6c554ddcb8", }, }, Spec: marin3rv1alpha1.EnvoyConfigRevisionSpec{ NodeID: "node", EnvoyAPI: pointer.StringPtr(envoy.APIv3.String()), - Version: "7fc7b66fd6", + Version: "6c554ddcb8", Serialization: pointer.StringPtr(string(envoy_serializer.JSON)), EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"correct_endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"correct_endpoint\"}"}, }, }, }, diff --git a/pkg/reconcilers/marin3r/envoyconfigrevision/cache_test.go b/pkg/reconcilers/marin3r/envoyconfigrevision/cache_test.go index 4777301b..e598de36 100644 --- a/pkg/reconcilers/marin3r/envoyconfigrevision/cache_test.go +++ b/pkg/reconcilers/marin3r/envoyconfigrevision/cache_test.go @@ -25,6 +25,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/pointer" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" @@ -111,7 +112,7 @@ func TestCacheReconciler_Reconcile(t *testing.T) { req: types.NamespacedName{Name: "xx", Namespace: "xx"}, resources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"endpoint\"}"}, }}, version: "xxxx", nodeID: "node2", @@ -189,22 +190,22 @@ func TestCacheReconciler_GenerateSnapshot(t *testing.T) { req: types.NamespacedName{Name: "xx", Namespace: "xx"}, resources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "{\"cluster_name\": \"endpoint\"}"}, + {Name: pointer.String("endpoint"), Value: "{\"cluster_name\": \"endpoint\"}"}, }, Clusters: []marin3rv1alpha1.EnvoyResource{ - {Name: "cluster", Value: "{\"name\": \"cluster\"}"}, + {Name: pointer.String("cluster"), Value: "{\"name\": \"cluster\"}"}, }, Routes: []marin3rv1alpha1.EnvoyResource{ - {Name: "route", Value: "{\"name\": \"route\"}"}, + {Name: pointer.String("route"), Value: "{\"name\": \"route\"}"}, }, ScopedRoutes: []marin3rv1alpha1.EnvoyResource{ - {Name: "scoped_route", Value: "{\"name\": \"scoped_route\"}"}, + {Name: pointer.String("scoped_route"), Value: "{\"name\": \"scoped_route\"}"}, }, Listeners: []marin3rv1alpha1.EnvoyResource{ - {Name: "listener", Value: "{\"name\": \"listener\"}"}, + {Name: pointer.String("listener"), Value: "{\"name\": \"listener\"}"}, }, Runtimes: []marin3rv1alpha1.EnvoyResource{ - {Name: "runtime", Value: "{\"name\": \"runtime\"}"}, + {Name: pointer.String("runtime"), Value: "{\"name\": \"runtime\"}"}, }}, }, want: xdss_v3.NewSnapshot(). @@ -242,7 +243,7 @@ func TestCacheReconciler_GenerateSnapshot(t *testing.T) { req: types.NamespacedName{Name: "xx", Namespace: "xx"}, resources: &marin3rv1alpha1.EnvoyResources{ Endpoints: []marin3rv1alpha1.EnvoyResource{ - {Name: "endpoint", Value: "giberish"}, + {Name: pointer.String("endpoint"), Value: "giberish"}, }}, }, wantErr: true, @@ -262,7 +263,7 @@ func TestCacheReconciler_GenerateSnapshot(t *testing.T) { req: types.NamespacedName{Name: "xx", Namespace: "xx"}, resources: &marin3rv1alpha1.EnvoyResources{ Clusters: []marin3rv1alpha1.EnvoyResource{ - {Name: "cluster", Value: "giberish"}, + {Name: pointer.String("cluster"), Value: "giberish"}, }}, }, wantErr: true, @@ -282,7 +283,7 @@ func TestCacheReconciler_GenerateSnapshot(t *testing.T) { req: types.NamespacedName{Name: "xx", Namespace: "xx"}, resources: &marin3rv1alpha1.EnvoyResources{ Routes: []marin3rv1alpha1.EnvoyResource{ - {Name: "route", Value: "giberish"}, + {Name: pointer.String("route"), Value: "giberish"}, }}, }, wantErr: true, @@ -302,7 +303,7 @@ func TestCacheReconciler_GenerateSnapshot(t *testing.T) { req: types.NamespacedName{Name: "xx", Namespace: "xx"}, resources: &marin3rv1alpha1.EnvoyResources{ ScopedRoutes: []marin3rv1alpha1.EnvoyResource{ - {Name: "scoped_route", Value: "giberish"}, + {Name: pointer.String("scoped_route"), Value: "giberish"}, }}, }, wantErr: true, @@ -322,7 +323,7 @@ func TestCacheReconciler_GenerateSnapshot(t *testing.T) { req: types.NamespacedName{Name: "xx", Namespace: "xx"}, resources: &marin3rv1alpha1.EnvoyResources{ Listeners: []marin3rv1alpha1.EnvoyResource{ - {Name: "listener", Value: "giberish"}, + {Name: pointer.String("listener"), Value: "giberish"}, }}, }, wantErr: true, @@ -342,7 +343,7 @@ func TestCacheReconciler_GenerateSnapshot(t *testing.T) { req: types.NamespacedName{Name: "xx", Namespace: "xx"}, resources: &marin3rv1alpha1.EnvoyResources{ Runtimes: []marin3rv1alpha1.EnvoyResource{ - {Name: "runtime", Value: "giberish"}, + {Name: pointer.String("runtime"), Value: "giberish"}, }}, }, wantErr: true, diff --git a/test/e2e/marin3r/envoydeployment_suite_test.go b/test/e2e/marin3r/envoydeployment_suite_test.go index e5dd56cf..36a44205 100644 --- a/test/e2e/marin3r/envoydeployment_suite_test.go +++ b/test/e2e/marin3r/envoydeployment_suite_test.go @@ -100,24 +100,20 @@ var _ = Describe("EnvoyDeployment", func() { By("applying an EnvoyConfig that will configure the envoy Deployment through service discovery") key := types.NamespacedName{Name: "envoyconfig", Namespace: testNamespace} ec = testutil.GenerateEnvoyConfig(key, nodeID, envoy.APIv3, - func() map[string]envoy.Resource { - return map[string]envoy.Resource{} + func() []envoy.Resource { + return []envoy.Resource{} }, - func() map[string]envoy.Resource { - k, v := testutil.ClusterWithStrictDNSV3("nginx", "nginx", 80) - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.ClusterWithStrictDNSV3("nginx", "nginx", 80)} }, - func() map[string]envoy.Resource { - k, v := testutil.ProxyPassRouteV3("proxypass", "nginx") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.ProxyPassRouteV3("proxypass", "nginx")} }, - func() map[string]envoy.Resource { - k, v := testutil.HTTPListener("http", "proxypass", "router_filter", testutil.GetAddressV3("0.0.0.0", envoyListenerPort), nil) - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.HTTPListener("http", "proxypass", "router_filter", testutil.GetAddressV3("0.0.0.0", envoyListenerPort), nil)} }, - func() map[string]envoy.Resource { - k, v := testutil.HTTPFilterRouter("router_filter") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.HTTPFilterRouter("router_filter")} }, nil, ) diff --git a/test/e2e/marin3r/pod_suite_test.go b/test/e2e/marin3r/pod_suite_test.go index f54541eb..1f0bea23 100644 --- a/test/e2e/marin3r/pod_suite_test.go +++ b/test/e2e/marin3r/pod_suite_test.go @@ -104,20 +104,17 @@ var _ = Describe("Envoy pods", func() { By("applying an EnvoyConfig that configures the Pod with a direct response") key := types.NamespacedName{Name: "test-envoyconfig", Namespace: testNamespace} ec = testutil.GenerateEnvoyConfig(key, nodeID, envoy.APIv3, - func() map[string]envoy.Resource { return nil }, - func() map[string]envoy.Resource { return nil }, - func() map[string]envoy.Resource { - k, v := testutil.DirectResponseRouteV3("direct_response", "OK") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { return nil }, + func() []envoy.Resource { return nil }, + func() []envoy.Resource { + return []envoy.Resource{testutil.DirectResponseRouteV3("direct_response", "OK")} }, - func() map[string]envoy.Resource { + func() []envoy.Resource { // Envoy listeners don't allow bind address changes - k, v := testutil.HTTPListener("http", "direct_response", "router_filter", testutil.GetAddressV3("0.0.0.0", envoyListenerPort), nil) - return map[string]envoy.Resource{k: v} + return []envoy.Resource{testutil.HTTPListener("http", "direct_response", "router_filter", testutil.GetAddressV3("0.0.0.0", envoyListenerPort), nil)} }, - func() map[string]envoy.Resource { - k, v := testutil.HTTPFilterRouter("router_filter") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.HTTPFilterRouter("router_filter")} }, nil) @@ -189,20 +186,17 @@ var _ = Describe("Envoy pods", func() { key := types.NamespacedName{Name: "test-envoyconfig", Namespace: testNamespace} patch := client.MergeFrom(ec.DeepCopy()) ec.Spec = testutil.GenerateEnvoyConfig(key, nodeID, envoy.APIv3, - func() map[string]envoy.Resource { return nil }, - func() map[string]envoy.Resource { return nil }, - func() map[string]envoy.Resource { - k, v := testutil.DirectResponseRouteV3("direct_response", "OK") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { return nil }, + func() []envoy.Resource { return nil }, + func() []envoy.Resource { + return []envoy.Resource{testutil.DirectResponseRouteV3("direct_response", "OK")} }, - func() map[string]envoy.Resource { + func() []envoy.Resource { // Envoy listeners don't allow bind address changes - k, v := testutil.HTTPListener("http", "direct_response", "router_filter", testutil.GetAddressV3("0.0.0.0", 30333), nil) - return map[string]envoy.Resource{k: v} + return []envoy.Resource{testutil.HTTPListener("http", "direct_response", "router_filter", testutil.GetAddressV3("0.0.0.0", 30333), nil)} }, - func() map[string]envoy.Resource { - k, v := testutil.HTTPFilterRouter("router_filter") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.HTTPFilterRouter("router_filter")} }, nil, ).Spec @@ -251,19 +245,16 @@ var _ = Describe("Envoy pods", func() { key := types.NamespacedName{Name: "test-envoyconfig", Namespace: testNamespace} patch := client.MergeFrom(ec.DeepCopy()) ec.Spec = testutil.GenerateEnvoyConfig(key, nodeID, envoy.APIv3, - func() map[string]envoy.Resource { return nil }, - func() map[string]envoy.Resource { return nil }, - func() map[string]envoy.Resource { - k, v := testutil.DirectResponseRouteV3("direct_response", "OK") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { return nil }, + func() []envoy.Resource { return nil }, + func() []envoy.Resource { + return []envoy.Resource{testutil.DirectResponseRouteV3("direct_response", "OK")} }, - func() map[string]envoy.Resource { - k, v := testutil.HTTPListener("https", "direct_response", "router_filter", testutil.GetAddressV3("0.0.0.0", envoyListenerPort), testutil.TransportSocketV3("localhost")) - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.HTTPListener("https", "direct_response", "router_filter", testutil.GetAddressV3("0.0.0.0", envoyListenerPort), testutil.TransportSocketV3("localhost"))} }, - func() map[string]envoy.Resource { - k, v := testutil.HTTPFilterRouter("router_filter") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.HTTPFilterRouter("router_filter")} }, map[string]string{"localhost": "self-signed-cert"}, ).Spec diff --git a/test/e2e/marin3r/sidecar_suite_test.go b/test/e2e/marin3r/sidecar_suite_test.go index b404de61..0d5d4097 100644 --- a/test/e2e/marin3r/sidecar_suite_test.go +++ b/test/e2e/marin3r/sidecar_suite_test.go @@ -101,25 +101,20 @@ var _ = Describe("Envoy sidecars", func() { By("applaying an EnvoyConfig that will configure the envoy sidecar through service discovery") key := types.NamespacedName{Name: "nginx-envoyconfig", Namespace: testNamespace} ec = testutil.GenerateEnvoyConfig(key, nodeID, envoy.APIv3, - func() map[string]envoy.Resource { - k, v := testutil.EndpointV3("nginx", "127.0.0.1", 80) - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.EndpointV3("nginx", "127.0.0.1", 80)} }, - func() map[string]envoy.Resource { - k, v := testutil.ClusterWithEdsV3("nginx") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.ClusterWithEdsV3("nginx")} }, - func() map[string]envoy.Resource { - k, v := testutil.ProxyPassRouteV3("proxypass", "nginx") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.ProxyPassRouteV3("proxypass", "nginx")} }, - func() map[string]envoy.Resource { - k, v := testutil.HTTPListener("http", "proxypass", "router_filter", testutil.GetAddressV3("0.0.0.0", envoyListenerPort), nil) - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.HTTPListener("http", "proxypass", "router_filter", testutil.GetAddressV3("0.0.0.0", envoyListenerPort), nil)} }, - func() map[string]envoy.Resource { - k, v := testutil.HTTPFilterRouter("router_filter") - return map[string]envoy.Resource{k: v} + func() []envoy.Resource { + return []envoy.Resource{testutil.HTTPFilterRouter("router_filter")} }, nil, ) diff --git a/test/e2e/util/generators.go b/test/e2e/util/generators.go index 54f6c3aa..ea420c19 100644 --- a/test/e2e/util/generators.go +++ b/test/e2e/util/generators.go @@ -183,7 +183,7 @@ func GenerateTLSSecret(k8skey types.NamespacedName, commonName, duration string) } func GenerateEnvoyConfig(key types.NamespacedName, nodeID string, envoyAPI envoy.APIVersion, - endpointsGenFn, clustersGenFn, routesGenFn, listenersGenFn, extensionConfigsGenFn func() map[string]envoy.Resource, + endpointsGenFn, clustersGenFn, routesGenFn, listenersGenFn, extensionConfigsGenFn func() []envoy.Resource, secrets map[string]string) *marin3rv1alpha1.EnvoyConfig { m := envoy_serializer.NewResourceMarshaller(envoy_serializer.JSON, envoyAPI) @@ -198,45 +198,45 @@ func GenerateEnvoyConfig(key types.NamespacedName, nodeID string, envoyAPI envoy EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Endpoints: func() []marin3rv1alpha1.EnvoyResource { endpoints := []marin3rv1alpha1.EnvoyResource{} - for name, resource := range endpointsGenFn() { + for _, resource := range endpointsGenFn() { json, err := m.Marshal(resource) if err != nil { panic(err) } - endpoints = append(endpoints, marin3rv1alpha1.EnvoyResource{Name: name, Value: json}) + endpoints = append(endpoints, marin3rv1alpha1.EnvoyResource{Value: json}) } return endpoints }(), Clusters: func() []marin3rv1alpha1.EnvoyResource { clusters := []marin3rv1alpha1.EnvoyResource{} - for name, resource := range clustersGenFn() { + for _, resource := range clustersGenFn() { json, err := m.Marshal(resource) if err != nil { panic(err) } - clusters = append(clusters, marin3rv1alpha1.EnvoyResource{Name: name, Value: json}) + clusters = append(clusters, marin3rv1alpha1.EnvoyResource{Value: json}) } return clusters }(), Routes: func() []marin3rv1alpha1.EnvoyResource { routes := []marin3rv1alpha1.EnvoyResource{} - for name, resource := range routesGenFn() { + for _, resource := range routesGenFn() { json, err := m.Marshal(resource) if err != nil { panic(err) } - routes = append(routes, marin3rv1alpha1.EnvoyResource{Name: name, Value: json}) + routes = append(routes, marin3rv1alpha1.EnvoyResource{Value: json}) } return routes }(), Listeners: func() []marin3rv1alpha1.EnvoyResource { listeners := []marin3rv1alpha1.EnvoyResource{} - for name, resource := range listenersGenFn() { + for _, resource := range listenersGenFn() { json, err := m.Marshal(resource) if err != nil { panic(err) } - listeners = append(listeners, marin3rv1alpha1.EnvoyResource{Name: name, Value: json}) + listeners = append(listeners, marin3rv1alpha1.EnvoyResource{Value: json}) } return listeners }(), @@ -255,12 +255,12 @@ func GenerateEnvoyConfig(key types.NamespacedName, nodeID string, envoyAPI envoy }(), ExtensionConfigs: func() []marin3rv1alpha1.EnvoyResource { extensionConfigs := []marin3rv1alpha1.EnvoyResource{} - for name, resource := range extensionConfigsGenFn() { + for _, resource := range extensionConfigsGenFn() { json, err := m.Marshal(resource) if err != nil { panic(err) } - extensionConfigs = append(extensionConfigs, marin3rv1alpha1.EnvoyResource{Name: name, Value: json}) + extensionConfigs = append(extensionConfigs, marin3rv1alpha1.EnvoyResource{Value: json}) } return extensionConfigs }(), @@ -310,8 +310,8 @@ func TransportSocketV3(secretName string) *envoy_config_core_v3.TransportSocket } func HTTPListener(listenerName, routeName, extensionConfigName string, - address, transportSocket proto.Message) (string, *envoy_config_listener_v3.Listener) { - return listenerName, &envoy_config_listener_v3.Listener{ + address, transportSocket proto.Message) *envoy_config_listener_v3.Listener { + return &envoy_config_listener_v3.Listener{ Name: listenerName, Address: address.(*envoy_config_core_v3.Address), FilterChains: []*envoy_config_listener_v3.FilterChain{{ @@ -365,8 +365,8 @@ func HTTPListener(listenerName, routeName, extensionConfigName string, } } -func HTTPFilterRouter(extensionConfigName string) (string, *envoy_config_core_v3.TypedExtensionConfig) { - return extensionConfigName, &envoy_config_core_v3.TypedExtensionConfig{ +func HTTPFilterRouter(extensionConfigName string) *envoy_config_core_v3.TypedExtensionConfig { + return &envoy_config_core_v3.TypedExtensionConfig{ Name: extensionConfigName, TypedConfig: func() *anypb.Any { any, err := anypb.New( @@ -381,8 +381,8 @@ func HTTPFilterRouter(extensionConfigName string) (string, *envoy_config_core_v3 }()} } -func ProxyPassRouteV3(routeName, clusterName string) (string, *envoy_config_route_v3.RouteConfiguration) { - return routeName, &envoy_config_route_v3.RouteConfiguration{ +func ProxyPassRouteV3(routeName, clusterName string) *envoy_config_route_v3.RouteConfiguration { + return &envoy_config_route_v3.RouteConfiguration{ Name: routeName, VirtualHosts: []*envoy_config_route_v3.VirtualHost{{ Name: routeName, @@ -400,8 +400,8 @@ func ProxyPassRouteV3(routeName, clusterName string) (string, *envoy_config_rout } } -func DirectResponseRouteV3(routeName, msg string) (string, *envoy_config_route_v3.RouteConfiguration) { - return routeName, &envoy_config_route_v3.RouteConfiguration{ +func DirectResponseRouteV3(routeName, msg string) *envoy_config_route_v3.RouteConfiguration { + return &envoy_config_route_v3.RouteConfiguration{ Name: routeName, VirtualHosts: []*envoy_config_route_v3.VirtualHost{{ Name: routeName, @@ -421,8 +421,8 @@ func DirectResponseRouteV3(routeName, msg string) (string, *envoy_config_route_v } } -func EndpointV3(clusterName, host string, port uint32) (string, *envoy_config_endpoint_v3.ClusterLoadAssignment) { - return clusterName, &envoy_config_endpoint_v3.ClusterLoadAssignment{ +func EndpointV3(clusterName, host string, port uint32) *envoy_config_endpoint_v3.ClusterLoadAssignment { + return &envoy_config_endpoint_v3.ClusterLoadAssignment{ ClusterName: clusterName, Endpoints: []*envoy_config_endpoint_v3.LocalityLbEndpoints{ { @@ -440,8 +440,8 @@ func EndpointV3(clusterName, host string, port uint32) (string, *envoy_config_en } } -func ClusterWithEdsV3(clusterName string) (string, *envoy_config_cluster_v3.Cluster) { - return clusterName, &envoy_config_cluster_v3.Cluster{ +func ClusterWithEdsV3(clusterName string) *envoy_config_cluster_v3.Cluster { + return &envoy_config_cluster_v3.Cluster{ Name: clusterName, ConnectTimeout: durationpb.New(10 * time.Millisecond), ClusterDiscoveryType: &envoy_config_cluster_v3.Cluster_Type{ @@ -458,8 +458,8 @@ func ClusterWithEdsV3(clusterName string) (string, *envoy_config_cluster_v3.Clus } } -func ClusterWithStrictDNSV3(clusterName, host string, port uint32) (string, *envoy_config_cluster_v3.Cluster) { - return clusterName, &envoy_config_cluster_v3.Cluster{ +func ClusterWithStrictDNSV3(clusterName, host string, port uint32) *envoy_config_cluster_v3.Cluster { + return &envoy_config_cluster_v3.Cluster{ Name: clusterName, ConnectTimeout: durationpb.New(10 * time.Millisecond), ClusterDiscoveryType: &envoy_config_cluster_v3.Cluster_Type{ From 7edd2418836a30e1d6d9265509e5422d3d8e45aa Mon Sep 17 00:00:00 2001 From: Roi Vazquez Date: Mon, 24 Oct 2022 12:16:31 +0200 Subject: [PATCH 2/2] Update docs --- README.md | 18 ++++++------------ apis/marin3r/v1alpha1/envoyconfig_types.go | 6 +++++- .../samples/marin3r_v1alpha1_envoyconfig.yaml | 9 +++------ docs/api-reference/reference.asciidoc | 4 +++- docs/walkthroughs/configuration-validation.md | 3 +-- .../envoy-connection-draining-on-shutdown.md | 3 +-- .../path-routing-envoydeployment.md | 15 +++++---------- docs/walkthroughs/self-healing.md | 12 ++++-------- docs/walkthroughs/tls-offloading-sidecars.md | 6 ++---- docs/walkthroughs/upgrading-v2-to-v3.md | 12 ++++-------- examples/e2e/deployment/envoyconfig.yaml | 15 +++++---------- examples/e2e/sidecars/envoyconfig.yaml | 15 +++++---------- examples/local/envoyconfig.yaml | 12 ++++-------- 13 files changed, 48 insertions(+), 82 deletions(-) diff --git a/README.md b/README.md index 225417df..5495ae10 100644 --- a/README.md +++ b/README.md @@ -182,33 +182,27 @@ spec: # Endpoints is a list of the Envoy ClusterLoadAssignment resource type. # API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/endpoint/v3/endpoint.proto endpoints: - - name: endpoint1 - value: {"clusterName":"cluster1","endpoints":[{"lbEndpoints":[{"endpoint":{"address":{"socketAddress":{"address":"127.0.0.1","portValue":8080}}}}]}]} + - value: {"clusterName":"cluster1","endpoints":[{"lbEndpoints":[{"endpoint":{"address":{"socketAddress":{"address":"127.0.0.1","portValue":8080}}}}]}]} # Clusters is a list of the Envoy Cluster resource type. # API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto clusters: - - name: cluster1 - value: {"name":"cluster1","type":"STRICT_DNS","connectTimeout":"2s","loadAssignment":{"clusterName":"cluster1","endpoints":[]}} + - value: {"name":"cluster1","type":"STRICT_DNS","connectTimeout":"2s","loadAssignment":{"clusterName":"cluster1","endpoints":[]}} # Routes is a list of the Envoy Route resource type. # API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route.proto routes: - - name: route1 - value: {"name":"route1","virtual_hosts":[{"name":"vhost","domains":["*"],"routes":[{"match":{"prefix":"/"},"direct_response":{"status":200}}]}]} + - value: {"name":"route1","virtual_hosts":[{"name":"vhost","domains":["*"],"routes":[{"match":{"prefix":"/"},"direct_response":{"status":200}}]}]} # ScopedRoutes is a list of the Envoy Scoped Route resource type. # API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/scoped_route.proto scopedRoutes: - - name: scoped_route1 - value: {"name":"scoped_route1","route_configuration_name":"route1","key":{"fragments":[{"string_key":"test"}]}} + - value: {"name":"scoped_route1","route_configuration_name":"route1","key":{"fragments":[{"string_key":"test"}]}} # Listeners is a list of the Envoy Listener resource type. # API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/listener/v3/listener.proto listeners: - - name: listener1 - value: {"name":"listener1","address":{"socketAddress":{"address":"0.0.0.0","portValue":8443}}} + - value: {"name":"listener1","address":{"socketAddress":{"address":"0.0.0.0","portValue":8443}}} # Runtimes is a list of the Envoy Runtime resource type. # API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/service/runtime/v3/rtds.proto runtimes: - - name: runtime1 - value: {"name":"runtime1","layer":{"static_layer_0":"value"}} + - value: {"name":"runtime1","layer":{"static_layer_0":"value"}} ``` ### **Secrets** diff --git a/apis/marin3r/v1alpha1/envoyconfig_types.go b/apis/marin3r/v1alpha1/envoyconfig_types.go index 26fe7a30..6eae43dd 100644 --- a/apis/marin3r/v1alpha1/envoyconfig_types.go +++ b/apis/marin3r/v1alpha1/envoyconfig_types.go @@ -118,7 +118,11 @@ type EnvoyResources struct { // EnvoyResource holds serialized representation of an envoy // resource type EnvoyResource struct { - // Name of the envoy resource + // Name of the envoy resource. + // DEPRECATED: this field has no effect and will be removed in an + // upcoming release. The name of the resources for discovery purposes + // is included in the resource itself. Refer to the envoy API reference + // to check how the name is specified for each resource type. // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional Name *string `json:"name"` diff --git a/config/samples/marin3r_v1alpha1_envoyconfig.yaml b/config/samples/marin3r_v1alpha1_envoyconfig.yaml index 935c83f4..3ac64380 100644 --- a/config/samples/marin3r_v1alpha1_envoyconfig.yaml +++ b/config/samples/marin3r_v1alpha1_envoyconfig.yaml @@ -11,8 +11,7 @@ spec: secrets: - name: example.default.svc clusters: - - name: example - value: | + - value: | name: example connect_timeout: 10ms type: STRICT_DNS @@ -28,8 +27,7 @@ spec: address: example port_value: 8080 routes: - - name: local - value: | + - value: | name: local virtual_hosts: - name: all @@ -40,8 +38,7 @@ spec: route: cluster: example listeners: - - name: https - value: | + - value: | name: https address: socket_address: diff --git a/docs/api-reference/reference.asciidoc b/docs/api-reference/reference.asciidoc index acbff605..03b2ec39 100644 --- a/docs/api-reference/reference.asciidoc +++ b/docs/api-reference/reference.asciidoc @@ -216,7 +216,7 @@ EnvoyResource holds serialized representation of an envoy resource [cols="25a,75a", options="header"] |=== | Field | Description -| *`name`* __string__ | Name of the envoy resource +| *`name`* __string__ | Name of the envoy resource. DEPRECATED: this field has no effect and will be removed in an upcoming release. The name of the resources for discovery purposes is included in the resource itself. Refer to the envoy API reference to check how the name is specified for each resource type. | *`value`* __string__ | Value is the serialized representation of the envoy resource |=== @@ -242,6 +242,7 @@ EnvoyResources holds each envoy api resource type | *`listeners`* __xref:{anchor_prefix}-github-com-3scale-ops-marin3r-apis-marin3r-v1alpha1-envoyresource[$$EnvoyResource$$] array__ | Listeners is a list of the envoy Listener resource type. API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/listener/v3/listener.proto | *`runtimes`* __xref:{anchor_prefix}-github-com-3scale-ops-marin3r-apis-marin3r-v1alpha1-envoyresource[$$EnvoyResource$$] array__ | Runtimes is a list of the envoy Runtime resource type. API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/service/runtime/v3/rtds.proto | *`secrets`* __xref:{anchor_prefix}-github-com-3scale-ops-marin3r-apis-marin3r-v1alpha1-envoysecretresource[$$EnvoySecretResource$$] array__ | Secrets is a list of references to Kubernetes Secret objects. +| *`extensionConfigs`* __xref:{anchor_prefix}-github-com-3scale-ops-marin3r-apis-marin3r-v1alpha1-envoyresource[$$EnvoyResource$$] array__ | ExtensionConfigs is a list of the envoy ExtensionConfig resource type API V3 reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/extension.proto |=== @@ -287,6 +288,7 @@ VersionTracker tracks the versions of the resources that this revision publishes | *`listeners`* __string__ | | *`secrets`* __string__ | | *`runtimes`* __string__ | +| *`extensionConfigs`* __string__ | |=== diff --git a/docs/walkthroughs/configuration-validation.md b/docs/walkthroughs/configuration-validation.md index dcca5e84..0cb550d5 100644 --- a/docs/walkthroughs/configuration-validation.md +++ b/docs/walkthroughs/configuration-validation.md @@ -24,8 +24,7 @@ spec: secrets: - name: kuard-certificate clusters: - - name: kuard - value: | + - value: | name: kuard connect_timeout: 10 miliseconds type: STRICT_DNS diff --git a/docs/walkthroughs/envoy-connection-draining-on-shutdown.md b/docs/walkthroughs/envoy-connection-draining-on-shutdown.md index 0dd37060..dfe636c0 100644 --- a/docs/walkthroughs/envoy-connection-draining-on-shutdown.md +++ b/docs/walkthroughs/envoy-connection-draining-on-shutdown.md @@ -26,8 +26,7 @@ spec: envoyAPI: v3 envoyResources: listeners: - - name: http - value: | + - value: | name: http address: { socket_address: { address: 0.0.0.0, port_value: 8080 } } filter_chains: diff --git a/docs/walkthroughs/path-routing-envoydeployment.md b/docs/walkthroughs/path-routing-envoydeployment.md index ae75d57a..05bc5aa3 100644 --- a/docs/walkthroughs/path-routing-envoydeployment.md +++ b/docs/walkthroughs/path-routing-envoydeployment.md @@ -110,8 +110,7 @@ spec: envoyAPI: v3 envoyResources: clusters: - - name: upstream-a - value: | + - value: | name: upstream-a connect_timeout: 10ms type: STRICT_DNS @@ -124,8 +123,7 @@ spec: address: socket_address: { address: upstream-a, port_value: 8080 } listeners: - - name: http - value: | + - value: | name: http address: { socket_address: { address: 0.0.0.0, port_value: 8080 } } filter_chains: @@ -237,8 +235,7 @@ spec: envoyAPI: v3 envoyResources: clusters: - - name: upstream-a - value: | + - value: | name: upstream-a connect_timeout: 10ms type: STRICT_DNS @@ -250,8 +247,7 @@ spec: - endpoint: address: socket_address: { address: upstream-a, port_value: 8080 } - - name: upstream-b - value: | + - value: | name: upstream-b connect_timeout: 10ms type: STRICT_DNS @@ -264,8 +260,7 @@ spec: address: socket_address: { address: upstream-b, port_value: 8080 } listeners: - - name: http - value: | + - value: | name: http address: { socket_address: { address: 0.0.0.0, port_value: 8080 } } filter_chains: diff --git a/docs/walkthroughs/self-healing.md b/docs/walkthroughs/self-healing.md index 5b7a533f..b0090b92 100644 --- a/docs/walkthroughs/self-healing.md +++ b/docs/walkthroughs/self-healing.md @@ -52,8 +52,7 @@ spec: envoyAPI: v3 envoyResources: clusters: - - name: kuard - value: | + - value: | name: kuard connect_timeout: 10ms type: STRICT_DNS @@ -66,8 +65,7 @@ spec: address: socket_address: { address: 127.0.0.1, port_value: 8080 } listeners: - - name: http - value: | + - value: | name: http address: { socket_address: { address: 0.0.0.0, port_value: 8081 } } filter_chains: @@ -135,8 +133,7 @@ spec: envoyAPI: v3 envoyResources: clusters: - - name: kuard - value: | + - value: | name: kuard connect_timeout: 10ms type: STRICT_DNS @@ -149,8 +146,7 @@ spec: address: socket_address: { address: 127.0.0.1, port_value: 8080 } listeners: - - name: http - value: | + - value: | name: http # Changed listener port from 8081 to 5000 address: { socket_address: { address: 0.0.0.0, port_value: 5000 } } diff --git a/docs/walkthroughs/tls-offloading-sidecars.md b/docs/walkthroughs/tls-offloading-sidecars.md index 36d0618c..bd17c832 100644 --- a/docs/walkthroughs/tls-offloading-sidecars.md +++ b/docs/walkthroughs/tls-offloading-sidecars.md @@ -88,8 +88,7 @@ spec: secrets: - name: kuard-certificate clusters: - - name: kuard - value: | + - value: | name: kuard connect_timeout: 10ms type: STRICT_DNS @@ -102,8 +101,7 @@ spec: address: socket_address: { address: 127.0.0.1, port_value: 8080 } listeners: - - name: https - value: | + - value: | name: https address: { socket_address: { address: 0.0.0.0, port_value: 8443 } } filter_chains: diff --git a/docs/walkthroughs/upgrading-v2-to-v3.md b/docs/walkthroughs/upgrading-v2-to-v3.md index 40ef28ca..f73017d9 100644 --- a/docs/walkthroughs/upgrading-v2-to-v3.md +++ b/docs/walkthroughs/upgrading-v2-to-v3.md @@ -26,8 +26,7 @@ spec: envoyAPI: v2 envoyResources: listeners: - - name: http - value: | + - value: | name: http address: socket_address: { address: 0.0.0.0, port_value: 8080 } @@ -80,8 +79,7 @@ spec: envoyAPI: v3 envoyResources: listeners: - - name: http - value: | + - value: | name: http address: { socket_address: { address: 0.0.0.0, port_value: 8080 } } filter_chains: @@ -164,8 +162,7 @@ spec: envoyAPI: v2 envoyResources: listeners: - - name: http - value: | + - value: | name: http address: socket_address: { address: 0.0.0.0, port_value: 8080 } @@ -242,8 +239,7 @@ spec: envoyAPI: v3 envoyResources: listeners: - - name: http - value: | + - value: | name: http address: { socket_address: { address: 0.0.0.0, port_value: 8080 } } filter_chains: diff --git a/examples/e2e/deployment/envoyconfig.yaml b/examples/e2e/deployment/envoyconfig.yaml index 2f1e880a..b9d9defc 100644 --- a/examples/e2e/deployment/envoyconfig.yaml +++ b/examples/e2e/deployment/envoyconfig.yaml @@ -12,8 +12,7 @@ spec: ref: name: kuard clusters: - - name: kuard - value: | + - value: | name: kuard connect_timeout: 0.010s type: STRICT_DNS @@ -29,8 +28,7 @@ spec: address: kuard port_value: 8080 routes: - - name: kuard - value: | + - value: | name: kuard virtual_hosts: - name: all @@ -38,16 +36,14 @@ spec: routes: - { match: {prefix: "/"}, route: { cluster: "kuard" }} scopedRoutes: - - name: scoped_route_kuard - value: | + - value: | name: scoped_route_kuard route_configuration_name: kuard key: fragments: - string_key: kuard listeners: - - name: https - value: | + - value: | name: https address: socket_address: @@ -75,8 +71,7 @@ spec: tls_certificate_sds_secret_configs: - name: kuard.default.svc sds_config: { ads: {}, resource_api_version: "V3" } - - name: https-scoped - value: | + - value: | name: https-scoped address: socket_address: diff --git a/examples/e2e/sidecars/envoyconfig.yaml b/examples/e2e/sidecars/envoyconfig.yaml index 71b0b019..cda23f7b 100644 --- a/examples/e2e/sidecars/envoyconfig.yaml +++ b/examples/e2e/sidecars/envoyconfig.yaml @@ -13,8 +13,7 @@ spec: name: kuard namespace: default clusters: - - name: kuard - value: | + - value: | name: kuard connect_timeout: 0.010s type: STRICT_DNS @@ -30,8 +29,7 @@ spec: address: 127.0.0.1 port_value: 8080 routes: - - name: kuard - value: | + - value: | name: kuard virtual_hosts: - name: all @@ -39,16 +37,14 @@ spec: routes: - { match: {prefix: "/"}, route: { cluster: "kuard" }} scopedRoutes: - - name: scoped_route_kuard - value: | + - value: | name: scoped_route_kuard route_configuration_name: kuard key: fragments: - string_key: kuard listeners: - - name: https - value: | + - value: | name: https address: socket_address: @@ -76,8 +72,7 @@ spec: tls_certificate_sds_secret_configs: - name: kuard.default.svc sds_config: { ads: {}, resource_api_version: "V3" } - - name: https-scoped - value: | + - value: | name: https-scoped address: socket_address: diff --git a/examples/local/envoyconfig.yaml b/examples/local/envoyconfig.yaml index 3ebb637e..868c4e60 100644 --- a/examples/local/envoyconfig.yaml +++ b/examples/local/envoyconfig.yaml @@ -9,8 +9,7 @@ spec: serialization: yaml envoyResources: clusters: - - name: echo_api - value: | + - value: | name: echo_api connect_timeout: 1s type: STRICT_DNS @@ -28,8 +27,7 @@ spec: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext sni: echo-api.3scale.net routes: - - name: echo-api.3scale.net - value: | + - value: | name: echo-api.3scale.net virtual_hosts: - name: ingress @@ -41,8 +39,7 @@ spec: auto_host_rewrite: true cluster: echo_api listeners: - - name: http - value: | + - value: | name: http address: { socket_address: { address: 0.0.0.0, port_value: 8888 }} filter_chains: @@ -64,8 +61,7 @@ spec: type_urls: ["type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"] extensionConfigs: - - name: http_router - value: | + - value: | name: http_router typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router