Skip to content

Commit

Permalink
Change the GameServerAllocationPolicy version to stable. (#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
pooneh-m committed Feb 12, 2020
1 parent 6f06a45 commit f58c5eb
Show file tree
Hide file tree
Showing 33 changed files with 223 additions and 209 deletions.
2 changes: 1 addition & 1 deletion build/build-image/gen-crd-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ rsync -r /go/src/agones.dev/agones/vendor/k8s.io/ /go/src/k8s.io/
cd /go/src/k8s.io/code-generator
./generate-groups.sh "all" \
agones.dev/agones/pkg/client \
agones.dev/agones/pkg/apis "allocation:v1 agones:v1 multicluster:v1alpha1 autoscaling:v1" \
agones.dev/agones/pkg/apis "allocation:v1 agones:v1 multicluster:v1 autoscaling:v1" \
--go-header-file=/go/src/agones.dev/agones/build/boilerplate.go.txt

2 changes: 1 addition & 1 deletion cmd/allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func newServiceHandler(kubeClient kubernetes.Interface, agonesClient versioned.I
gsCounter := gameservers.NewPerNodeCounter(kubeInformerFactory, agonesInformerFactory)

allocator := gameserverallocations.NewAllocator(
agonesInformerFactory.Multicluster().V1alpha1().GameServerAllocationPolicies(),
agonesInformerFactory.Multicluster().V1().GameServerAllocationPolicies(),
kubeInformerFactory.Core().V1().Secrets(),
kubeClient,
gameserverallocations.NewReadyGameServerCache(agonesInformerFactory.Agones().V1().GameServers(), agonesClient.AgonesV1(), gsCounter, health))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ metadata:
name: gameserverallocationpolicies.multicluster.agones.dev
spec:
group: multicluster.agones.dev
version: v1alpha1
versions:
- name: v1
served: true
storage: true
- name: v1alpha1
# Disable the v1alpha1 version, but include it for inplace upgrade.
served: false
storage: false
names:
kind: GameServerAllocationPolicy
plural: gameserverallocationpolicies
Expand Down Expand Up @@ -67,7 +74,7 @@ spec:
- namespace
type: object
priority:
format: int64
format: int32
minimum: 0
type: integer
weight:
Expand Down
11 changes: 9 additions & 2 deletions install/yaml/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,14 @@ metadata:
name: gameserverallocationpolicies.multicluster.agones.dev
spec:
group: multicluster.agones.dev
version: v1alpha1
versions:
- name: v1
served: true
storage: true
- name: v1alpha1
# Disable the v1alpha1 version, but include it for inplace upgrade.
served: false
storage: false
names:
kind: GameServerAllocationPolicy
plural: gameserverallocationpolicies
Expand Down Expand Up @@ -748,7 +755,7 @@ spec:
- namespace
type: object
priority:
format: int64
format: int32
minimum: 0
type: integer
weight:
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/agones/v1/fuzz_test/roundtrip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
agonesv1 "agones.dev/agones/pkg/apis/agones/v1"
allocationv1 "agones.dev/agones/pkg/apis/allocation/v1"
autoscalingv1 "agones.dev/agones/pkg/apis/autoscaling/v1"
multiclusterv1alpha1 "agones.dev/agones/pkg/apis/multicluster/v1alpha1"
multiclusterv1 "agones.dev/agones/pkg/apis/multicluster/v1"
"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
"k8s.io/apimachinery/pkg/api/apitesting/roundtrip"
Expand All @@ -24,7 +24,7 @@ func TestRoundTripTypes(t *testing.T) {
agonesv1.AddToScheme,
allocationv1.AddToScheme,
autoscalingv1.AddToScheme,
multiclusterv1alpha1.AddToScheme,
multiclusterv1.AddToScheme,
}
seed := rand.Int63()
localFuzzer := fuzzer.FuzzerFor(genericfuzzer.Funcs, rand.NewSource(seed), codecs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

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

// Package v1alpha1 is the v1alpha1 version of the API.
// Package v1 is the v1 version of the API.
// +groupName=multicluster.agones.dev
package v1alpha1
package v1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1
package v1

import (
"math/rand"
Expand All @@ -24,7 +24,7 @@ import (
// GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy
type GameServerAllocationPolicySpec struct {
// +kubebuilder:validation:Minimum=0
Priority int `json:"priority"`
Priority int32 `json:"priority"`
// +kubebuilder:validation:Minimum=0
Weight int `json:"weight"`
ConnectionInfo ClusterConnectionInfo `json:"connectionInfo,omitempty"`
Expand Down Expand Up @@ -70,9 +70,9 @@ type ConnectionInfoIterator struct {
// currPriority Current priority index from the orderedPriorities
currPriority int
// orderedPriorities list of ordered priorities
orderedPriorities []int
orderedPriorities []int32
// priorityToCluster Map of priority to cluster-policies map
priorityToCluster map[int]map[string][]*GameServerAllocationPolicy
priorityToCluster map[int32]map[string][]*GameServerAllocationPolicy
// clusterBlackList the cluster blacklist for the clusters that has already returned
clusterBlackList map[string]bool
}
Expand All @@ -99,7 +99,7 @@ func (it *ConnectionInfoIterator) Next() *ClusterConnectionInfo {

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

// 3. Sort priorities
priorities := make([]int, 0, len(priorityToCluster))
priorities := make([]int32, 0, len(priorityToCluster))
for k := range priorityToCluster {
priorities = append(priorities, k)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1
package v1

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1
package v1

import (
"agones.dev/agones/pkg/apis/multicluster"
Expand All @@ -23,7 +23,7 @@ import (
)

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

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions pkg/client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions pkg/client/clientset/versioned/fake/clientset_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f58c5eb

Please sign in to comment.