Skip to content

Commit

Permalink
Fix typo and rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchiu committed Aug 1, 2018
1 parent 99cd36f commit 299d289
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/entity/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Pod struct {
Networks []PodNetwork `bson:"networks,omitempty" json:"networks" validate:"required,dive,required"`
RestartPolicy string `bson:"restartPolicy" json:"restartPolicy" validate:"required,eq=Always|eq=OnFailure|eq=Never`
Capability bool `bson:"capability" json:"capability" validate:"-"`
NetworkType string `bson:"networkType" json:"networkType" validate:"required,eq=Host|Cluster|Custom`
NetworkType string `bson:"networkType" json:"networkType" validate:"required,eq=host|cluster|custom`
NodeAffinity []string `bson:"nodeAffinity" json:"nodeAffinity" validate:"required"`
}

Expand Down
8 changes: 4 additions & 4 deletions src/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func CreatePod(sp *serviceprovider.Container, pod *entity.Pod) error {
return err
}

nodeNames := pod.NodeAffinity
nodeAffinity := pod.NodeAffinity
initContainers := []corev1.Container{}
hostNetwork := false
switch pod.NetworkType {
Expand All @@ -241,10 +241,10 @@ func CreatePod(sp *serviceprovider.Container, pod *entity.Pod) error {
tmp := []string{}
tmp, initContainers, err = generateNetwork(session, pod)
if len(tmp) != 0 {
nodeNames = utils.Intersection(nodeNames, tmp)
nodeAffinity = utils.Intersection(nodeAffinity, tmp)
}
case entity.PodClusterNetwork:
//For cluster network, we won't set the nodeAffinity and any netwokr options.
//For cluster network, we won't set the nodeAffinity and any network options.
default:
err = fmt.Errorf("UnSupported Pod NetworkType %s", pod.NetworkType)
}
Expand Down Expand Up @@ -283,7 +283,7 @@ func CreatePod(sp *serviceprovider.Container, pod *entity.Pod) error {
InitContainers: initContainers,
Containers: containers,
Volumes: volumes,
Affinity: generateAffinity(nodeNames),
Affinity: generateAffinity(nodeAffinity),
RestartPolicy: corev1.RestartPolicy(pod.RestartPolicy),
HostNetwork: hostNetwork,
},
Expand Down
4 changes: 2 additions & 2 deletions src/server/handler_pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (suite *PodTestSuite) TestGetPodWithInvalidID() {
}

func (suite *PodTestSuite) TestListPod() {
/*namespace := "default"
namespace := "default"
pods := []entity.Pod{}
count := 3
for i := 0; i < count; i++ {
Expand Down Expand Up @@ -302,7 +302,7 @@ func (suite *PodTestSuite) TestListPod() {
suite.Equal(len(pods[i].Containers), len(p.Containers))
}
})
}*/
}
}

func (suite *PodTestSuite) TestListPodWithInvalidPage() {
Expand Down

0 comments on commit 299d289

Please sign in to comment.