diff --git a/apis/v1alpha1/gameserverset_types.go b/apis/v1alpha1/gameserverset_types.go index 014d374..052d397 100644 --- a/apis/v1alpha1/gameserverset_types.go +++ b/apis/v1alpha1/gameserverset_types.go @@ -30,7 +30,6 @@ import ( const ( GameServerOwnerGssKey = "game.kruise.io/owner-gss" - OwnerPodKey = "game.kruise.io/owner-pod" GameServerSetReserveIdsKey = "game.kruise.io/reserve-ids" AstsHashKey = "game.kruise.io/asts-hash" PpmHashKey = "game.kruise.io/ppm-hash" diff --git a/cloudprovider/tencentcloud/clb.go b/cloudprovider/tencentcloud/clb.go index c5929e2..43d5aed 100644 --- a/cloudprovider/tencentcloud/clb.go +++ b/cloudprovider/tencentcloud/clb.go @@ -32,6 +32,7 @@ const ( PortProtocolsConfigName = "PortProtocols" MinPortConfigName = "MinPort" MaxPortConfigName = "MaxPort" + OwnerPodKey = "game.kruise.io/owner-pod" ) type portAllocated map[int32]bool @@ -83,7 +84,7 @@ func initLbCache(listenerList []v1alpha1.DedicatedCLBListener, minPort, maxPort newCache := make(map[string]portAllocated) newPodAllocate := make(map[string][]string) for _, lis := range listenerList { - podName, exist := lis.GetLabels()[kruisev1alpha1.OwnerPodKey] + podName, exist := lis.GetLabels()[OwnerPodKey] if !exist || podName == "" { continue } @@ -137,7 +138,7 @@ func (p *ClbPlugin) OnPodUpdated(c client.Client, pod *corev1.Pod, ctx context.C ctx, listeners, client.InNamespace(pod.Namespace), client.MatchingLabels{ - kruisev1alpha1.OwnerPodKey: pod.Name, + OwnerPodKey: pod.Name, kruisev1alpha1.GameServerOwnerGssKey: gss.Name, }, ); err != nil { @@ -303,7 +304,7 @@ func (p *ClbPlugin) consLis(clbConf *clbConfig, pod *corev1.Pod, port portProtoc GenerateName: pod.Name + "-", Namespace: pod.Namespace, Labels: map[string]string{ - kruisev1alpha1.OwnerPodKey: pod.Name, + OwnerPodKey: pod.Name, kruisev1alpha1.GameServerOwnerGssKey: gssName, }, OwnerReferences: []metav1.OwnerReference{ diff --git a/cloudprovider/tencentcloud/clb_test.go b/cloudprovider/tencentcloud/clb_test.go index da3b756..b502113 100644 --- a/cloudprovider/tencentcloud/clb_test.go +++ b/cloudprovider/tencentcloud/clb_test.go @@ -140,7 +140,7 @@ func TestInitLbCache(t *testing.T) { { ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - kruisev1alpha1.OwnerPodKey: "name-0", + OwnerPodKey: "name-0", }, Namespace: "ns-0", Name: "name-0-xxx", @@ -158,7 +158,7 @@ func TestInitLbCache(t *testing.T) { { ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - kruisev1alpha1.OwnerPodKey: "name-1", + OwnerPodKey: "name-1", }, Namespace: "ns-1", Name: "name-1-xxx",