Skip to content

Commit f58c5eb

Browse files
authored
Change the GameServerAllocationPolicy version to stable. (agones-dev#1332)
1 parent 6f06a45 commit f58c5eb

33 files changed

Lines changed: 223 additions & 209 deletions

‎build/build-image/gen-crd-client.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ rsync -r /go/src/agones.dev/agones/vendor/k8s.io/ /go/src/k8s.io/
2323
cd /go/src/k8s.io/code-generator
2424
./generate-groups.sh "all" \
2525
agones.dev/agones/pkg/client \
26-
agones.dev/agones/pkg/apis "allocation:v1 agones:v1 multicluster:v1alpha1 autoscaling:v1" \
26+
agones.dev/agones/pkg/apis "allocation:v1 agones:v1 multicluster:v1 autoscaling:v1" \
2727
--go-header-file=/go/src/agones.dev/agones/build/boilerplate.go.txt
2828

‎cmd/allocator/main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func newServiceHandler(kubeClient kubernetes.Interface, agonesClient versioned.I
163163
gsCounter := gameservers.NewPerNodeCounter(kubeInformerFactory, agonesInformerFactory)
164164

165165
allocator := gameserverallocations.NewAllocator(
166-
agonesInformerFactory.Multicluster().V1alpha1().GameServerAllocationPolicies(),
166+
agonesInformerFactory.Multicluster().V1().GameServerAllocationPolicies(),
167167
kubeInformerFactory.Core().V1().Secrets(),
168168
kubeClient,
169169
gameserverallocations.NewReadyGameServerCache(agonesInformerFactory.Agones().V1().GameServers(), agonesClient.AgonesV1(), gsCounter, health))

‎install/helm/agones/templates/crds/gameserverallocationpolicy.yaml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ metadata:
2828
name: gameserverallocationpolicies.multicluster.agones.dev
2929
spec:
3030
group: multicluster.agones.dev
31-
version: v1alpha1
31+
versions:
32+
- name: v1
33+
served: true
34+
storage: true
35+
- name: v1alpha1
36+
# Disable the v1alpha1 version, but include it for inplace upgrade.
37+
served: false
38+
storage: false
3239
names:
3340
kind: GameServerAllocationPolicy
3441
plural: gameserverallocationpolicies
@@ -67,7 +74,7 @@ spec:
6774
- namespace
6875
type: object
6976
priority:
70-
format: int64
77+
format: int32
7178
minimum: 0
7279
type: integer
7380
weight:

‎install/yaml/install.yaml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,14 @@ metadata:
709709
name: gameserverallocationpolicies.multicluster.agones.dev
710710
spec:
711711
group: multicluster.agones.dev
712-
version: v1alpha1
712+
versions:
713+
- name: v1
714+
served: true
715+
storage: true
716+
- name: v1alpha1
717+
# Disable the v1alpha1 version, but include it for inplace upgrade.
718+
served: false
719+
storage: false
713720
names:
714721
kind: GameServerAllocationPolicy
715722
plural: gameserverallocationpolicies
@@ -748,7 +755,7 @@ spec:
748755
- namespace
749756
type: object
750757
priority:
751-
format: int64
758+
format: int32
752759
minimum: 0
753760
type: integer
754761
weight:

‎pkg/apis/agones/v1/fuzz_test/roundtrip_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
agonesv1 "agones.dev/agones/pkg/apis/agones/v1"
88
allocationv1 "agones.dev/agones/pkg/apis/allocation/v1"
99
autoscalingv1 "agones.dev/agones/pkg/apis/autoscaling/v1"
10-
multiclusterv1alpha1 "agones.dev/agones/pkg/apis/multicluster/v1alpha1"
10+
multiclusterv1 "agones.dev/agones/pkg/apis/multicluster/v1"
1111
"github.com/stretchr/testify/assert"
1212
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
1313
"k8s.io/apimachinery/pkg/api/apitesting/roundtrip"
@@ -24,7 +24,7 @@ func TestRoundTripTypes(t *testing.T) {
2424
agonesv1.AddToScheme,
2525
allocationv1.AddToScheme,
2626
autoscalingv1.AddToScheme,
27-
multiclusterv1alpha1.AddToScheme,
27+
multiclusterv1.AddToScheme,
2828
}
2929
seed := rand.Int63()
3030
localFuzzer := fuzzer.FuzzerFor(genericfuzzer.Funcs, rand.NewSource(seed), codecs)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
// +k8s:deepcopy-gen=package,register
1616

17-
// Package v1alpha1 is the v1alpha1 version of the API.
17+
// Package v1 is the v1 version of the API.
1818
// +groupName=multicluster.agones.dev
19-
package v1alpha1
19+
package v1

pkg/apis/multicluster/v1alpha1/gameserverallocationpolicy.go renamed to pkg/apis/multicluster/v1/gameserverallocationpolicy.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package v1alpha1
15+
package v1
1616

1717
import (
1818
"math/rand"
@@ -24,7 +24,7 @@ import (
2424
// GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy
2525
type GameServerAllocationPolicySpec struct {
2626
// +kubebuilder:validation:Minimum=0
27-
Priority int `json:"priority"`
27+
Priority int32 `json:"priority"`
2828
// +kubebuilder:validation:Minimum=0
2929
Weight int `json:"weight"`
3030
ConnectionInfo ClusterConnectionInfo `json:"connectionInfo,omitempty"`
@@ -70,9 +70,9 @@ type ConnectionInfoIterator struct {
7070
// currPriority Current priority index from the orderedPriorities
7171
currPriority int
7272
// orderedPriorities list of ordered priorities
73-
orderedPriorities []int
73+
orderedPriorities []int32
7474
// priorityToCluster Map of priority to cluster-policies map
75-
priorityToCluster map[int]map[string][]*GameServerAllocationPolicy
75+
priorityToCluster map[int32]map[string][]*GameServerAllocationPolicy
7676
// clusterBlackList the cluster blacklist for the clusters that has already returned
7777
clusterBlackList map[string]bool
7878
}
@@ -99,7 +99,7 @@ func (it *ConnectionInfoIterator) Next() *ClusterConnectionInfo {
9999

100100
// NewConnectionInfoIterator creates an iterator for connection info
101101
func NewConnectionInfoIterator(policies []*GameServerAllocationPolicy) *ConnectionInfoIterator {
102-
priorityToCluster := make(map[int]map[string][]*GameServerAllocationPolicy)
102+
priorityToCluster := make(map[int32]map[string][]*GameServerAllocationPolicy)
103103
for _, policy := range policies {
104104
priority := policy.Spec.Priority
105105
clusterName := policy.Spec.ConnectionInfo.ClusterName
@@ -120,7 +120,7 @@ func NewConnectionInfoIterator(policies []*GameServerAllocationPolicy) *Connecti
120120
}
121121

122122
// 3. Sort priorities
123-
priorities := make([]int, 0, len(priorityToCluster))
123+
priorities := make([]int32, 0, len(priorityToCluster))
124124
for k := range priorityToCluster {
125125
priorities = append(priorities, k)
126126
}

pkg/apis/multicluster/v1alpha1/gameserverallocationpolicy_test.go renamed to pkg/apis/multicluster/v1/gameserverallocationpolicy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package v1alpha1
15+
package v1
1616

1717
import (
1818
"testing"

pkg/apis/multicluster/v1alpha1/register.go renamed to pkg/apis/multicluster/v1/register.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package v1alpha1
15+
package v1
1616

1717
import (
1818
"agones.dev/agones/pkg/apis/multicluster"
@@ -23,7 +23,7 @@ import (
2323
)
2424

2525
// SchemeGroupVersion is group version used to register these objects
26-
var SchemeGroupVersion = schema.GroupVersion{Group: multicluster.GroupName, Version: "v1alpha1"}
26+
var SchemeGroupVersion = schema.GroupVersion{Group: multicluster.GroupName, Version: "v1"}
2727

2828
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
2929
func Kind(kind string) schema.GroupKind {

pkg/apis/multicluster/v1alpha1/zz_generated.deepcopy.go renamed to pkg/apis/multicluster/v1/zz_generated.deepcopy.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)