From a99665faeef01cf885d299ef21aaf2eae3eeee81 Mon Sep 17 00:00:00 2001 From: DavidSpek Date: Fri, 9 Sep 2022 11:25:42 +0200 Subject: [PATCH] fix knative envoyfilter Signed-off-by: DavidSpek --- apis/kubeflow.org/v1/groupversion_info.go | 4 ++-- apis/kubeflow.org/v1beta1/groupversion_info.go | 4 ++-- apis/kubeflow.org/v2alpha1/groupversion_info.go | 4 ++-- apis/platform/v1alpha1/groupversion_info.go | 4 ++-- controllers/kubeflow.org/profile_controller.go | 10 ++++++---- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apis/kubeflow.org/v1/groupversion_info.go b/apis/kubeflow.org/v1/groupversion_info.go index 080680f6..20fc45e4 100644 --- a/apis/kubeflow.org/v1/groupversion_info.go +++ b/apis/kubeflow.org/v1/groupversion_info.go @@ -15,8 +15,8 @@ limitations under the License. */ // Package v1 contains API Schema definitions for the v1 API group -//+kubebuilder:object:generate=true -//+groupName=kubeflow.org +// +kubebuilder:object:generate=true +// +groupName=kubeflow.org package v1 import ( diff --git a/apis/kubeflow.org/v1beta1/groupversion_info.go b/apis/kubeflow.org/v1beta1/groupversion_info.go index 769fbb26..90de23a6 100644 --- a/apis/kubeflow.org/v1beta1/groupversion_info.go +++ b/apis/kubeflow.org/v1beta1/groupversion_info.go @@ -15,8 +15,8 @@ limitations under the License. */ // Package v1beta1 contains API Schema definitions for the v1beta1 API group -//+kubebuilder:object:generate=true -//+groupName=kubeflow.org +// +kubebuilder:object:generate=true +// +groupName=kubeflow.org package v1beta1 import ( diff --git a/apis/kubeflow.org/v2alpha1/groupversion_info.go b/apis/kubeflow.org/v2alpha1/groupversion_info.go index 0716e71d..3a1edcb9 100644 --- a/apis/kubeflow.org/v2alpha1/groupversion_info.go +++ b/apis/kubeflow.org/v2alpha1/groupversion_info.go @@ -15,8 +15,8 @@ limitations under the License. */ // Package v2alpha1 contains API Schema definitions for the kubeflow.org v2alpha1 API group -//+kubebuilder:object:generate=true -//+groupName=kubeflow.org +// +kubebuilder:object:generate=true +// +groupName=kubeflow.org package v2alpha1 import ( diff --git a/apis/platform/v1alpha1/groupversion_info.go b/apis/platform/v1alpha1/groupversion_info.go index 8f26a1a5..97393d3f 100644 --- a/apis/platform/v1alpha1/groupversion_info.go +++ b/apis/platform/v1alpha1/groupversion_info.go @@ -15,8 +15,8 @@ limitations under the License. */ // Package v1alpha1 contains API Schema definitions for the platform v1alpha1 API group -//+kubebuilder:object:generate=true -//+groupName=platform.kubeflow.org +// +kubebuilder:object:generate=true +// +groupName=platform.kubeflow.org package v1alpha1 import ( diff --git a/controllers/kubeflow.org/profile_controller.go b/controllers/kubeflow.org/profile_controller.go index ecbd6888..b2bd5e04 100755 --- a/controllers/kubeflow.org/profile_controller.go +++ b/controllers/kubeflow.org/profile_controller.go @@ -1091,6 +1091,11 @@ func (r *ProfileReconciler) generatePeerAuthentication(profileIns *profilev2alph func (r *ProfileReconciler) generateEnvoyFilter(profileIns *profilev2alpha1.Profile) *istioNetworkingClientv1alpha3.EnvoyFilter { + luaString := fmt.Sprintf(`function envoy_on_request(request_handle) + headers = request_handle:headers() + request_handle:headers():replace("kubeflow-request-source-namespace", "%s") +end`, profileIns.Name) + envoyfilter := &istioNetworkingClientv1alpha3.EnvoyFilter{ ObjectMeta: metav1.ObjectMeta{ @@ -1137,10 +1142,7 @@ func (r *ProfileReconciler) generateEnvoyFilter(profileIns *profilev2alpha1.Prof }, "inline_code": { Kind: &structpb.Value_StringValue{ - StringValue: `function envoy_on_request(request_handle) - headers = request_handle:headers() - request_handle:headers():replace("kubeflow-request-source-namespace", "david") -end`, + StringValue: luaString, }, }, },