Skip to content

Commit

Permalink
Move FleetAutoscaling to autoscaling.agones.dev group
Browse files Browse the repository at this point in the history
This is a pure refactor, to move FleetAutoscaling to the group outlined
in googleforgames#703, where it will stay.

Did this one first, since it seemed like the easiest one to tackle.
  • Loading branch information
markmandel committed Jun 13, 2019
1 parent 6d31aa5 commit f406fc3
Show file tree
Hide file tree
Showing 54 changed files with 1,552 additions and 927 deletions.
2 changes: 1 addition & 1 deletion build/build-image/Dockerfile
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# ForceUpdate 7 -- change here if you need to force a rebuild
# ForceUpdate 8 -- change here if you need to force a rebuild

FROM debian:stretch

Expand Down
2 changes: 1 addition & 1 deletion build/build-image/gen-crd-client.sh
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:v1alpha1 stable:v1alpha1 multicluster:v1alpha1" \
agones.dev/agones/pkg/apis "allocation:v1alpha1 stable:v1alpha1 multicluster:v1alpha1 autoscaling:v1alpha1" \
--go-header-file=/go/src/agones.dev/agones/build/boilerplate.go.txt

2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/main.go
Expand Up @@ -25,7 +25,7 @@ import (
"os"
"strconv"

"agones.dev/agones/pkg/apis/stable/v1alpha1"
"agones.dev/agones/pkg/apis/autoscaling/v1alpha1"
"agones.dev/agones/pkg/util/runtime" // for the logger
)

Expand Down
2 changes: 1 addition & 1 deletion examples/fleetautoscaler.yaml
Expand Up @@ -17,7 +17,7 @@
# automatically depending on load
#

apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
# FleetAutoscaler Metadata
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-udp/fleetautoscaler.yaml
Expand Up @@ -17,7 +17,7 @@
# up and down depending on usage
#

apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
name: simple-udp-autoscaler
Expand Down
2 changes: 1 addition & 1 deletion examples/webhookfleetautoscaler.yaml
Expand Up @@ -16,7 +16,7 @@
# Full example of a FleetAutoscaler - this is used to scale a Fleet
# automatically depending on load
#
apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
name: webhook-fleet-autoscaler
Expand Down
2 changes: 1 addition & 1 deletion examples/webhookfleetautoscalertls.yaml
Expand Up @@ -16,7 +16,7 @@
# Full example of a FleetAutoscaler - this is used to scale a Fleet
# automatically depending on load
#
apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
name: webhook-fleetautoscaler-tls
Expand Down
2 changes: 1 addition & 1 deletion examples/xonotic/fleetautoscaler.yaml
Expand Up @@ -17,7 +17,7 @@
# up and down depending on usage
#

apiVersion: "stable.agones.dev/v1alpha1"
apiVersion: "autoscaling.agones.dev/v1alpha1"
kind: FleetAutoscaler
metadata:
name: xonotic-autoscaler
Expand Down
4 changes: 2 additions & 2 deletions install/helm/agones/templates/crds/fleetautoscaler.yaml
Expand Up @@ -17,15 +17,15 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: fleetautoscalers.stable.agones.dev
name: fleetautoscalers.autoscaling.agones.dev
labels:
component: crd
app: {{ template "agones.name" . }}
chart: {{ template "agones.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
group: stable.agones.dev
group: autoscaling.agones.dev
version: v1alpha1
scope: Namespaced
names:
Expand Down
2 changes: 1 addition & 1 deletion install/yaml/install.yaml
Expand Up @@ -458,7 +458,7 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: fleetautoscalers.stable.agones.dev
name: fleetautoscalers.autoscaling.agones.dev
labels:
component: crd
app: agones
Expand Down
18 changes: 18 additions & 0 deletions pkg/apis/allocation/v1alpha1/zz_generated.deepcopy.go

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

20 changes: 20 additions & 0 deletions pkg/apis/autoscaling/register.go
@@ -0,0 +1,20 @@
// Copyright 2019 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package autoscaling

const (
// GroupName is the Scheme Group Name for Agones Custom Resource Definitions
GroupName = "autoscaling.agones.dev"
)
19 changes: 19 additions & 0 deletions pkg/apis/autoscaling/v1alpha1/doc.go
@@ -0,0 +1,19 @@
// Copyright 2019 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

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

// Package v1alpha1 is the v1alpha1 version of the API.
// +groupName=autoscaling.agones.dev
package v1alpha1
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC All Rights Reserved.
// Copyright 2019 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,7 @@ import (
"crypto/x509"
"net/url"

"agones.dev/agones/pkg/apis/stable/v1alpha1"
admregv1b "k8s.io/api/admissionregistration/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -143,7 +144,7 @@ type FleetAutoscaleRequest struct {
// Namespace is the namespace associated with the request (if any).
Namespace string `json:"namespace"`
// The Fleet's status values
Status FleetStatus `json:"status"`
Status v1alpha1.FleetStatus `json:"status"`
}

// FleetAutoscaleResponse defines the response of webhook autoscaler endpoint
Expand Down
59 changes: 59 additions & 0 deletions pkg/apis/autoscaling/v1alpha1/register.go
@@ -0,0 +1,59 @@
// Copyright 2019 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1

import (
"agones.dev/agones/pkg/apis/stable"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sruntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/kubernetes/scheme"
)

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

// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

var (
// SchemeBuilder registers our types
SchemeBuilder = k8sruntime.NewSchemeBuilder(addKnownTypes)
// AddToScheme local alias for SchemeBuilder.AddToScheme
AddToScheme = SchemeBuilder.AddToScheme
)

func init() {
if err := AddToScheme(scheme.Scheme); err != nil {
panic(err)
}
}

// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *k8sruntime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&FleetAutoscaler{},
&FleetAutoscalerList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

0 comments on commit f406fc3

Please sign in to comment.