Skip to content

Commit

Permalink
move OwnerPodKey into cloudprovider package
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Oct 29, 2024
1 parent d32df21 commit 2c52888
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion apis/v1alpha1/gameserverset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions cloudprovider/tencentcloud/clb.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
PortProtocolsConfigName = "PortProtocols"
MinPortConfigName = "MinPort"
MaxPortConfigName = "MaxPort"
OwnerPodKey = "game.kruise.io/owner-pod"
)

type portAllocated map[int32]bool
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions cloudprovider/tencentcloud/clb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 2c52888

Please sign in to comment.