Skip to content

Commit

Permalink
fix: fix the gateway variable name.
Browse files Browse the repository at this point in the history
Signed-off-by: Pilipalaca <85749695@qq.com>
  • Loading branch information
2hangchen committed Apr 21, 2022
1 parent 7d9563d commit e90efe1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions pkg/models/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}()
Expand Down Expand Up @@ -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
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/models/gateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down

0 comments on commit e90efe1

Please sign in to comment.