From e90efe1c34c6ce6956c2d36505f2119f82dd9077 Mon Sep 17 00:00:00 2001 From: Pilipalaca <85749695@qq.com> Date: Thu, 21 Apr 2022 17:13:05 +0800 Subject: [PATCH] fix: fix the gateway variable name. Signed-off-by: Pilipalaca <85749695@qq.com> --- pkg/models/gateway/gateway.go | 8 ++++---- pkg/models/gateway/gateway_test.go | 12 ++++++------ .../api/gateway/v1alpha1/gateway_types.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/models/gateway/gateway.go b/pkg/models/gateway/gateway.go index 18108ca93..240581785 100644 --- a/pkg/models/gateway/gateway.go +++ b/pkg/models/gateway/gateway.go @@ -98,7 +98,7 @@ func (c *gatewayOperator) overideDefaultValue(gateway *v1alpha1.Gateway, namespa // overide default name gateway.Name = fmt.Sprint(gatewayPrefix, namespace) if gateway.Name != globalGatewayname { - gateway.Spec.Conroller.Scope = v1alpha1.Scope{Enabled: true, Namespace: namespace} + gateway.Spec.Controller.Scope = v1alpha1.Scope{Enabled: true, Namespace: namespace} } gateway.Namespace = c.getWorkingNamespace(namespace) return gateway @@ -155,7 +155,7 @@ func (c *gatewayOperator) convert(namespace string, svc *corev1.Service, deploy Namespace: svc.Namespace, }, Spec: v1alpha1.GatewaySpec{ - Conroller: v1alpha1.ControllerSpec{ + Controller: v1alpha1.ControllerSpec{ Scope: v1alpha1.Scope{ Enabled: true, Namespace: namespace, @@ -336,7 +336,7 @@ func (c *gatewayOperator) UpgradeGateway(namespace string) (*v1alpha1.Gateway, e cm := &corev1.ConfigMap{} err := c.client.Get(context.TODO(), client.ObjectKey{Namespace: l.Namespace, Name: fmt.Sprintf("%s-nginx", l.Name)}, cm) if err == nil { - l.Spec.Conroller.Config = cm.Data + l.Spec.Controller.Config = cm.Data defer func() { c.client.Delete(context.TODO(), cm) }() @@ -459,7 +459,7 @@ func (c *gatewayOperator) filter(object runtime.Object, filter query.Filter) boo namesapce = svc.Labels["project"] objMeta = svc.ObjectMeta } else { - namesapce = gateway.Spec.Conroller.Scope.Namespace + namesapce = gateway.Spec.Controller.Scope.Namespace objMeta = gateway.ObjectMeta } diff --git a/pkg/models/gateway/gateway_test.go b/pkg/models/gateway/gateway_test.go index 6a272566c..95f013605 100644 --- a/pkg/models/gateway/gateway_test.go +++ b/pkg/models/gateway/gateway_test.go @@ -169,7 +169,7 @@ func Test_gatewayOperator_GetGateways(t *testing.T) { Namespace: "kubesphere-controls-system", }, Spec: v1alpha1.GatewaySpec{ - Conroller: v1alpha1.ControllerSpec{ + Controller: v1alpha1.ControllerSpec{ Scope: v1alpha1.Scope{ Enabled: true, Namespace: "project6", @@ -343,7 +343,7 @@ func Test_gatewayOperator_CreateGateway(t *testing.T) { APIVersion: "gateway.kubesphere.io/v1alpha1", }, Spec: v1alpha1.GatewaySpec{ - Conroller: v1alpha1.ControllerSpec{ + Controller: v1alpha1.ControllerSpec{ Scope: v1alpha1.Scope{ Enabled: true, Namespace: "projct1", @@ -374,7 +374,7 @@ func Test_gatewayOperator_CreateGateway(t *testing.T) { APIVersion: "gateway.kubesphere.io/v1alpha1", }, Spec: v1alpha1.GatewaySpec{ - Conroller: v1alpha1.ControllerSpec{ + Controller: v1alpha1.ControllerSpec{ Scope: v1alpha1.Scope{ Enabled: true, Namespace: "projct2", @@ -506,7 +506,7 @@ func Test_gatewayOperator_UpdateGateway(t *testing.T) { ResourceVersion: "1", }, Spec: v1alpha1.GatewaySpec{ - Conroller: v1alpha1.ControllerSpec{ + Controller: v1alpha1.ControllerSpec{ Scope: v1alpha1.Scope{ Enabled: true, Namespace: "project3", @@ -615,7 +615,7 @@ func Test_gatewayOperator_UpgradeGateway(t *testing.T) { ResourceVersion: "1", }, Spec: v1alpha1.GatewaySpec{ - Conroller: v1alpha1.ControllerSpec{ + Controller: v1alpha1.ControllerSpec{ Scope: v1alpha1.Scope{ Enabled: true, Namespace: "project2", @@ -691,7 +691,7 @@ func Test_gatewayOperator_ListGateways(t *testing.T) { Namespace: "kubesphere-controls-system", }, Spec: v1alpha1.GatewaySpec{ - Conroller: v1alpha1.ControllerSpec{ + Controller: v1alpha1.ControllerSpec{ Scope: v1alpha1.Scope{ Enabled: true, Namespace: "project2", diff --git a/staging/src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go b/staging/src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go index 7a29220d4..8c461b806 100644 --- a/staging/src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go +++ b/staging/src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go @@ -24,7 +24,7 @@ import ( // GatewaySpec defines the desired state of Gateway type GatewaySpec struct { - Conroller ControllerSpec `json:"controller,omitempty"` + Controller ControllerSpec `json:"controller,omitempty"` Service ServiceSpec `json:"service,omitempty"` Deployment DeploymentSpec `json:"deployment,omitempty"` }